Answers.Body: <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>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-07-08T12:22:49.537Z
Answers.Text: Thank you so much.
Answers.UserDisplayName: Russian Blue
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-07-08T12:33:21.523Z
Answers.Text: 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/
Answers.UserDisplayName: tomh
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-07-08T09:09:42.087Z
Answers.LastActivityDate: 2022-07-08T09:09:42.087Z
Answers.UserDisplayName: tomh
Body: <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>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-07-06T16:51:15.277Z
Comments.Text: Can you add the expression itself, and maybe a full size screen shot too please? Hard to see what's going on
Comments.UserDisplayName: tomh
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-07-07T05:05:31.927Z
Comments.Text: Yes, as usual Like I add expressions. But this one is not working. I dnt understand why the GIF is so small. :(
Comments.UserDisplayName: Russian Blue
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-07-07T09:26:54.780Z
Comments.Text: Add the expressions as text into your answer, and add a single JPG or PNG screenshot (under 2MB)
Comments.UserDisplayName: tomh
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-07-07T10:11:09.317Z
Comments.Text: Done. Kindly check.
Comments.UserDisplayName: Russian Blue
Tags: <after-effects-expressions>
Title: Bounce effect is not working
UserDisplayName: Russian Blue
ThreadText: # 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.
  
  [![enter image description here](https://i.sstatic.net/WCyPT.gif)](https://i.sstatic.net/WCyPT.gif)
  
  ```
  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;
  }
  
  ```
  
  [![enter image description here](https://i.sstatic.net/eLYpY.jpg)](https://i.sstatic.net/eLYpY.jpg)
  
  **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](https://en.wikipedia.org/wiki/Amplitude) to above 1, ie greater than 100% of the original size.
  
  I think this is based on [Harry Frank's inertial bounce code](https://www.graymachine.com/top-5-effects-expressions).
  
  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:
  
  [![enter image description here](https://i.sstatic.net/wWmiL.gif)](https://i.sstatic.net/wWmiL.gif)
  
  > **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/  
  
  ---
  
  