15 lines
374 B
GDScript
15 lines
374 B
GDScript
extends Sprite2D
|
|
@export var gradient : Gradient
|
|
@export var teeth : int = 1
|
|
@export var time_per_tooth : float = 5.0
|
|
@export var clockwise : bool
|
|
var step : float
|
|
|
|
func _ready() -> void:
|
|
step = 2.0 * PI / (teeth * time_per_tooth)
|
|
modulate = gradient.sample(randf())
|
|
|
|
func _process(delta: float) -> void:
|
|
var angle = step * delta
|
|
rotate(angle if clockwise else -angle)
|