• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

always moving a null toward a point (simulating gravity)

New Here ,
Mar 12, 2018 Mar 12, 2018

Copy link to clipboard

Copied

Basically I want to move a null up and down, but I always want it to try and return to the home position between two keyframes.

I know I could just set key frames like this.

Home .... PosA ..... Home .... PosB .... Home

but I would have to determine the correct location to put the in between  "home" keyframes for every time I want this to happen.

it would be way easier to just make a keyframe of each location and have after effects always trying to put the object back where it came from.

I only need to work in 2D, fact I really only need to work with the Y axis.

Any help would be great,

Thanks,

Chris

TOPICS
Expressions

Views

329

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 13, 2018 Mar 13, 2018

Copy link to clipboard

Copied

LATEST

it would be way easier to just make a keyframe of each location and have after effects always trying to put the object back where it came from.

Would it? Unless you do it for hundreds of keyframes, cobbling together the expression would take longer than just hand-animating it. The rest doesn't matter. Whether it's 2D or 3D or just 1D - you still need to calculate the timing and positions. That's as trivial as running through the same interpolator as often as needed for each axis. The basic drill is to find out between which keyframes you are using nearestKey(), calculate the actual duration and then feed that into a linear() interpolator to blend between the positions, where the driver is something like Math.pow(time,2), i.e. a square falloff as gravity would do. And here comes the stinker: Since AE is not able to store persistent variables for expressions and you thus never know where the object is stuck, it would be one big hog of a loop to calculate this over and over.

You are also not making any determination how the motion force to counteract the gravity is actually applied. Is it some imaginary "force" impulse? A fake moving into the position with a fixed speed or easing duration? Does the object need to respond to other effects like sideways acceleration forces? Need the curves to look "physical" or can the just be linear paths? You see, it's much more complicated. A simple gravity bounce entirely based on an expression would be easy enough, but combining physics with keyframe control is a whole different one. If you want an idea what you would be getting into, study the "Trigger animation with markers" and "Elastic connection" examples on Dan Ebberts' page:

Dan Ebberts's Expressioneering Design Guide

So for what it's worth, if you can do it by hand, do it by hand. Otherwise we're talking some serious code mangling.

Mylenium

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines