• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

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

Community Beginner ,
Apr 01, 2023 Apr 01, 2023

Copy link to clipboard

Copied

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);

TOPICS
Expressions

Views

151

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 02, 2023 Apr 02, 2023

Copy link to clipboard

Copied

LATEST

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines