ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Control the size of one keyframe.

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Pavel Kaprykov
Control the size of one keyframe.
on Feb 5, 2014 at 11:21:59 am

Hello. I have a shape. Shape has a scale animation (0-100%). I created an Adjustment layer (Shapes_Control) and added the "Slider control". I wanna bind the 2nd keyframe to the "Slider Control". Shape has animation only X axis. Anyone can help me with an expression?

I'm not a native English speaker, so excuse me if I don't clearly explained.


Return to posts index

Matthew Talesfore
Re: Control the size of one keyframe.
on Feb 5, 2014 at 11:57:44 pm

I think I understand...

Start with your "slider" on a 'Null layer'.

Then I would attach the following expression to the scale of your circle layer.

trans = thisComp.layer("Null 1").effect("Slider Control")("Slider")+transform.scale[1];
[transform.scale[0], trans]


-Matt


Return to posts index

Pavel Kaprykov
Re: Control the size of one keyframe.
on Feb 6, 2014 at 7:08:37 am

It's not quite what I need.



So, I have animation. Left to right. 1st keyframe: x:0, y:100. 2nd keyframe: x:100, y:100. Animation X-axis only.
I need to bind the second keyframe to the slider control. For exemple, I put a value of 300 in the slider.
Animation should be:
1st keyframe: x:0, y:100. 2nd keyframe: x:300, y:100.
I tried your expression, but I didn't succeed :(


Return to posts index


Dan Ebberts
Re: Control the size of one keyframe.
on Feb 6, 2014 at 2:40:58 pm

Something more like this, I think:

x2 = thisComp.layer("Null 1").effect("Slider Control")("Slider");
x = linear(time,key(1).time,key(2).time,key(1).value[0],x2);
[x,value[1]]


Dan



Return to posts index

Pavel Kaprykov
Re: Control the size of one keyframe.
on Feb 6, 2014 at 2:58:44 pm

Yes, this is what I need. Perfectly works. Thank you so much.


Return to posts index

Pavel Kaprykov
Re: Control the size of one keyframe.
on Feb 7, 2014 at 1:34:58 pm

Hello again. I still have a few questions. Dan, your expression perfectly works. I need an expression for this scheme:

1st keyframe: x:0, y:100,
2nd keyframe: x:100, y:100,
3rd keyframe: x:100, y:100,
4th keyframe: x:0, y:100.
So, this is fade in and fade out animation. I need to bind the second and third keyframes.

Also, I have a shape that has this animation:
1st keyframe: x:20, y:0,
2nd keyframe: x:20, y:100,
3rd keyframe: x:20, y:100,
4th keyframe: x:100, y:100.
5th keyframe: X:0, y:100.
I need to bind the 3rd and 4th keyframes.
So, please explain to me how to change the expression.

And the last. If a shape has no animation, but I wanna control a size using a slider. How can I do this? Thanks.


Return to posts index


Dan Ebberts
Re: Control the size of one keyframe.
on Feb 7, 2014 at 5:48:21 pm

> I need to bind the second and third keyframes.

bind?



Return to posts index

Pavel Kaprykov
Re: Control the size of one keyframe.
on Feb 7, 2014 at 6:13:51 pm

Yes. I need to bind the 2nd and 3rd keyframes to a slider control :) Your expression for the binding of the second keyframe works, but I can't edit it. Explain to me how to do it, please :)


Return to posts index


Dan Ebberts
Re: Control the size of one keyframe.
on Feb 7, 2014 at 6:55:11 pm

That would look like this:

sVal = thisComp.layer("Null 1").effect("Slider Control")("Slider");

if (time < key(2).time)
x = linear(time,key(1).time,key(2).time,key(1).value[0],sVal)
else if (time < key(3).time)
x = sVal
else
x = linear(time,key(3).time,key(4).time,sVal,key(4).value[0]);
[x,value[1]]


Dan



Return to posts index

Braian Dovidenko
Re: Control the size of one keyframe.
on Aug 10, 2018 at 4:12:56 pm

Hi Dan, you are our guru, thank you.

I wanted to consult you:
I want to be able to modify with a slider controller the size of X and Y separately. But I have an animation made in X.



I hope you have explained me well.

Thanks you!

Braian

x2 = thisComp.layer("Nulo 8").effect("ancho tweet")("Deslizador");
x = linear(time,key(1).time,key(2).time,key(1).value[0],x2);
[x,value[1]]




Return to posts index

Dan Ebberts
Re: Control the size of one keyframe.
on Aug 10, 2018 at 4:58:01 pm

