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

keyframes control with layer markers

Community Beginner ,
Apr 09, 2015 Apr 09, 2015

Copy link to clipboard

Copied

Hello,

I have an animation of a line that has two sets of keyframes of two different properties in CS4.

Basically a line gets generated in the first phase then it gets cleared out in the second phase.

This is done using two slider controls that act on the horizontal size of two rectangles and using merge paths (using the second rectangle as a matte for the first to clear it out)

I've put two layer markers on my layer hoping to link the keyframes to each of them.

Then I have found this script on the web and I put it on the first property :

L= thisComp.layer("ShapeLayer");

n = 0;

if (L.marker.numKeys > 0){

n = L.marker.nearestKey(time).index;

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

n--;

}

}if (n == 0){

valueAtTime(0);

}else{

t = time - L.marker.key(n).time;

valueAtTime(t)

}

This indeed lets me move the whole animation with the layermarker (which is very good) but I can't find a way to link the second set of keyframes to do the output.

I will add a link with the project file: WeTransfer

Please help!

Thanks

TOPICS
Expressions

Views

4.5K

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

correct answers 1 Correct answer

Community Expert , Apr 10, 2015 Apr 10, 2015

I think this on your LenghtAnimate slider:

L= thisComp.layer("Line_Center_Reveal");

m = L.marker.key("In");

if (time < m.time){

  valueAtTime(0);

}else{

  t = time - m.time;

  valueAtTime(key(1).time + t);

}

and this one the OutAnimate slider:

L= thisComp.layer("Line_Center_Reveal");

m = L.marker.key("out");

if (time < m.time){

  valueAtTime(0);

}else{

  t = time - m.time;

  valueAtTime(key(1).time + t);

}

will do what you're looking for.

Dan

Votes

Translate

Translate
LEGEND ,
Apr 10, 2015 Apr 10, 2015

Copy link to clipboard

Copied

It works no different, but of course you will have to explicitly reference the markers by index or name instead of just using the closest one to your current time. Si instead of:

L.marker.nearestKey(time).index


You would use


L.marker(1)


and so on.


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
Community Beginner ,
Apr 10, 2015 Apr 10, 2015

Copy link to clipboard

Copied

First, thank you for taking the time to solve this.

I feel like a handicapped... and I am when it comes to scripting. (I'm not really a handicapped person (not that there's anything wrong with that))

It has been now over two hours of tweaking and replacing values...no go.

I can follow the logic behind the script - telling to use the index or the name of the marker instead of the nearest one but I'm a script retard.

So, like a child, I'm asking what does this do:

t = time - L.marker.key(n).time;  ?

and

should there be a dot between L.marker  and (1)  like this L.marker.(1)  ?

and there are many other questions (very stupid ones) that I will not mention here.

If you (me) don't have some basic knowledge about scripting, you (you) can give me everything word by word and I still wouldn't know how to assemble it in a script.

By now I think I've already made a fool of myself so the variable shame is not of the importance anymore.

I know...I shouldn't even be in this forum with my knowledge regarding the scripts in AE, but here I am.

I'm a motion graphic designer with over 15 years of experience with AE, and so far I've managed to elude the tricky part of learning scripting. (my bad)

If anybody has a question about motion graphics, or just graphics (ex. Oh my God, how did they do that in AfterEffects or Cinema 4D, Maya, Photoshop, Illustrator ?(or What do you think about this font, should I use it on my wedding invitation ?)) I will be glad to help!

Thank you everyone!

You are a great community!

exit.(stage(left))

}

P.S. (post.scriptum) I'm sorry if this turned into some kind of written stand up comedy but I didn't know how to approach this situation otherwise. I'm sorry about the retards too.(me included)

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
Community Expert ,
Apr 10, 2015 Apr 10, 2015

Copy link to clipboard

Copied

I think this on your LenghtAnimate slider:

L= thisComp.layer("Line_Center_Reveal");

m = L.marker.key("In");

if (time < m.time){

  valueAtTime(0);

}else{

  t = time - m.time;

  valueAtTime(key(1).time + t);

}

and this one the OutAnimate slider:

L= thisComp.layer("Line_Center_Reveal");

m = L.marker.key("out");

if (time < m.time){

  valueAtTime(0);

}else{

  t = time - m.time;

  valueAtTime(key(1).time + t);

}

will do what you're looking for.

Dan

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
Community Beginner ,
Apr 14, 2015 Apr 14, 2015

Copy link to clipboard

Copied

It works, it's alive!

Thank you!

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
Community Beginner ,
Apr 18, 2018 Apr 18, 2018

Copy link to clipboard

Copied

LATEST

Hate to revive this old thread, but here goes. 

How do you offset this by 10 frames?

I have other keyframes that need to wait 10 frames (post marker) before triggering.

Thanks Dan

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