Activity › Forums › Adobe After Effects Expressions › 3d objects undulating as if floating in the ocean
-
3d objects undulating as if floating in the ocean
Posted by Robert Paynter on May 6, 2010 at 6:46 pmI have 15+ “postcards” in a comp. I would like them to undulate up and down as well as rotate As if they were floating in the ocean on the same body of wavy water.
Any help would be appreciated.
I found this
https://www.motionscript.com/expressions-lab-ae65/undulations.html
but it doesn’t seem to take into account X,Y and ZRobert Paynter replied 16 years ago 2 Members · 3 Replies -
3 Replies
-
Robert Paynter
May 6, 2010 at 8:59 pmok I think I got it. so I changed the position expression to move on the z and hooked up the values to sliders. I then used the roatation expression and hooked them up to the same sliders and added a damping slider.. it’s looking pretty good
position:
xAmp = thisComp.layer(“Null 10”).effect(“Amp”)(“Slider”); //height of undulations (pixels)
xFreq = thisComp.layer(“Null 10”).effect(“Freq”)(“Slider”); //undulations per second
xSpeed = thisComp.layer(“Null 10”).effect(“Speed”)(“Slider”); //speed of wave (pixels per second)wl = xSpeed/xFreq; //wavelength (pixels)
phaseOffset = ((position[0]%wl)/wl)*2*Math.PI;
z = xAmp*Math.sin(2*Math.PI*xFreq*time + phaseOffset);
value + [0,1,z]rotation:
xFreq = thisComp.layer(“Null 10”).effect(“Freq”)(“Slider”); //undulations per second
xSpeed = thisComp.layer(“Null 10”).effect(“Speed”)(“Slider”); //speed of wave (pixels per second)
damping = thisComp.layer(“Null 10”).effect(“Damp”)(“Slider”); //undulation damping factorwl = xSpeed/xFreq; //wavelength (pixels)
phaseOffset = ((position[0]%wl)/wl)*2*Math.PI;
theta = Math.atan(Math.cos(2*Math.PI*xFreq*time + phaseOffset));
radiansToDegrees(theta)/damping; -
Dan Ebberts
May 6, 2010 at 10:23 pmI think I’d try the noise() function for this. If you have your layers laid out in x and y, this should give you the undulation in z and otation in x and y:
// position
xyCompress = 500;
speedCompress = 1;
amplitude = 50;
x = value[0];
y = value[1];
z = amplitude*noise([x/xyCompress,y/xyCompress,time/speedCompress]);
[x,y,z]// x rotation
xyCompress = 500;
speedCompress = 1;
amplitude = 50;
x = transform.position[0];
y = transform.position[0];
z0 = amplitude*noise([x/xyCompress,(y-.1)/xyCompress,time/speedCompress]);
z1 = amplitude*noise([x/xyCompress,(y+.1)/xyCompress,time/speedCompress]);
radiansToDegrees(Math.atan2(z0-z1,.2))// y rotation
xyCompress = 500;
speedCompress = 1;
amplitude = 50;
x = transform.position[0];
y = transform.position[0];
z0 = amplitude*noise([(x-.1)/xyCompress,y/xyCompress,time/speedCompress]);
z1 = amplitude*noise([(x+.1)/xyCompress,y/xyCompress,time/speedCompress]);
radiansToDegrees(Math.atan2(z1-z0,.2))You’ll want to adjust the first three parameters to suit your needs (actually you should probably tie them to controls).
Dan
Reply to this Discussion! Login or Sign Up