Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

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

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

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.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <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"/>
</svg>

              
            
!

CSS

              
                body {
  background-color: black;
}
svg {
  position:absolute;
  top: 50%;
  left: 50%;
  z-index: -1;
  overflow: visible;
  transform: translate(-50%,-50%);
}
              
            
!

JS

              
                /*
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.8});

//the bounce:
var duration = 5;
var tl = new TimelineMax({delay:0.3});
  tl.to("#ball", duration, {y:550, ease:"myBounce"})



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

//watch the video: https://www.youtube.com/watch?v=GjXUhpYA168
              
            
!
999px

Console