An easy way to make items oscillate is to use the Sine expression. Sine is probably something you forgot about from a math class long ago, but using this expression can help you create efficient movements. The Sine expression provides a smoother and more predictable motion then, say, the Wiggle expression.

The expression is written as:

Math.sin()

Your input goes in the parenthesis, and the Sine of that number is the output. For math gurus, the input is thought of as a radian, or a way to measure angles. The output will always be a value between -1 and 1.

In this short video tutorial, we’ll oscillate position using an expression. We’ll create variable for the frequency and amplitude of the movement. Also, we’ll explore using time as a value.