Good Boy Ninja

Tools for Motion Designers

### Moving in a Circle

Apply this code to a Position property:

```
// properties you can easily change
var loopDuration = 5;
var circleRadius = 25;
var flip = false;
// move
var flipper = flip ? 1 : -1;
var waveLogic = time * 2 * Math.PI / loopDuration * flipper;
var x = Math.sin(waveLogic) * circleRadius;
var y = Math.cos(waveLogic) * circleRadius;
value + [x,y];
```

So what are we doing here?

We are using the power of sine waves and cosine waves to create a looping, back and forth motion for each dimension.

We then multiply the result by the desired circle radius and add them to the original pre-expression value.

Knowledge

BlogScripting & ExpressionsMentionsAffiliateLicenseDiscountsSupportPrivacy & Cookies PolicyFrom the Cheat Sheet

From the Blog

Scripting and Expressions Snippets