Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Animating butterflies

  • Kevin Camp

    July 6, 2021 at 6:04 pm

    Assuming you want the wings to flap, I’d start by using one of the flatter butterflies to make it easier to animate the wings. If the butterfly parts (wings and body) have not been separated into separate layers, I’d probably do that for one of the flatter butterflies in Photoshop and then bring that PSD into AE as a comp. You can make things a little easier if you turn the butterfly so that it points to the right edge of the PSD and then crop the file to the edges of the wings before you importing it into AE.

    Import the layered butterfly into AE as a comp with layer size retained, open the comp and make all of the layers 3D. For the wings, move the move the anchor points to the edge nearest the body. Then keyframe the y-rotation to go from 0 to about 90 upwards over a few frames, make those two keyframes easy-ease and then add this expression to make them flap:


    The wing should now flap up and down in a loop. Adjust the timing to the desired flap speed. and do the process to the other wing and enable motion blur for all of the layers.

    Bring that flapping butterfly comp into the main comp where it will form the logo/shape. Make it 3D and enable the Collapse Transformations switch. We’ll use a wiggle() expression to create the random movement, but to control the movement add a Slider expression control to the butterfly and then add this expression to the butterfly’s position:

    amp = effect("Slider Control")("Slider") ;
    wiggle(1, amp)

    Now keyframe the slider value to go from a high value (like 500) to a very low value, like 0 or 1. And enable the orientation to follow the motion by selecting the butterfly and choosing Layer > Transform > Auto Orient and click ‘Orient Along Path’

    The butterfly should now start off fluttering around the screen and then come to a landing in the original position. Adjust the slider values and timings as needed.

    Now you can duplicate that butterfly and position the duplicates to make the logo/shape when they come to the final position (when the slide is 0 or 1).

    To add a bit of randomness to the flapping (so they don’t all flap at the same time), select a butterfly and enable time-remapping and try this expression:

    flapDur = 5 ; // this is the number of frames that the wings flap, set as needed
    seedRandom( index, true ) ;
    value + random( flapDur * thisComp.frameDuration )

    Right-click the time-remap property and choose ‘copy expression only’, then choose the other butterflies and paste.

    All the butterflies should now flutter around and land at their original positions.

    You can vary the slider timings so they don’t all land at the same time. You can also keyframe the positions as needed, so you can have them start off-screen, then move on-screen and they wil still keep the random wiggle movement.

  • Eric Strand

    July 6, 2021 at 8:00 pm

    Kevin, thank you for the explanation and reply. My EP just asked about randomness for the flapping, you’re a mind-reader! Thanks

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy