-
Help with Math.sin & blinking…
Hey all, I need a little help.
I am trying to create a little more complex version of a blinking object using Math.sin…
sec = 2; // duration of blink in seconds
wave = Math.sin(time * Math.PI / sec);if (wave >= 0) 1 else 0;
What I want to do is when the object blinks on, it stays on for “X” amount of time, and when it blinks off, it stays off for “X” amount of time
What I did was create 2 sliders, one for the “off” time and one for the “on” time, along with a simple switch, so when the wave hits 0, “sec” is replace with the “off time” amount, and when the wave is at 1, “sec” is replaced with the “on time” amount (expression not shown).
It obviously didn’t work, I understand why it didn’t work, but I don’t think I could properly explain it.
Any thoughts on how I could make my idea work??
Thanks in advance…
Stephen =]