Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Tween animation with layer markers and ease expression and no time remapping

  • Tween animation with layer markers and ease expression and no time remapping

    Posted by Stuart Simpson on January 11, 2014 at 5:27 pm

    Hi guys,

    This is a bit out of my comfort zone and I’ m hoping smarter people than myself can figure this out!

    I’m trying to control position values without using time remapping or copying and pasting keyframes, using layer markers to define which value is referenced and at which point. (It’s a long, non-looping animation and this expression is applied to a lot of layers, so if it works it will save a lot of copying and pasting key frames).

    So for example at frame 10 I might want position value A, then frame 50 position Value D then at frame 60 position value B, and to tween between those values directly (rather than time remap between them which would play the in between values?).

    I hope that makes sense! I’ve attached the code I have so far which is pasted on the attribute to animate (in this case x,y,z position). That attribute has several key frames marked so position A at frame 1, position B at frame 2 etc. I then use a reference layer onto which I just place layer markers with the relevant letter in the comments section. The layer marker then informs which keyframe is required and when at the animation.

    So far it kind of works but just switches to the position when it hits the marker as opposed to tweeting between the values….

    I even dreamed about this problem last night so any help to put me out of my misery much appreciated!

    Stu

    m = thisComp.layer("reference").marker;

    // set the previous and next marker key values

    Keystart = 0;
    if (m.numKeys > 0)
    { Keystart = m.nearestKey(time).index;
    if (m.key(Keystart).time > time) Keystart--;
    }
    Vstart = REST;
    if (Keystart > 0)
    { Vstart = eval(m.key(Keystart).comment);
    }

    Keyend = Keystart+1;
    if (Keyend > m.numKeys)
    {Keyend = Keystart;
    }
    Vend = REST;
    if (Keyend > 1)
    { Vend =eval( m.key(Keyend).comment);
    }

    // set the previous and next marker key time

    Vstime = time;
    if (Keystart > 0)
    { Vstime = m.key(Keystart).time;
    }

    Vetime = time;
    if (Keyend > 1)
    { Vetime = m.key(Keystart).time;
    }

    // finally the ease expression

    ease(time, Vstime, Vetime, Vstart, Vend)

    Stuart Simpson replied 12 years, 5 months ago 1 Member · 1 Reply
  • 1 Reply
  • Stuart Simpson

    January 11, 2014 at 5:34 pm

    Wow scratch that. Copying and pasting the expression noticed the 1 typo…. Couldn’t see the wood for the trees as they say! Sorted…

    🙂

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