Godot4ShadersPlayground/scripts/SinMove.gd

21 lines
457 B
GDScript

@tool
extends Node
var total_time : float = 0
@export_range(0, PI) var phase : float = 0
@export_range(0, 5) var speed : float = 1.0
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
total_time += delta
var sig : float = sin((total_time * speed) + phase) * 2
self.position.x = sig