Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...

CustomBounce.create()

CustomBounce.create( ID:String, vars:Object ) : CustomBounce

Creates a CustomBounce ease based on the parameters you provide.

Parameters

ID: String

An ID (name) that can be used to identify this CustomBounce instance, like "superBounce".

vars: Object

configuration options for the ease for setting its strength (bounciness), and squash.

Show More

Returns : CustomBounce

Returns a CustomBounce ease instance.

Details

This method creates a new CustomBouunce ease and a separate ease to handle the squash and stretch (optional).

For the bounce and the squash/stretch to work together use two tweens; one for the position ("y"), and the other for the scaleX/scaleY, with both running at the same time:

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

See the Pen CustomBounce from GreenSock by GreenSock (@GreenSock) on CodePen.

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.
×