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

Wobbling image back and forth.

Explorer ,
Apr 27, 2023 Apr 27, 2023

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. 

TOPICS
Expressions

Views

423

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 2 Correct answers

Community Expert , Apr 28, 2023 Apr 28, 2023

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

...

Votes

Translate

Translate
Explorer , Apr 28, 2023 Apr 28, 2023

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. 

Votes

Translate

Translate
Community Expert ,
Apr 28, 2023 Apr 28, 2023

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.

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
Explorer ,
Apr 28, 2023 Apr 28, 2023

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. 

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
Explorer ,
Apr 28, 2023 Apr 28, 2023

Copy link to clipboard

Copied

Thank you 🙂

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
Explorer ,
Apr 28, 2023 Apr 28, 2023

Copy link to clipboard

Copied

LATEST

Thank you very much, works perfectly 🙂

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