Perfectly Looped Wiggle in After Effects – Floating Camera Effect

Screen Shot 2016-07-28 at 5.25.32 pm
This creates a wiggle that loops based on the duration of the composition.

Works great when teamed up with Andrew Kramer’s free plugin, Sure Target

Apply this to the orientation or individual X & Y rotation property of a camera for a bit of random handheld motion.

nb: Although its not a perfect solution to create a handheld look, it is a quick and easy way to get some more natural float in your camera moves.

I used this script for a job that needed a camera to fly through a bunch of images in 2.5 d space & had to be perfectly looped.

Original script is from the master of expressions, Dan Ebberts over at Motionscript.com
The extra bit’s I’ve added to make it loop to comp duration are highlighted in orange.

Perfectly Looped Wiggle Expression 


 //CAMERA FLOAT

// This locks the random seed rather than base it on the layer index number  
 seedRandom(12345)   
   
 // Adjust frequency & amplitude here  
 freq = .1;  
 amp = 1.5;  
   
 // Set loop time to duration of the composition - nb can be set to fixed value, eg: "3.0" for 3 secs  
 loopTime = thisComp.duration;  
   
 t = time % loopTime;  
 wiggle1 = wiggle(freq, amp, 2, 0.4, t);  
 wiggle2 = wiggle(freq, amp, 2, 0.4, t - loopTime);  
   
 // Adding 'value' lets you fine tune the original property the wiggle is applied to (eg rotation)  
 linear(t, 0, loopTime, wiggle1, wiggle2)+value;  

 

Further Reading

For more in depth look at the wiggle expression and how powerful it is over in this tutorial over on Mattrunks’ blog.

He shows you how to get a fixed random expression and talks about some cool nerdy wiggly stuff like octavesamplitude & time multipliers. He explains why we have 5 numbers in the wiggle expression instead of the usual 2.

Credit: original expression from Dan Ebberts at Motionscript.com