Skip to main content
New Participant
April 2, 2023
Question

Random rotation that starts at and ends at the same number - LOOP

  • April 2, 2023
  • 1 reply
  • 246 views

OK this is a definate Jedi Java expression. How do I take the random expression below that moves a meter on a meter and will end on the same rotation number so I can loop it.

//Smooth wiggle

freq = effect("Speed")("Slider");

amp = effect("Range")("Slider");

n = freq.numKeys;

if (n > 0 && freq.key(1).time < time){ accum = freq.key(1).value*(freq.key(1).time - inPoint);

for (i = 2; i <= n; i++){

if (freq.key(i).time > time) break; k1 = freq.key(i-1); k2 = freq.key(i); accum += (k1.value + k2.value)*(k2.time - k1.time)/2; } accum += (freq.value + freq.key(i-1).value)*(time - freq.key(i-1).time)/2; }

else{

accum = freq.value*(time - inPoint);

}

t = wiggle(1,amp,1,.5,accum); //Limit range to meter scale minimum and maximum

linear(t, -100, 100, -85, 89);

This topic has been closed for replies.

1 reply

Mylenium
Brainiac
April 2, 2023

It would probably be a lot simpler to just animate the amplitude of the wiggle and animate the base value along with it to have fixed pinning points, then pre-compose and loop that with time-remapping. Same for simply convcerting the expression to keyframes.Due to how wiggle works you'd probably need to apply the two expressions to different controls, anyway. Even if one were to construct a second loop around your existing one it has no way of knowing what the actual output values are.

 

Mylenium