I've got a little shader effect - just a sine wave controlling vertex scale so far - and I've got a freq
uniform controlling it. I'm using a tween to control this in gdscript.
The obj starts at freq
zero (nothing happening), then tweens to freq
one. When it's done it fires a signal and tweens back from freq
one to zero:
Here's the tween subroutine where I send in the start and stop values:
func run_tween(a, b):
printt("freq", mat.get_shader_param("freq"))
var t = $Tween
t.interpolate_property(
mat, "shader_param/freq", a, b, 1,
Tween.TRANS_BOUNCE, Tween.EASE_IN_OUT)
t.start()
Here's signal method:
func _on_Tween_tween_all_completed():
if not odd_even:
run_tween(1, 0)
printt("freq", mat.get_shader_param("freq"))
odd_even = not odd_even
Obviously I have the odd_even
bool there to go back and forth.
This prints:
freq 0
freq 1
freq 1
freq 0
Except the frequency is visibly speeding up every time you run it. Same duration, quicker sine wave. It even happens when you lerp without easing.
I'm not changing any other values. Am I missing something obvious here?