Jump to content
GreenSock

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

CustomEase.create()

CustomEase.create( ID:String, data:String ) : CustomEase

Creates a CustomEase instance

Parameters

ID: String

An ID (name) that can be used to identify this CustomEase instance, like "hop"

data: String

The string describing the easing curve, like "M0,0 C0,0 0.056,0.442 0.175,0.442 0.294,0.442 0.332,0 0.332,0 0.332,0 0.414,1 0.671,1 0.991,1 1,0 1,0". This can be SVG path data containing “M”, “C”, “S”, “L”, or “Z” commands, or it can be a string containing 4 numbers from CSS cubic-bezier() data like from cubic-bezier.com. Typically the values are normalized (0-1) but if not, they’ll be normalized internally.

Returns : CustomEase

Returns a new CustomEase instance

Details

Creates a CustomEase instance and associates it with a particular ID (name) that can be used later in your animation code.

//create a CustomEase with an ID of "hop"
CustomEase.create("hop", "M0,0 C0,0 0.056,0.445 0.175,0.445 0.294,0.445 0.332,0 0.332,0 0.332,0 0.414,1 0.671,1 0.991,1 1,0 1,0");

//then, in your tween you can reference the ID for the ease:
TweenMax.to(element, 1, {y:-100, ease:"hop"});

We strongly recommend creating the CustomEase(s) when your page/app initially loads (rather than directly in each tween) in order to maximize performance and readability. You then reference it by ID in the tweening code. When an ease is created, it must parse the points and do various calculations to prepare for blisteringly fast runtime performance during the animation, so front-loading those calculations when your page/app loads is typically best.

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 https://greensock.com/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.
×