Jump to content

GreenSock Docs


Included in GSAP core: No


GSAP always had the tried-and-true Bounce.easeOut, but there was no way to customize how "bouncy" it was, nor could you get a synchronized squash and stretch effect during the bounce because:

  • The "bounce" ease needs to stick to the ground momentarily at the point of the bounce while the squashing occurs. Bounce.easeOut offers no such customization.
  • There was no way to create the corresponding [synchronized] scaleX/scaleY ease for the squashing/stretching. CustomEase solves this now, but it'd still be very difficult to manually draw that ease with all the points lined up in the right spots to match up with the bounces.

With CustomBounce, you can set a few parameters and it'll create BOTH CustomEases for you (one for the bounce, and one [optionally] for the squash/stretch). Think of CustomBounce like a wrapper that creates a CustomEase under the hood based on the variables you pass in.

CustomBounce is a variation of CustomEase that let’s you set the bounce and (optionally) the squash and stretch.


  • strength (Number) - a number between 0 and 1 that determines how “bouncy” the ease is, so 0.9 will have a lot more bounces than 0.3. Default: 0.7
    endAtStart (Boolean) - if true, the ease will end back where it started, allowing you to get an effect like an object sitting on the ground, leaping into the air, and bouncing back down to a stop. Default: false

  • squash (Number) - controls how long the squash should last (the gap between bounces, when it appears “stuck”). Typically 2 is a good number, but 4 (as an example) would make the squash longer in relation to the rest of the ease. Default: 0

  • squashID (String) - the ID that should be assigned to the squash ease. The default is whatever the ID of the bounce is plus “-squash” appended to the end. For example, CustomBounce.create("hop", {strength: 0.6, squash: 2}) would default to a squash ease ID of "hop-squash".

How do you get the bounce and the squash and stretch to work together? You’d use two tweens; one for the position (y), and the other for the scaleX and scaleY, with both running at the same time:

  1. //Create a custom bounce ease:
  2. CustomBounce.create("myBounce", {strength: 0.6, squash: 3, squashID: "myBounce-squash"});
  3. //do the bounce by affecting the "y" property.
  4. gsap.from(".class", {duration: 2, y: -200, ease: "myBounce"});
  5. //and do the squash/stretch at the same time:
  6. gsap.to(".class", {duration: scaleX: 140, scaleY: 60, ease: "myBounce-squash", transformOrigin: "center bottom"});


In addition to the .create() method seen above, CustomBounce (like CustomEase) has a .getRatio() method that converts a linear progress value (0-1) into the corresponding eased value. In other words, if the tween is halfway done (progress of 0.5), you’d get the corresponding ease ratio like this:

  1. //create a CustomEase with an ID of "hop"
  2. var ease = CustomBounce.create("myBounce", {strength: 0.6, squash: 3, squashID: "myBounce-squash"});
  3. //get the eased ratio at the progress of 0.5 (halfway done):
  4. var value = ease.getRatio(0.5);


CustomBounce also shares CustomEase’s method that calculates the SVG <path> data string for visualizing any ease graphically at any size that you define, like {width: 500, height: 400, x: 10, y: 50}. You can supply a CustomEase or the ID associated with one, or even a standard ease like Power2.easeOut. Feed in a path in the vars object and it’ll populate its d attribute for you, like:

  1. //create a CustomEase with an ID of "hop"
  2. CustomBounce.create("myBounce", {strength: 0.6, squash: 3, squashID: "myBounce-squash"});
  3. //draw the ease visually in the SVG that has an ID of "ease" at 500px by 400px:
  4. CustomEase.getSVGData("myBounce", {width: 500, height: 400, path: "#ease"});

Download CustomEase

You must have a GreenSock account which is completely free to set up. Plus it gets you access to our community forums (a fantastic place to learn and get your questions answered). Simply log into your GreenSock account and get it from the “Downloads” area of your Account Dashboard. Or use the widget at the bottom of the CustomEase page to sign up and get the CustomEase file. It’s in the “easing” directory.

Note: CustomEase is not in the GitHub repository or CDN; it’s only available for download at GreenSock.com.

Copyright 2017, GreenSock. All rights reserved. This work is subject to theterms of useor for Club GreenSock members, the software agreement that was issued with the membership.