Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions expression help with position movement0

  • expression help with position movement0

    Posted by Ischille on April 23, 2007 at 3:00 pm

    Hi Everyone.

    I’m working on a project where I need to blow the small stems off a dandelion. The stems are on individual layers. I’ve tried various expressions from a simple –

    thisComp.layer(“null push 1”).transform.position

    This works but the motion is not right as it follows directly the null without the random vibration and spin wind would put on light weight stems on a dandelion.

    Is there a expression I could add that would allow me to blow the stems off a dandelion where I could set the following parameters? –

    x and y motion
    random wiggle
    time delay

    Basically an expression that mimicks wind on an object.

    Thank you in advanced.

    Ian

    Colin Braley replied 19 years ago 3 Members · 3 Replies
  • 3 Replies
  • Dan Ebberts

    April 23, 2007 at 5:04 pm

    A dandelion seed simulation is an interesting idea. It’s not really random though. The position would respond to the wind which would vary somewhat, but the rotation would be a kind of spring/pendulum effect based on the acceleration imparted by the wind and gravity. Kind of like somebody hanging from a parachute. I don’t have a canned solution, but you’ve got me thinking….

    Dan

  • Ischille

    April 23, 2007 at 5:11 pm

    I was toying with an expression you wrote for leaves falling. I couldn’t get it to work for the dandelion stems. I couldn’t get the stems to animate across the screen on the x axis.

    To be honest, I’m quite new to expressions.

  • Colin Braley

    April 24, 2007 at 2:52 am

    Ive got some expressions for you that work okay, but not great. If I have some time tomorrow or the next day, I might tweak them to make it look better. These are a bit complicated and have alot of references to pick-whipped properties in the expressions, so if you want me to post the .aep file (After Effects 7) I can do that. Well anyway, here you go:

    try this one for position:
    //begin expression
    wind = thisComp.layer(“Controls”).effect(“wind”)(“Slider”);
    //you can keyframe the wind parameter, negative values
    //will make the petals blow in the opposite direction
    minMass = thisComp.layer(“Controls”).effect(“min_petal_mass”)(“Slider”);
    //don’t keyframe this, it is theminimum mass for each petal
    maxMass = thisComp.layer(“Controls”).effect(“max_petal_mass”)(“Slider”);
    //this is the maximum mass for each petal, dont keyframe me
    gravity = thisComp.layer(“Controls”).effect(“gravity”)(“Slider”);
    //this is the strength of the gravitational force on the petals
    //dont keyframe this
    minBlowAway = thisComp.layer(“Controls”).effect(“min_blow_away_time”)(“Slider”);
    //this value is the earliest time a petal can blow away
    //dont keyframe this
    maxBlowAway = thisComp.layer(“Controls”).effect(“max_blow_away_time”)(“Slider”);
    //this value is the latest time a petal can blow away
    //dont keyframe this
    //———

    //——————————————–
    seedRandom( index, true );
    mass = random( minMass, maxMass );
    blowAwayTime = random( minBlowAway, maxBlowAway);
    if( time < blowAwayTime){ value }else{ adjustedTime = time - blowAwayTime; accelY = gravity/mass; posX = position[0] + wind * adjustedTime; posY = position[1] + accelY * Math.pow(adjustedTime,2); [posX, posY] } //end expression then, try this one for rotation //begin expression //if you are going to add more petals, decrase the value of the variable gap //use the following formula for determining what gap should be // gap = 360/ numberOfPetals gap = 10; rotationTendency = 1; //make this higher, petals will spin faster wind = thisComp.layer("Controls").effect("wind")("Slider"); //---------------------- startRot = index * gap; totalRot = startRot; for(i = 0; i < framesToTime( time); i++) { totalRot += wind/rotationTendency; } totalRot //end expression Both of these expressions have some explanation of what each variable does. For these to work right, you will need a layer named "Controls" with a few sliders on it. These should be called wind, min_petal_mass, max_petal_mass, gravity, min_blow_away_time, max_blow_away_time and should have the values of about 3.75, 20, 25, 45, 2, and 5, respecttively. I wis I had more time to explain, but I have to go. ~Colim

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