Profile image

need advice with advanced funky trees

97.0k winterro  4 days ago

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.

  • Log in to leave a comment
  • Profile image
    97.0k winterro

    @Grob0s0VBRa @hpgbproductions Thank you!

    3 days ago
  • Profile image
    13.5k Grob0s0VBRa

    welp, try this
    varname

    180*(sin(sum(clamp01(trig|abs(varname)>1))*60) )

    varname - the name of variable
    trig - trigger

    wellleliwonderifimlateyouknow

    +2 3 days ago
  • Profile image

    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

    +2 3 days ago