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

Issues with animating wiggle speed

Community Beginner ,
Dec 05, 2023 Dec 05, 2023

Copy link to clipboard

Copied

Hi.

I am trying to animate circles using the wiggle expression. I need the wiggle speed (frequency) to start at a certain speed and then speed up through the animation, then stay at the same speed for a second at the end. This is part of a larger shot that has other circles with a wiggle speed value that is HIGHER than the end speed of the circles that speed up. 

 

However, when the wiggle speed is supposed to level out, the circles speed up very fast (even faster or just as fast as the ones with a higher speed value) and THEN they slow back down to where they should be.

I have the speed values linked to slider controls and have based their expressions on this article:
https://www.motionscript.com/articles/speed-control.html

 

Can somebody please explain how to speed up the wiggle speed and just have it level off at a constant value instead of the spike where they go REALLY fast and then settle down into the speed they should have been since the keyframe? This is driving me crazy. I have lost hours trouble shooting this. (I even tried keeping the wiggle speed constant and animating time remapping)

 

Here is the base expression I am using (based on the above link):

freq = (thisComp.layer("wiggle_control").effect("wiggleSpeed")("Slider"));
amp = (thisComp.layer("wiggle_control").effect("wiggleSize")("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);
}
seedRandom(thisComp.layer("wiggle_control").effect("seedAdd")("Slider") + index);
wiggle(1,amp,1,.5,accum)

 

Here is a screenshot of my keyframes on the control:

2023-12-05_11-11-02.png

 

Any help would be greatly appreciated. Thank you!

TOPICS
Expressions

Views

796

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

correct answers 1 Correct answer

Community Expert , Dec 07, 2023 Dec 07, 2023

One thing I noticed is that you have some easing on the frequency slider keyframes, so the linear keframe integration method isn't going to work. Instead you could switch to the frame-by-frame brute force method, which would look like this:

freq = (thisComp.layer("wiggle_control").effect("wiggleSpeed")("Slider"));
amp = (thisComp.layer("wiggle_control").effect("wiggleSize")("Slider"));
accum = 0;
for (i = timeToFrames(inPoint); i <= timeToFrames(time); i++){
  accum += freq.valueAtTime(framesToT
...

Votes

Translate

Translate
Community Expert ,
Dec 05, 2023 Dec 05, 2023

Copy link to clipboard

Copied

What property are you animating? I'm not seeing the behavior you describe with the expression you're using.

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
Community Beginner ,
Dec 05, 2023 Dec 05, 2023

Copy link to clipboard

Copied

Thanks so much for he quick reply!

I am animating position.

Here is an example. The "fast" wiggle happens right around the frame 100-120 mark.

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
Community Beginner ,
Dec 05, 2023 Dec 05, 2023

Copy link to clipboard

Copied

I should mention this animation I posted is retimed a bit in the comp AFTER the comp that has the keys in the pic above. That moves the frames of the keyframes in that pic up a bit, hence 100-120 in the animation and not the 125 in the pic.

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
Community Expert ,
Dec 05, 2023 Dec 05, 2023

Copy link to clipboard

Copied

I mocked up your setup as close as I could and I don't see any issues with the speed. I didn't however, attempt any additional time remapping. It's hard to say without seeing the project.

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
Community Beginner ,
Dec 07, 2023 Dec 07, 2023

Copy link to clipboard

Copied

Thank you so much for looking into this!


I got rid of the retiming, but the issue persists.

 

I've included a project file that has the same setup (with the retiming turned off).

 

The top 6 rows of particles stay at a constant speed. You can see a wave of "hyper-wiggle" that goes through the bottom 6 rows of particles as their speed value animates and then mellows out in the last second of the animation after the keyframes (even though the speed value itself never lowers).

 

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
Community Expert ,
Dec 07, 2023 Dec 07, 2023

Copy link to clipboard

Copied

Thanks for posting that. It's going to take some time to really look into this, but I fear that my technique may not be as sound as I thought. I'll get back with more info when I have it.

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
Community Beginner ,
Dec 07, 2023 Dec 07, 2023

Copy link to clipboard

Copied

Ok, Cool.

Well, either way I'll definitely be interested to hear your conclusions after looking into it.

 

For what it's worth, this has seemed to work well with slower wiggle speeds.

 

I was thinking there might be some sort of "speed limit" where the time goes fast enough that enough frames are skipped that the "wiggle" just becomes a series of jumps. So in that case after this speed limit is reached, faster speeds are indistinguishable from slower speeds (assuming the "slower speeds" are past this speed limit) because they all just appear to be a series of random jumps. We are limited by framerate, after all. This would be a larger problem (or at least there would essentially be a slower speed limit) with a setup like mine where the wiggle size (amplitude) is limited to a small number of pixels.

 

That said, I discounted a "speed limit" as the issue here because the animation noticeably slows down at the end. If we were hitting that speed limit, there would be no slowdown at the end. The wiggle speed would remain perceptibly the same (as a series of quick jumps). Anyway, just thought I'd share my thoughts on that.

 

Look forward to hearing your thoughts in the future. Thanks again!

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
Community Expert ,
Dec 07, 2023 Dec 07, 2023

Copy link to clipboard

Copied

One thing I noticed is that you have some easing on the frequency slider keyframes, so the linear keframe integration method isn't going to work. Instead you could switch to the frame-by-frame brute force method, which would look like this:

freq = (thisComp.layer("wiggle_control").effect("wiggleSpeed")("Slider"));
amp = (thisComp.layer("wiggle_control").effect("wiggleSize")("Slider"));
accum = 0;
for (i = timeToFrames(inPoint); i <= timeToFrames(time); i++){
  accum += freq.valueAtTime(framesToTime(i));
}
seedRandom(thisComp.layer("wiggle_control").effect("seedAdd")("Slider") + index);
wiggle(1,amp,1,.5,accum*thisComp.frameDuration)

Try that and see what you think. Even with that change, once you get the frequency up to a significant fraction of the frame rate, it's going to seem very chaotic and random anyway.

 

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
Community Beginner ,
Dec 08, 2023 Dec 08, 2023

Copy link to clipboard

Copied

AWESOME!!!! That did it! Works like a charm!

Thank you so much for your help on this! You are awesome.

 

(For what it's worth, I guess I gave you a later version of the test project where I tried to mellow out the "hyper-wiggle" by smoothing out the keys a bit. The issue was still there with linear keys. That is actually what I started out with.)

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
Community Expert ,
Dec 08, 2023 Dec 08, 2023

Copy link to clipboard

Copied

OK, I think I found the original problem. You started with the expression based on keyframes, but you linked it to an intermediate slide that has no keyframes. So if you replace the first line with this:

freq = comp("main_comp").layer("row_1_comp_color").effect("BaseWiggleSpeed")("Slider");

so that it links directly to the slider with the keyframes, I think it will work as expected (although it will ignore any easing applied to the keyframes).

 

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
New Here ,
Apr 05, 2024 Apr 05, 2024

Copy link to clipboard

Copied

LATEST

Dan, I first and foremost wanted to say thank you for all your wisdom and insights. I actually used you code above in a 5 minute long composition and was having a really hard time rendering it (From what I gathered, time-based calculations like timesToFrames and framesToTime). In my search for an alternative solution I came across another post by none other than you in 2010!! This one uses if statement and it rendered like a dream!! I wanted to share it here incase other stumble across this post like I did.


https://creativecow.net/forums/thread/progressive-smooth-wiggle-frequency-change/

 

Much respect,

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