<p>I think the reason your shape is growing too large is because you have set the <a href="https://en.wikipedia.org/wiki/Amplitude" rel="nofollow noreferrer">amplitude</a> to above 1, ie greater than 100% of the original size.</p>
<p>I think this is based on <a href="https://www.graymachine.com/top-5-effects-expressions" rel="nofollow noreferrer">Harry Frank's inertial bounce code</a>.</p>
<p>If you use his code, and his suggested values:</p>
<pre><code>amp = .1;
freq = 2.0;
decay = 2.0;
n = 0;
time_max = 4;
if (numKeys &gt; 0){
n = nearestKey(time).index;
if (key(n).time &gt; time){
n--;
}}
if (n == 0){ t = 0;
}else{
t = time - key(n).time;
}
if (n &gt; 0 &amp;&amp; t &lt; time_max){
v = velocityAtTime(key(n).time - thisComp.frameDuration/10);
value + v*amp*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t);
}else{value}
</code></pre>
<p>Applied to a scale control with two keyframes of 0% and 100%, you get this effect, which I think is what you're looking for:</p>
<p><a href="https://i.sstatic.net/wWmiL.gif" rel="nofollow noreferrer"><img src="https://i.sstatic.net/wWmiL.gif" alt="enter image description here" /></a></p>

CC BY-SA 4.0
2022-07-08T12:22:49.537Z
Thank you so much.
Russian Blue
CC BY-SA 4.0
2022-07-08T12:33:21.523Z
no worries. If you're after an easier way of doing this - Mograph Motion is a brilliantly useful set of motion tools, and their excite functions give you lots of control over this stuff.. Not free but worth every penny https://www.toolfarm.com/buy/mt-_mograph_motion/
tomh
CC BY-SA 4.0
2022-07-08T09:09:42.087Z
2022-07-08T09:09:42.087Z
tomh
<p>I have applied 'bounce effect' following the rules. The first keyframe of scale was 0 and the second one was 100. but the scale gets bigger after second keyframe, increase its size.</p>
<p>Why is this happening? please help.</p>
<p><a href="https://i.sstatic.net/WCyPT.gif" rel="nofollow noreferrer"><img src="https://i.sstatic.net/WCyPT.gif" alt="enter image description here" /></a></p>
<pre><code>Bounce expression-

amp =2;
freq = 2;
decay = 4;

n= 0;
if (numkeys &gt; O){
n = nearestKey(time).index;
if (key(n).time &gt; time){
n--;
}}
if (n == O{t = 0;
}else{
t= time - key(n).time;
}

if (n &gt; 0 &amp;&amp; t &lt; 1){
v = velocityAtTime(key(n).time - thisComp.frameDuration/10);
value + v*amp*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t);
}else{
Value;
}
</code></pre>
<p><a href="https://i.sstatic.net/eLYpY.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/eLYpY.jpg" alt="enter image description here" /></a></p>

CC BY-SA 4.0
2022-07-06T16:51:15.277Z
Can you add the expression itself, and maybe a full size screen shot too please? Hard to see what's going on
tomh
CC BY-SA 4.0
2022-07-07T05:05:31.927Z
Yes, as usual Like I add expressions. But this one is not working. I dnt understand why the GIF is so small. :(
Russian Blue
CC BY-SA 4.0
2022-07-07T09:26:54.780Z
Add the expressions as text into your answer, and add a single JPG or PNG screenshot (under 2MB)
tomh
CC BY-SA 4.0
2022-07-07T10:11:09.317Z
Done. Kindly check.
Russian Blue
<after-effects-expressions>
Bounce effect is not working
Russian Blue
# Bounce effect is not working

(Asked by: username_0 on 2022-07-06)

I have applied 'bounce effect' following the rules. The first keyframe of scale was 0 and the second one was 100. but the scale gets bigger after second keyframe, increase its size.
Why is this happening? please help.

Bounce expression-

amp =2;
freq = 2;
decay = 4;

n= 0;
if (numkeys > O){
n = nearestKey(time).index;
if (key(n).time > time){
n--;
}}
if (n == O{t = 0;
}else{
t= time - key(n).time;
}

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

**Tags:** after-effects-expressions

> **Comments:**
> **username_1**: Can you add the expression itself, and maybe a full size screen shot too please? Hard to see what's going on  
> **username_0**: Yes, as usual Like I add expressions. But this one is not working. I dnt understand why the GIF is so small. :(  
> **username_1**: Add the expressions as text into your answer, and add a single JPG or PNG screenshot (under 2MB)  
> **username_0**: Done. Kindly check.  

---

## 1 answers

### Answer by username_1 on 2022-07-08. Score: 1 | Accepted answer

I think the reason your shape is growing too large is because you have set the amplitude to above 1, ie greater than 100% of the original size.
I think this is based on Harry Frank's inertial bounce code.
If you use his code, and his suggested values:
amp = .1;
freq = 2.0;
decay = 2.0;
n = 0;
time_max = 4;
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 && t < time_max){
v = velocityAtTime(key(n).time - thisComp.frameDuration/10);
value + v*amp*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t);
}else{value}

Applied to a scale control with two keyframes of 0% and 100%, you get this effect, which I think is what you're looking for:

> **Comments:**
> **username_0**: Thank you so much.  
> **username_1**: no worries. If you're after an easier way of doing this - Mograph Motion is a brilliantly useful set of motion tools, and their excite functions give you lots of control over this stuff.. Not free but worth every penny https://www.toolfarm.com/buy/mt-_mograph_motion/  

---

