Activity › Forums › Adobe After Effects Expressions › Sinc Math.Sin() with the Wave Warp Effect
-
Sinc Math.Sin() with the Wave Warp Effect
Posted by Andreas Woelfl on November 16, 2015 at 11:48 amHello everybody,
I am searching for a way to get an element move along a wave.
I have a light blue solid with a wave warp effect.

Now I added a round shapelayer which should move along the wave. I added the following expression:
amplitude = 150;
frequency = 3.5;
xPos = transform.position[0];
yPos = transform.position[1] + amplitude * Math.sin(frequency*time);
[xPos, yPos]
The amplitude is set igualy to the wave warp plugins property “wave hight”.
I was wondering how I could get the right frequence of the sine wave so the element moves with the same frequence as the wave.Kalleheikki Kannisto replied 10 years, 8 months ago 3 Members · 12 Replies -
12 Replies
-
Kalleheikki Kannisto
November 16, 2015 at 1:59 pmThe frequency is in relation to Wave Speed. For one full cycle (1.0 Wave Speed) it is 2*Math.PI. So for your 0.5 setting it is Math.PI.
(2*Math.PI is one rotation around a circle in radians.)
-
Andreas Woelfl
November 16, 2015 at 2:55 pmHey Kalle,
I changed the variation “frequency = Math.PI”. It still looks like the circle is not moving correctly with the wave and I am not only talking about shifted phases.
To find the right phase of the wave I tried the following expression on the phase-property of the wave warp effect:
phaseTrigger = thisComp.layer(“circle”).transform.position[0];
linear(phaseTrigger, 0, 1920, 0, 360)
Does that makes sense?
-
Kalleheikki Kannisto
November 16, 2015 at 3:58 pmMy approach was simplified in that the Wave Warp Phase was at 0 and the circle was in the horizontal center of the comp. If either one of those settings is changed, it no longer aligns. Do you have the circle moving around horizontally?
-
Andreas Woelfl
November 16, 2015 at 4:22 pmThe circle has the position [1275, 540] and is not movin horizontaly.
The idea is that at the beginning, the wave appears as a simple straight horizontal line (yPos = 540px) and on in the circle.
Now the wave begins to move from wave hight 0 to 150 (via keyframes) and with it the circle, staying at the same exact line.
-
Kalleheikki Kannisto
November 16, 2015 at 5:28 pmJust need to offset the Phase by about -35 degrees, no expression needed. Then link the amplitude to your wave height with pick whip.
Basically, if your horizontal position is something else than the center, you need an offset value for the Phase.
-
Andreas Woelfl
November 16, 2015 at 5:33 pmThe circle is still phase shifted.
How did you come up with the -35º? -
Kevin Camp
November 16, 2015 at 10:59 pmit should work as Kalle described, but the actual phase value is likely dependent on the comp size, so just scrub the phase value until the wave lines up with the center of the circle, and it should follow the wave after that.
Kevin Camp
Art Director
KCPQ, KZJO & KRCW -
Andreas Woelfl
November 17, 2015 at 7:28 amI really apreciate all the help although I am not able to get the result.
I uploaded the comp here wondering if you could indicate me what I am doing wrong:
9468_sinustest.aep.zipRegarding to the phase there is no formular to get to the exact degrees?
Something likecomp.width = 360*
onePixel = 360º/comp.width
layerPosition = layer.transform.position * onePixel ???THANKS A LOT!!!
-
Kalleheikki Kannisto
November 17, 2015 at 8:23 amMain problem was that your Wave Speed was set to 0.55, not 0.5, so it didn’t match to Math.PI frequency.
If you move to a spot where the waves are high and adjust the Phase one way of the other to the point where the ball will align to the wave, it will either work or will be exactly half a rotation off.
I’m sure there is some formula that can be worked out, but it is easier to just move the Phase.
Reply to this Discussion! Login or Sign Up
