Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects moving wings through entire range of motion, but at random intervals.

  • moving wings through entire range of motion, but at random intervals.

    Posted by Scott G on October 30, 2006 at 11:04 am

    hey guys,

    trying to create a more realistic butterfly.

    say i have a retarded insect that can’t fly properly. when it flaps, its wings move through the full range of motion each time. BUT i want the flaps to occur spasmodically…

    if i use
    t=Math.sin(time*thisComp.layer(“Null 1”).effect(“Slider Control”)(“Slider”));
    ease(t, -1, 1, 17, 149)

    using the slider control with a wiggle on it as a multiplier for the value being passed to the sine function (to control the speed of the “wave motion”), i get something close to what i’m after, but not quite. the sine/cos functions are too hard for me to control in this scenario… even when using small wiggles the rate of flapping changes from very slow to extremely fast.

    when you watch a butterfly, each flap of the wing takes a certain amount of time… but these flaps don’t occur with any rhythm. this is the kind of effect i’m trying to achieve. i could keyframe it, but a minute’s worth is going to get tedious.

    any suggestions from scripting gurus out there? i’m not so sure the interpolation method is the way to go…

    thanks,
    scott.

    Scott G replied 19 years, 6 months ago 2 Members · 3 Replies
  • 3 Replies
  • Scott G

    October 30, 2006 at 11:28 am

    alternatively tried this expression:

    freq = thisComp.layer(“Null 1”).effect(“Slider Control”)(“Slider”);
    amplitude = 50;
    t = time
    ff = amplitude*Math.sin(freq*t*2*Math.PI)
    ease(ff, -50, 50, 17, 149)

    which is essentially the pendulum expression with a wiggle on the frequency (speed) of the swinging pendulum.

    again, i feel the lack of control. not sure how to achieve what i’m after, realistic “random” flapping of butterfly wings.

    i think the problem is that there is no pause between flaps… flaps are either slow or fast, but are continuous, whereas a butterfly the flap motion is always the same speed, it just occurs spasmodically.

    is there a way to time remap a layer so it will play a certain section of time (the flap) at random?

  • Mike Clasby

    October 30, 2006 at 11:18 pm

    This works pretty good. Animate one wing and use an expression that makes the animation run at every marker.

    If you animate one wing with keyframes, starting at time 0, one flap down and back, 3 keyframes (I use 10 and 149 degress and make them easy ease since that’s how you did the linear interpolation in your example). Then you add this expression to the rotation:

    n = 0;

    if (marker.numKeys > 0){

    n = marker.nearestKey(time).index;

    if (marker.key(n).time > time){

    n–;

    }

    }

    if (n > 0) t = time – marker.key(n).time else t =0;

    valueAtTime(t);

    Now the animation is triggered by every marker you place on the layer, so you have complete control over the pauses. Start dropping markers.

    You can animate the other wing by dupping the layer, then pickwhipping it’s rotation to the roation of that first wing then putting a minus sign in front of it, getting something like this:

    -thisComp.layer(“r wing”).rotationX

    Now the wings flap together at every marker on that first wing layer. You can render and loop the comp for longer animations.

    This is from a Dan Post.

  • Scott G

    October 30, 2006 at 11:40 pm

    thanks yikes mikes! that works pretty well. i haven’t come across that dan expression before, must have been a post without the keywords i was searching for…

    my only comment with that would be that instead of controlling the random intervals with an expression is that if i want to change the animation, i have to move a million markers. perhaps i could change the expression to run off a random number rather than a marker? ie, if a random number > 5 then play the keyframes, if the random number < 5 then don't... i'm not sure how much control this would give me, but it may be worth a shot... thanks again! scott.

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