forked from LinoBigatti/TAC
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsineYsmall.gd
38 lines (29 loc) · 1.12 KB
/
sineYsmall.gd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# Any script that interacts with the Project Heartbeat API is licensed under the
# AGPLv3 for the general public and also gives an exclusive, royalty-free license
# for EIRTeam to incorporate it in the game
# Documentation for the scripting system can be found here: https://steamcommunity.com/sharedfiles/filedetails/?id=2398390074
#
# Small sine wave Y script
# By Lino
# Original expression by NeoRash
# Vector2(note.position.x + 20 * sin(1.5 * note.position.y/100), note.position.y)
#
extends ScriptRunnerScript # Do not remove this
func run_script() -> int:
# Get selected timing points
var selected_timing_points := get_selected_timing_points()
# Initialize variables
var amp = 20
var freq = 1.5
# Iterate over them
for i in range(selected_timing_points.size()):
var point := selected_timing_points[i] as HBTimingPoint
# Fancy math
var z = point.position.y / 100
var x = amp * sin(freq * z)
var pos = Vector2(x + 960, point.position.y)
# Change position
set_timing_point_property(point, "position", pos)
# Return OK to apply the script's changes, return anything else (such as -1)
# to cancel it
return OK