Copy link to clipboard
Copied
Hey guys, i'm looking for some help in animating an image of the inside of a train carriage so it slowly wobbles from left to right in a random manner. It would actually be back-and-forth via the z axis from the POV of the camera, which is facing the side window.
The simplest approach here would be to use a wiggle expression. If you hold down ALT and click on the train layer's position stopwatch and expression area opens and you can type:
wiggle(1,30)
This would move the whole layer once per second by up to 30 pixels from the original value. Increasing the 1 to 10, would see 10 changes per second etc...
You say you only want the movement on the Z position, so assuming you have a 3D layer set up, we can actually wiggle in one axis only with a slightly d
...Wiggle is also based on the index value of the layer. It's good practice to set a "seedRandom(##)" before the wiggle expression. This way if you like a certain wiggle pattern, it will not change when you move the layer up or down, or when you add new layers.
Copy link to clipboard
Copied
The simplest approach here would be to use a wiggle expression. If you hold down ALT and click on the train layer's position stopwatch and expression area opens and you can type:
wiggle(1,30)
This would move the whole layer once per second by up to 30 pixels from the original value. Increasing the 1 to 10, would see 10 changes per second etc...
You say you only want the movement on the Z position, so assuming you have a 3D layer set up, we can actually wiggle in one axis only with a slightly different expression:
var rocking = wiggle(1,30);
X = value[0];
Y = value[1];
Z = rocking[2];
[X,Y,Z]
Value is the original value, rocking is the wiggle amount. Wiggle is smart enough to know if it is wobbling in 1, 2 or 3 dimensions, so we use the [2] to only look at the Z axis.
Copy link to clipboard
Copied
Wiggle is also based on the index value of the layer. It's good practice to set a "seedRandom(##)" before the wiggle expression. This way if you like a certain wiggle pattern, it will not change when you move the layer up or down, or when you add new layers.
Copy link to clipboard
Copied
Thank you 🙂
Copy link to clipboard
Copied
Thank you very much, works perfectly 🙂