Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

              <svg width="100%" height="100%" viewBox="0 0 700 700">
  <line x1="0" x2="700" y1="701" y2="701" stroke="#ccc" stroke-width="2" />
  <path id="bounce" fill="none" stroke="#336633" stroke-width="4px"/>
  <path id="squish" fill="none" stroke="#663333" stroke-width="4px"/>
  <circle id="ball" fill="blue" r="75" cx="350" cy="75"/>

              body {
  background-color: black;
svg {
  top: 50%;
  left: 50%;
  z-index: -1;
  overflow: visible;
  transform: translate(-50%,-50%);
Demonstrates the new CustomBounce ease that'll create a bouncing CustomEase according to the parameters you feed in (like strength and squash)
and also [optionally] create an accompanying "squash" ease curve that is perfectly synchronized with the bounce so that you can apply
other complimentary effects that kick in on the bounce (typically squashing/stretching). 

Special properties:

- strength: a value between 0 and 1 (default: 0.7) that controls the bounciness. The higher the number, the more bouncy.

- squash: A number that controls how much of a gap is introduced between each bounce to make room for the "squash" to happen. A common value is 2. Default is 0 (no squash)

- jump: if true, the bounce will end where it starts, meaning it'll act like it's jumping toward whatever value you define, and then falls back toward the starting value.

- squashID: The ID (name) that you want assigned to the squish CustomEase. By default, it will simply append "-squash" to the name you give the bounce. 

In the example, the green line is the bounce, and the brown line is the accompanying squash ease. Play with the strength/squash values and see what happens.

If you think about the physics of a ball bouncing (one that’s really bouncy/squashy), when it hits the ground it doesn’t INSTANTLY go back up; it strikes, compresses (so it’s still on the ground this whole time), then transfers energy back up and takes off again. That's the "stick" or gap in the bounce. The squash.

CustomBounce.create("myBounce", {strength:0.9, squash:2, squashID:"myBounce-squash"});

//the bounce:
var duration = 5;
TweenMax.to("#ball", duration, {delay:0.2, y:550, ease:"myBounce", repeat:8, repeatDelay:0.5});
//the squish which affects scaleX and scaleY. To make the effect stronger/weaker, just change the scaleX/scaleY values:
TweenMax.to("#ball", duration, {delay:0.2, scaleX:1.34, scaleY:0.5, ease:"myBounce-squash", transformOrigin:"bottom center", repeat:8, repeatDelay:0.5});

//graph the lines...
document.getElementById("bounce").setAttribute("d", CustomEase.getSVGData("myBounce", {width:700, height:500}));
document.getElementById("squish").setAttribute("d", CustomEase.getSVGData("myBounce-squash", {width:700, height:500}));

//watch the video: https://www.youtube.com/watch?v=GjXUhpYA168
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.