Highlighted

## 2 expressions in the one property

New Here ,
Oct 14, 2020

Copied

Hi. Simple animation with scale, 2 keyframes:

1st - 0%, 0%

2nd - 100%, 100%

I want to add bounce effect and control the keyframe values via point control. But for some reason the point control doesn't work.

Expressions I used:

if (numKeys > 1){
t1 = key(1).time;
t2 = key(2).time;
v1=effect("Scale IN")("Point");
v2=effect("Scale OUT")("Point");
linear(time, t1, t2, v1, v2);
}else value

amp = .06;// The higher the value, the greater the amplitude
freq = 2;// The higher the value, the higher the frequency
decay = 5;// The higher the value, the smaller the delay

n = 0;
if (numKeys > 0){
n = nearestKey(time).index;
if (key(n).time > time){
n--;
}
}
if (n == 0){
t = 0;
}else{
t = time - key(n).time;
}
if (n > 0){
v = velocityAtTime(key(n).time - thisComp.frameDuration/10);
value + v*amp*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t);
}else{
value;
}

TOPICS
Error or problem, Expressions, FAQ

Views

43

Likes

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

## 2 expressions in the one property

New Here ,
Oct 14, 2020

Copied

Hi. Simple animation with scale, 2 keyframes:

1st - 0%, 0%

2nd - 100%, 100%

I want to add bounce effect and control the keyframe values via point control. But for some reason the point control doesn't work.

Expressions I used:

if (numKeys > 1){
t1 = key(1).time;
t2 = key(2).time;
v1=effect("Scale IN")("Point");
v2=effect("Scale OUT")("Point");
linear(time, t1, t2, v1, v2);
}else value

amp = .06;// The higher the value, the greater the amplitude
freq = 2;// The higher the value, the higher the frequency
decay = 5;// The higher the value, the smaller the delay

n = 0;
if (numKeys > 0){
n = nearestKey(time).index;
if (key(n).time > time){
n--;
}
}
if (n == 0){
t = 0;
}else{
t = time - key(n).time;
}
if (n > 0){
v = velocityAtTime(key(n).time - thisComp.frameDuration/10);
value + v*amp*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t);
}else{
value;
}

TOPICS
Error or problem, Expressions, FAQ

Views

44

Likes

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Oct 14, 2020 0
2 Replies 2
Most Valuable Participant ,
Oct 14, 2020

Copied

You need to replace the "value" bits in the second expression with the results of your linear() function from the first expression. Define a custom variable and substitute it. You might want to actually read the help on expressions to get an understanding how they work, not just copy & paste code bits from the Internet...

Mylenium

Likes

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Oct 14, 2020 0
LATEST
New Here ,
Oct 14, 2020

Copied

Thanks a lot! I've changed the 2nd expression and it works. Awesome!

```if (numKeys > 1){
t1 = key(1).time;
t2 = key(2).time;
v1=thisComp.layer("Text").effect("Point Control")("Point");
v2=thisComp.layer("Text").effect("Point Control 2")("Point")
linear(time, t1, t2, v1, v2);
}else value

amp = .06;
freq = 2;
decay = 5;
val = linear(time, t1, t2, v1, v2);

n = 0;
if (numKeys > 0){
n = nearestKey(time).index;
if (key(n).time > time){
n--;
}
}
if (n == 0){
t = 0;
}else{
t = time - key(n).time;
}
if (n > 0){
v = velocityAtTime(key(n).time - thisComp.frameDuration/10);
val + v*amp*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t);
}else{
val;
}```

Likes

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Oct 14, 2020 0
Resources
Troubleshooting FAQs
After Effects Community Recap
Getting started with After Effects