FORUMS: list search recent posts

Progressive wiggle - still having issues! FAO Dan!

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Nico Jones
Progressive wiggle - still having issues! FAO Dan!
on Jul 13, 2010 at 11:07:13 am

Hi there,

I'm still having difficulty in getting a smooth move between wiggle frequency keyframes. I used to get a frantic wiggle between the keyframes when AE recalculated the location on each frame, and then Dan gave me this expression...




freq = thisComp.layer("Wiggle Control Sliders").effect("FREQUENCY")("Slider");
amp = thisComp.layer("Wiggle Control Sliders").effect("AMOUNT")("Slider");

if (freq.numKeys > 0){
accum = 0;
v0 = freq.valueAtTime(0);
t0 = 0;
i = 1;
while (i <= freq.numKeys){
t = freq.key(i).time;
if (t < time){
accum += (v0 + freq.key(i).value)*(t - t0)/2;
v0 = freq.key(i).value;
t0 = t;
if (i == freq.numKeys){
accum += (time - t0)*v0;
}
}else{
accum += (freq + v0)*(time - t0)/2;
break;
}
i++;
}
}else{
accum = freq*time;
}
wiggle(1,amp,1,.5,accum);






...which seemed to work at his end but not mine - I get a big movement jerk after the last keyframe. Here is a project file with the expression applied, and the problem frame marked. I'm working in CS3 if that makes a difference. Does this work with you Dan/anybody else? I really need to solve this problem if at all possible :-)

http://webfilemanager.co.uk/dsf.php?fileid=GVkRrPyu

Many thanks,

nico



Return to posts index

Filip Vandueren
Re: Progressive wiggle - still having issues! FAO Dan!
on Jul 13, 2010 at 3:46:27 pm

Both the code and your project work fine for me.



Return to posts index

Nico Jones
Re: Progressive wiggle - still having issues! FAO Dan!
on Jul 14, 2010 at 9:32:25 am

Ack. That's not good. Are you on CS5? CS4? Thanks for having a look!

Nico J BB


Return to posts index


Filip Vandueren
Re: Progressive wiggle - still having issues! FAO Dan!
on Jul 14, 2010 at 1:08:51 pm

Checked in CS4 it worked, just checked in CS3 it's broken.

However, this does seem to work, and is even more correct IMHO


freq = thisComp.layer("Wiggle Control Sliders").effect("FREQUENCY")("Slider");
amp = thisComp.layer("Wiggle Control Sliders").effect("AMOUNT")("Slider");

if (freq.numKeys > 0){
accum = 0;
for (t=0;t<=time;t+=thisComp.frameDuration) {
accum+=freq.valueAtTime(t)
}
accum*=thisComp.frameDuration;
}else{
accum = freq*time;
}

wiggle(1,amp,1,.5,accum);


I'm not sure why Dan chose to do a kind of linear interpolation between the keyframes himself (one reason would be because there are fewer calculations), because it doesn't take in account any seasing you may but on the keyframes of Slider Control.
The downside of my solution is it uses a lot more calculations (one per passed frame) whereas Dan's only uses one per passed keyframe, so this could get slow on very long compositions.

Also, I'm scratching my head why the original doesn't work in CS3 and does in later versions



Return to posts index

Dan Ebberts
Re: Progressive wiggle - still having issues! FAO Dan!
on Jul 14, 2010 at 6:01:04 pm

Here's a different approach that might work for you.

freq = thisComp.layer("Wiggle Control Sliders").effect("FREQUENCY")("Slider");
amp = thisComp.layer("Wiggle Control Sliders").effect("AMOUNT")("Slider");

if (freq.numKeys > 0){
if (time <= freq.key(1).time || time >= freq.key(freq.numKeys).time)
wiggle(freq,amp)
else{
n = freq.nearestKey(time).index;
if (freq.key(n).time > time) n--;
f1 = freq.key(n).value;
f2 = freq.key(n+1).value;
t1 = freq.key(n).time;
t2 = freq.key(n+1).time;
w1 = wiggle(f1,amp);
w2 = wiggle(f2,amp);
linear(time,t1,t2,w1,w2);
}
}else{
wiggle(freq,amp)
}


I had to do some HTML manipulation to get this code to post correctly - hopefully I got everything.

Dan



Return to posts index

Nico Jones
Re: Progressive wiggle - still having issues! FAO Dan!
on Jul 15, 2010 at 3:29:13 pm

Looks like that's done it! Thanks so much for sticking with it guys - it's a crucial part of a music vid I'm working on and it's really, really helped me out.

