i need to make a code that cycles but stops if the trigger is disabled. Like a rotator that cycles once, from -180/180. But not rotator, but as a variable.
When the trigger is held it keeps cycling. However as soon as the trigger is removed it stops at 0 again. Not instantly like if its interupted at a value of 90, it will still keep going till it reaches 0 and then stop.
In code terms
trigger = start_cycle
not_trigger = not_start_cycle
cycle = -180/180 stop 0
Or simply
cycle goes from -180 to 180 and it doesn't keep going, it stops. only when Trigger has a value of 1 will cycle be able to return to -180.
@Grob0s0VBRa @hpgbproductions Thank you!
welp, try this
varname
varname - the name of variable
trig - trigger
wellleliwonderifimlateyouknow
This is something I made a long time ago
.
WiperAnimator:
repeat(sum( InputWipers | (WiperAnimator>2&WiperAnimator<3.9)?1:0 ),4)
Comment: The animation period is 4s, and the state of the animation is tracked in WiperAnimator. The animation always advances if it is in the range t=2..3.9
.
WiperPosition:
WiperAnimator<1 ? smoothstep(0,1,WiperAnimator) : (WiperAnimator<2 ? smoothstep(1,0,WiperAnimator-1) : 0)
Comment: Not related to your question but good for context. Interpret the animation value. t=0..1: smoothstep increasing; t=1..2: smoothstep decreasing; t=2..4: constant zero