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

Scale down expresion with animation

Community Beginner ,
Apr 04, 2020 Apr 04, 2020

Copy link to clipboard

Copied

Hey, this is my second post. So i have made this far. I want to make a comparison. I have a problem,

Right now it just down scale instantly.  i want when it scale down it have a shrink animation maybe about 2 second.

Here's the video (i speed up the video 250%): 

https://youtu.be/3vph9YaWa4A

 

Here's my timeline:

1586068787999.jpg

 

Here's the code:

//layer 1
timeToStart = 6; //animation started
timeToStop = 1000; //to prevent it go back to the original size

if ((time > timeToStart) && (time < timeToStop))//starting expresion
{
pNext=thisComp.layer("Perbandingan 2"); //follow size of next shape
pScale=pNext.transform.scale[0];
pOut=linear(value[0],0,pScale)*14/20; //size comparison
[pOut,pOut]
}
else
{
  value;
}

// layer 2
timeToStart = 12; //animation started
timeToStop = 1000; to prevent it go back to the original size

if ((time > timeToStart) && (time < timeToStop)) //starting expresion
{
pNext=thisComp.layer("Perbandingan 3"); //follow size of next shape
pScale=pNext.transform.scale[0];
 
pOut=linear(value[0],0,pScale)*20/35; //size comparison

[pOut,pOut]
}
else
{
  value;

I will very open if i can change the code, to make it clear. I want layer 1 shrink start from 6s to 8s not just instandly scale down.

 

Thank you

TOPICS
Expressions , Scripting

Views

660

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 05, 2020 Apr 05, 2020

You said you know a bit about coding but your expressions make no sense at all and you have to write a new one for every layer. 

 

If I follow your logic correctly the top layer would be at 100% scale when it becomes visible no matter what the value is in that graphic.

When the next graphic appears it has a value inside. That graphic is used as a multiplier to scale the previous graphic. Each additional graphic uses the new multiplier so each preceding graphic gets smaller based on the value of

...

Votes

Translate

Translate
Community Expert ,
Apr 05, 2020 Apr 05, 2020

Copy link to clipboard

Copied

The screenshot just tells me you have 5 layers that have a layer color of brown.  I have no idea what is going on in the comp. Please don't post screenshots without selecting the layer you are having problems with and pressing the U key twice to show us what you have modified on the layers.

 

Where did you get those expressions?  They don't make much sense, especially if the in point of your layers are staggered. If you want to scale the layer below down by a certain percentage when the new layer starts you should be referencing the inPoint of the layer. If you don't want the scaling to cascade then you should be using index - 1 instead of the layer name. 

 

This expression will scale the layer below down from the layer's original scale to half the original scale over 2 seconds when the layer above starts. The layer will then remain at 50% until it ends.

 

 

strt = thisComp.layer(index - 1).inPoint;
t = time - strt;
tMin = 0;
tMax = 1;
if (time < strt)
    v = value;
else
    v = ease(t, tMin, tMax, value, value/2);

 

 

You can class up the animation by adding this expression to opacity so the new layers fade in:

 

 

t = time - inPoint;
tMin = 0;
tMax = .5; // fade time in seconds
linear(t, tMin, tMax, 0, 100)

 

 

If that doesn't solve your problem let us know exactly what you are trying to do and post a screenshot that shows what you have done to the layers like this:

Screenshot_2020-04-05 00.57.42_DUUHcV.png

 

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 05, 2020 Apr 05, 2020

Copy link to clipboard

Copied

thank you for your response, Actually i just mix and match all expresion that i find that i think can what i want to happen just with logic, because i know a bit about coding.

 

1. the youtube video that i share, is what i want to be. but with animation

2. okay i will start from the begining i want make a comparison video with real ratio

-when the 1st layer appear value 14

the ratio is only (14/14)*100 mean 100% of the scale original scale

 

-when the 2nd layer appear value 20

the 2nd still 100% original

the ratio of the 1st layer would be (14/20)*100 original scale

 

 

-when the 3rd layer appear value 35

the 3rd still 100% original

the ratio of the 2nd layer would be (20/35)*100 original scale

the ratio of the the 1st layer would be

1. (14/35)*100 original scale OR

2. still 14/20 from 2nd layer but it follow the 2nd layer shrink. it means it still (14/20) from the 2nd layer size (20/35)*100 original scale (i love this option more, because i just need to code it once)

and so on

 

i have over 30 layer. so i want it to shirnk automaticaly

1 have more than 30 layer.

 

The past layer alwasy become smaller based on the new layer appearence.

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
LEGEND ,
Apr 05, 2020 Apr 05, 2020

Copy link to clipboard

Copied

To be honest I still fail to see why you're so obsessed about using expressions for such basic animations. You are making this way too complicated. You could have hand-animated this in an hour a week ago when you posted your first question. Just sayin'...

 

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 05, 2020 Apr 05, 2020

Copy link to clipboard

Copied

Because i want to make a bunch of video like that, so i want to made it automated by itself. So i dont need to keyframe it 1 by 1 every time i make a new one.

 

I think it only take 2 hours to keyframe it, but i need to keyframe it manualy again for the next video and so on. 

 

I just want to make it automaticaly. So change the value thats all what i nedd

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 05, 2020 Apr 05, 2020

Copy link to clipboard

Copied

You said you know a bit about coding but your expressions make no sense at all and you have to write a new one for every layer. 

 

If I follow your logic correctly the top layer would be at 100% scale when it becomes visible no matter what the value is in that graphic.

When the next graphic appears it has a value inside. That graphic is used as a multiplier to scale the previous graphic. Each additional graphic uses the new multiplier so each preceding graphic gets smaller based on the value of the preceding graphic. 

 

Here are your graphics in order of appearance from the sample video:

1: Value = 14  

2: Value = 20

3: Value = 35

4: Value =  200

5: Value = 1200

6: Value = 58.400 or is that 58,400

7: Value = 257.000 or is that 257,000'

 

As each layer appears you want to take the scale from the previous layer so when layer 2 appears the scale of layer 1 becomes the ratio between layers 1 and 2. From the values above Layer 2 would be 100% and layer 1 would change to 14/20 or 70%.  

Let's take a look at layers 2 and 3 so the math is 20/35 or 55.6%

Now let's look at layers 3 and 4 so the math is  35/200 or 17%.  

 

Without the scale of one layer effecting the other, if the layers were 1000 pixels across layer 1 would be 700, layer 2 would be 550, and layer 3 would be 17 pixels. Pretty small. If you then divided the new scale by the scale of the layer on top that would make each new layer shrink proportionally. 

 

Let's say you put that in an expression that looked like this:

 

ref = thisComp.layer(index - 1);
strt = ref.inPoint;
t = time - strt;
tMin = 0;
tMax = .5;
value1 = 100;
value2 = name/ref.name * 100;
if (time < strt)
	v = 100;
else
    v = easeIn(t, tMin, tMax, value1, value2);
ref.scale[0]/100 * [v, v]

 

This uses layer names for the values. Everything works perfectly. There is a nice 1/2 second scale down and as each new layer is added everything works just fine and you get smaller and smaller layers approaching but never reaching 0%. 

 

The whole thing falls apart if you make the value of a top layer smaller than the one below. Change layer 3 to 5 and layer 2 will grow before it shrinks. That's no problem when the numbers are small but what would happen to layer 1 if layer 2 was 200 and layer 3 was 2? 

The expression above works just fine if the layer names are the values you want and the number change between layers is relatively small. For larger numbers, you could add a slider control to use as a multiplier. 

 

If I had dozens of these to do then I would set up a JSON file that would populate text layers with the values I needed and each of the graphics would be parented to the text layers so they would scale up and down as needed but you could still easily control the position.  Here's the expression using a text layer's value:

 

ref = thisComp.layer(index - 1);
strt = ref.inPoint;
t = time - strt;
tMin = 0;
tMax = .5;
value1 = 100;
value2 = text.sourceText.value/ref.text.sourceText.value * 100;
if (time < strt)
	v = 100;
else
    v = easeIn(t, tMin, tMax, value1, value2);
ref.scale[0]/100 * [v, v]

 

If you used index -2  you could put the text layer above the graphic and get a comp that looks like this:

Screenshot_2020-04-05 14.30.21_RQJOUg.png

Here's the project file:

https://www.dropbox.com/s/4n4bamdmnmddj8a/scale%20and%20fade%20numbers.aep?dl=0

 

 

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 11, 2020 Apr 11, 2020

Copy link to clipboard

Copied

LATEST

Thanks!!! it works very well for me, Thank you for helping!!

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