GreenSock


Custom Ease Builder - Easing Made Easy

Posted in Tweening by jack on the August 16th, 2008
Version 0.9, Updated 8/16/2008
  • Compatibility: AS2 and AS3

Get this class free when you join Club GreenSock

DESCRIPTION

Sometimes the standard easing equations (Elastic, Strong, etc.) don't give you quite what you want. This tool allows you to interactively draw a curve for your own custom easing equation and it even writes the code for you. Just copy and paste it into your AS3 or AS2 application. The code it writes requires the gs.easing.CustomEase class which is a membership benefit of Club GreenSock.

USAGE

Once you create your custom ease there are a few ways you can refer to your custom easing equation. Here are a few options:

  1. import gs.easing.CustomEase;
  2. import gs.TweenLite;
  3.  
  4. CustomEase.create("myCustomEase", [{s:0,cp:0.394,e:0.644},{s:0.644,cp:0.894,e:1}]); //do this only once for each custom ease you want to create.
  5.  
  6. //then later...
  7. TweenLite.to(mc, 2, {x:"250", ease:CustomEase.byName("myCustomEase"), delay:1});

Or to speed things up slightly, you could store a reference to the easing function instead of calling the CustomEase.byName() function each time:

  1. import gs.easing.CustomEase;
  2. import gs.TweenLite;
  3.  
  4. var myEase:Function = CustomEase.create("myCustomEase", [{s:0,cp:0.394,e:0.644},{s:0.644,cp:0.894,e:1}]); //do this only once for each custom ease you want to create.
  5.  
  6. //then later...
  7. TweenLite.to(mc, 2, {x:"250", ease:myEase, delay:1});

Or if you prefer to keep track of the CustomEase instance instead, you can reference its easing function with the "ease" property, like:

  1. import gs.easing.CustomEase;
  2. import gs.TweenLite;
  3.  
  4. var myEase:CustomEase = new CustomEase("myCustomEase", [{s:0,cp:0.394,e:0.644},{s:0.644,cp:0.894,e:1}]); //do this only once for each custom ease you want to create.
  5.  
  6. //then later...
  7. TweenLite.to(mc, 2, {x:"250", ease:myEase.ease, delay:1});

FAQ

  1. I don't see a download link? Where do I get the CustomEase class?
    The gs.easing.CustomEase class comes with your memebership to Club GreenSock. When you join, you'll get a confirmation e-mail with a link to download the bonus classes.
  2. Does this tool write code that's compatible with other tweening engines?
    It sure does. It follows the standard format for easing equations, accepting 4 parameters: time, start value, change in value, duration. You should be able to use it with virtually any tweening engine.
  3. Is there an AS2 version of CustomEase available or is it only built in AS3?
    Just like my tweening classes, there are AS2- and AS3-compatible versions of CustomEase. They work EXACTLY the same. The interactive tool is built in AS3, but the code it generates is compatible with both.

Need Help?

Feel free to e-mail me a question. Or post your question on the new forums. I'd highly recommend joining Club GreenSock to get prioritized access to my time in answering your question, and so that you receive updates and lots more. When you e-mail your question, please include a simplified FLA file (and any class files) that clearly demonstrates the problem and provide a brief explanation.

Author: Jack Doyle, (e-mail: jack -at- greensock.com)
Copyright 2008, GreenSock (This work is subject to the terms here.)

12 Responses to 'Custom Ease Builder - Easing Made Easy'

Subscribe to comments with RSS

  1. Clemente G said,

    on August 16th, 2008 at 9:46 pm

    Now this is a class I can get into thanks alot for this Jack. I’ll help spread the word

    http://blog.kreativeking.com/2008/08/new-class-from-jack-aka-mr-greensock/

  2. John Webber said,

    on August 16th, 2008 at 9:52 pm

    Jack,

    What’s wrong with you? Are you human? This is genius.

    THANK YOU!

    John

  3. Platfuse said,

    on August 17th, 2008 at 3:14 am

    Jack.. this is damn Cool..! too Good

  4. Torben said,

    on August 17th, 2008 at 3:50 am

    Fantastic Jack - just fantastic.

    Great idea and great use of the Greensock Member program. I really feel I’m getting my moneys worth.

  5. Sakana said,

    on August 17th, 2008 at 7:13 am

    great tool, it’s amazing

    Thank you !

    S.

  6. Jakob said,

    on August 17th, 2008 at 9:23 am

    Super cool Jack, thanks for tweaking this great framework, again again! :)

  7. Bastian said,

    on August 17th, 2008 at 10:12 am

    with this great tool you have one more club member and I’m really looking forward using your transform classes ;)

  8. Neo said,

    on August 18th, 2008 at 4:11 am

    Totally amazing work!
    It really helps me a lot!

  9. Cliff said,

    on August 19th, 2008 at 8:21 pm

    You’re the man, Jack. Thanks for continuing to add excellent tools to our member’s collection–it is sooo worth it to join the club.

  10. Denver said,

    on August 25th, 2008 at 8:40 pm

    This is one of the slickest apps I have seen - very sharp and very helpful. Thank you so much for sharing!


  11. on September 3rd, 2008 at 4:38 pm

    Fantastic!!! Great job!


  12. on September 16th, 2008 at 8:12 pm

    Nice job!
    I was looking for something like this for quite a while.

Leave a Reply