nj

Nico J BB


Return to posts index


Nico Jones
Sorry, one more thing!
on Jul 15, 2010 at 3:48:59 pm

How can I amend this expression so that I can apply it straight onto the position of a 3D object and have it only affect X+Y, not Z? I'm having weird issues when I try to split them...

freq = thisComp.layer("Wiggle Control Sliders").effect("FREQUENCY")("Slider");
amp = thisComp.layer("Wiggle Control Sliders").effect("AMOUNT")("Slider");

if (freq.numKeys > 0){
if (time <= freq.key(1).time || time >= freq.key(freq.numKeys).time)
wiggle(freq,amp)
else{
n = freq.nearestKey(time).index;
if (freq.key(n).time > time) n--;
f1 = freq.key(n).value;
f2 = freq.key(n+1).value;
t1 = freq.key(n).time;
t2 = freq.key(n+1).time;
w1 = wiggle(f1,amp);
w2 = wiggle(f2,amp);
linear(time,t1,t2,w1,w2);
}
}else{
wiggle(freq,amp)
}



Nico J BB


Return to posts index

Dan Ebberts
Re: Sorry, one more thing!
on Jul 15, 2010 at 4:18:21 pm

Like this:

freq = thisComp.layer("Wiggle Control Sliders").effect("FREQUENCY")("Slider");
amp = thisComp.layer("Wiggle Control Sliders").effect("AMOUNT")("Slider");

if (freq.numKeys > 0){
if (time <= freq.key(1).time || time >= freq.key(freq.numKeys).time)
wiggle(freq,amp)
else{
n = freq.nearestKey(time).index;
if (freq.key(n).time > time) n--;
f1 = freq.key(n).value;
f2 = freq.key(n+1).value;
t1 = freq.key(n).time;
t2 = freq.key(n+1).time;
w1 = wiggle(f1,amp);
w2 = wiggle(f2,amp);
w = linear(time,t1,t2,w1,w2);
[w[0],w[1],value[2]]
}
}else{
w = wiggle(freq,amp);
[w[0],w[1],value[2]]
}

Dan



Return to posts index

Nico Jones
Re: Sorry, one more thing!
on Jul 15, 2010 at 6:02:07 pm

Fan-flipping-tastic. Thanks!

Nico J BB


Return to posts index

Steve Roberts
Re: Sorry, one more thing!
on Dec 4, 2011 at 3:29:04 pm

Thanks, Filip and Dan. Your expressions helped me out on my current project.



Return to posts index

Jesse Jost
Re: Sorry, one more thing!
on Aug 1, 2012 at 10:50:28 pm

Hi Guys,

Trying to get this to work, and the previous project files are missing from the Download Link.

I am a little new to expressions, but have a basic knowledge. I can't seem to figure out where to paste the expression...Directly into the Position property? As well, how would I add my sliders, just the slider control effect?

If any one could apply this expression with sliders and upload a project file, I'm sure this would be the easiest way for me to investigate, rather than articulating back and forth on this board.

Thank you so much you guys, this community is a wealth of knowledge.

Cheers

Jesse


Return to posts index

Nico Jones
Re: Sorry, one more thing!
on Aug 2, 2012 at 12:30:47 pm

Ah it's no fun if you get the solution from a project file!

First make an adjustment layer called Wiggle Control Sliders, then add two sliders to it. Name them FREQUENCY and AMOUNT.

Then Paste the main expression directly into the camera POV property, or the positional property, or any other property.

Then set some keyframes on the sliders, sit back and enjoy the greatest expression ever revealed to me on Creative Cow.

Nico J


Return to posts index

Courtney Taniguchi
Re: Sorry, one more thing!
on Dec 16, 2014 at 5:25:35 pm

Hi, I tried doing this in the latest version of After Effects 2014 (December update). I got this message:

After Effects warning: property or method named 'freq' in Class 'global' is missing or does not exist. It may have been renamed, moved, deleted, or the name may have been mistyped. A property expression referencing it was disabled.

'Position' (line 4) of layer 4 ('name') in comp 'name'


I'm not the most expression savvy but I'm wondering if the new updates have changed expression properties?

Sincerely yours,

Wanting to wiggle


Return to posts index

Dan Ebberts
Re: Sorry, one more thing!
on Dec 16, 2014 at 5:31:12 pm

It sounds like the expression engine can't find the declaration for 'freq'. What's the full expression you're using?

Dan



Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2019 CreativeCOW.net All Rights Reserved
[TOP]