Skip to main content
Peter J Kovacs
Inspiring
March 18, 2013
Question

How to create a simple bobbing up and down motion expression?

  • March 18, 2013
  • 5 replies
  • 94555 views

Hi, I have a 3D object that I want to continuously bob up and down but I'm having trouble finding an expression to do this.

I would use wiggle on the Z except wiggle creates random motion and I need consistant up and down oscillations.

It seems simple but I can't figure it out... any ideas? Thanks.

-Pete

5 replies

artichoked
Inspiring
February 3, 2022

If you get an error, try adding curly brackets to the if/else statement:

if (t < StartTime) {value;} else {(value + [x,0,0])}

New Participant
May 16, 2020

HOW CAN I STOP THIS?

Braniac
July 4, 2020

Stop or start the effect by controlling amp and freq with sliders then animate the sliders.

New Participant
August 31, 2018

Hi all,

The expression worked great. But i have no idea on if it is possible to decelerate the "bobbing/bopping" motion.

Do i need to adjust the value or frequency?

Thanks guys! x

New Participant
February 13, 2018

Hey guys, sorry to revive this but the expression is really great. I'm trying to use it for the z-axis and so far it worked the only thing I'm stuck with is how to create only positive values for the amplitude. Any idea on how to do this?

ericsten
Inspiring
March 16, 2018

Sorry for the late response.

One way to achieve this is by adding Math.abs() to your expression which will return the absolute values instead of true values (aka negative numbers get switched to positive).

Z=Math.abs(amp*Math.sin(time*freq*Math.PI*2));

- Eric

Dan Ebberts
Braniac
March 18, 2013

Try this:

amp = 100;

freq = 1;

y = amp*Math.sin(time*freq*Math.PI*2);

value + [0,y,0]

Dan

Peter J Kovacs
Inspiring
March 18, 2013

Wow Dan, that works perfectly... thanks for the help!

It would be cool if wiggle had an option to control the randomness so I can get the same results as your expression.

-Pete