I'm just guessing:

x2 = thisComp.layer("Nulo 8").effect("ancho tweet")("Deslizador");
y2 = thisComp.layer("Nulo 8").effect("alto tweet")("Deslizador");
x = linear(time,key(1).time,key(2).time,key(1).value[0],x2);
y = linear(time,key(1).time,key(2).time,key(1).value[1],y2);
[x,y]


Dan



Return to posts index

John Wolf
Re: Control the size of one keyframe.
on Feb 10, 2017 at 3:37:16 pm

Hi,

this is perfect:
x2 = thisComp.layer("Null 1").effect("Slider Control")("Slider");
x = linear(time,key(1).time,key(2).time,key(1).value[0],x2);
[x,value[1]]

but I need use Point Control, can you edit expresions for this? Thank you very much.

John


Return to posts index

Alexandros Yennaris
Re: Control the size of one keyframe.
on Dec 11, 2018 at 5:16:32 pm

Hi Dan.. Thank you for being awesome

How would i add easing to this?


Return to posts index

Dan Ebberts
Re: Control the size of one keyframe.
on Dec 11, 2018 at 5:29:20 pm

Just switch linear() to ease() or easeIn() or easeOut().


Dan



Return to posts index

Alexandros Yennaris
Re: Control the size of one keyframe.
on Dec 11, 2018 at 5:40:07 pm

Quick response.. thanks.. Basically i have some custom ease.. I am attaching the file so you can understand what i am after.. If you delete the expression you will see the desired easing, what i am trying to do is to be able to control the box with the slider..
12940_lowerthird.aep.zip


Return to posts index

Dan Ebberts
Re: Control the size of one keyframe.
on Dec 11, 2018 at 6:20:18 pm

In your case, I think this is all you need:

x2 = thisComp.layer("Control").effect("Slider Control")("Slider");
x = value[0]*x2/key(2).value[0];
[x,value[1]]


Dan



Return to posts index

Alexandros Yennaris
Re: Control the size of one keyframe.
on Dec 11, 2018 at 6:37:34 pm

I bow before you.. You are a GOD..

Thank you so much


Return to posts index

Björn Sieck
Re: Control the size of one keyframe.
on Feb 16, 2019 at 11:44:38 pm

Hi Dan,
this is for the X - axis

x2 = thisComp.layer("Null 1").effect("Slider Control")("Slider");
x = linear(time,key(1).time,key(2).time,key(1).value[0],x2);
[x,value[1]]

and how does it work for the Y - axis? I tried to change X to Y and I also played with the values, but I only can control the X - axis.
I Have 2 keyframes on the Y - axis for Position.
I also tried to separate X and Y Position.

Thanks for a little help.
B.


Return to posts index

Dan Ebberts
Re: Control the size of one keyframe.
on Feb 16, 2019 at 11:51:06 pm

Like this I guess:

y2 = thisComp.layer("Null 1").effect("Slider Control")("Slider");
y = linear(time,key(1).time,key(2).time,key(1).value[1],y2);
[value[0],y]


Dan



Return to posts index

Björn Sieck
Re: Control the size of one keyframe.
on Feb 17, 2019 at 9:05:20 am

Thank you, that works.


Return to posts index

Björn Sieck
Re: Control the size of one keyframe.
on Feb 19, 2019 at 9:40:43 pm

Hello again,
I play around with the expressions here and I've got 2 problems I can't fix.

This expression I use to control the 2nd and 3rd keyframe together, but its linear and I like to use the custom ease that I create.

sVal = thisComp.layer("Control").effect("Text Position")("Slider");

if (time < key(2).time)
y = linear(time,key(1).time,key(2).time,key(1).value[0],sVal)
else if (time < key(3).time)
y = sVal
else
y = linear(time,key(3).time,key(4).time,sVal,key(4).value[0]);
[value[0],y+230]


This expression I use to set the start position of a beam that comes in from the right:

x1 = thisComp.layer("Control").effect("Beam Start Position")("Slider");
x = value[0]*x1/key(1).value[0];
[x,value[1]]

I also like to control the end position of the beam on the left side with the last keyframe number 6 (or a different keyframe) with it's own controller. Also with custom ease (I think that is line two in this expression). I tried to combine this two expressions but I don't know how. The other thing is, when I change the first keyframe with the slider, also the last keyframe (number 6) changes the position, but I don't want it in this way.

It would be nice to get some help. Thank you.


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2019 CreativeCOW.net All Rights Reserved
[TOP]