Activity › Forums › Adobe After Effects Expressions › Animating shape size based on the value set with the Layer Slider
-
Animating shape size based on the value set with the Layer Slider
Posted by Dmitry Yershov on November 28, 2017 at 7:11 pmHi,
Is it possible to animate the shape like this, when the shape’s length value is defined by the Layer Slider? The idea is, when you change the Slider value, the animation adapts.
(animate it once, not like this gif on repeat :))
Dmitry Yershov replied 8 years, 5 months ago 2 Members · 9 Replies -
9 Replies
-
Demarc Johnson
November 29, 2017 at 1:15 pmI can help, but first I would need to know how you animated the circle shape because the method I used to animate the circle shape might be different from the way you do it, and that will determine how to connect the slider control to the animation.
For Expression Tutorials:
https://www.youtube.com/channel/UCe77szX2n1WSKsGs-2gmbDw -
Dmitry Yershov
November 29, 2017 at 3:55 pmSo this is not a circle, this is a rounded rectangle with fixed height and the width value is attached to a slider, as well as the X position is the Slider value divided by 2, so it stays in place and expands to the right. What I want to achieve is basically this animation and at the same time I still should be able to control the end width of the rectangle with the same slider. Fixed value for the beginning of the animation and Slider value for the end length. Does that make sense?
-
Demarc Johnson
November 29, 2017 at 8:06 pmThanks for subscribing. I think I might have a solution if I get what you saying. From what I gather from the second post is you want the length to be control by one slider. I was able to do so by using the slider with the size property and the anchor point.
In the anchor point...
transform.anchorPoint - effect("Slider Control")("Slider") / 2In the size property (inside content property and then inside rectangle path)...
content("Rectangle Path 1").size + effect("Slider Control")("Slider")For Expression Tutorials:
https://www.youtube.com/channel/UCe77szX2n1WSKsGs-2gmbDw -
Dmitry Yershov
November 29, 2017 at 10:43 pmHere’s a quick AE project I’ve created to hopefully better explain what I had in mind:
-
Demarc Johnson
November 30, 2017 at 1:12 amOkay, I think I have a full understanding of what you’re trying to do. In the Slider Options Animation set the slider to go from 0 to 100. 0 representing the minimum you want the shape to be and 100 being the max length. Don’t forget to change the first keyframe to 0 and the second to 100.
Sorry, if I had the older version of AE I would have sent the file back with this post.In the size property
var animate = thisComp.layer("Slider Options (Animation)").effect("Slider Control")("Slider");
var max = thisComp.layer("Slider Options").effect("Slider Control")("Slider"); //This is the slider that is going set the max range in the linear method.
var minMax = linear(animate, 0, 100, 146, max);
//With this linear method you are animating from the min to max range so if you change max length the animation will do the same
[minMax, 146]In the position property
var animate = thisComp.layer("Slider Options (Animation)").effect("Slider Control")("Slider") / 2;
var max = thisComp.layer("Slider Options").effect("Slider Control")("Slider");
var minMax = linear(animate, 0, 100, 146, max);
[minMax, 146]For Expression Tutorials:
https://www.youtube.com/channel/UCe77szX2n1WSKsGs-2gmbDw -
Dmitry Yershov
November 30, 2017 at 1:45 amI happen to have the latese After Effects as well, can you please send your project file after all? Thank you!
-
Demarc Johnson
November 30, 2017 at 2:32 amHere is the file…
11919_11916exampleconverted.zipFor Expression Tutorials:
https://www.youtube.com/channel/UCe77szX2n1WSKsGs-2gmbDw -
Dmitry Yershov
November 30, 2017 at 3:11 amThanks a lot man! This is exactly what I wanted. I wish I was as good with expressions as you are, so I could just solve problems like you did.
Reply to this Discussion! Login or Sign Up
