Jump to content
GreenSock

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

CustomEase memory clear

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

Hi I have created a tween using custom easeas following

 

TweenLite.to(graph, 2.5, { ease: CustomEase.create("custom", "M0,0,C0.126,0.382,0.282,0.674,0.44,0.822,0.632,1.002,0.818,1.001,1,1"), y: -500 });

 

The above tween is added to a timeline
 

As it is mentioned in  the docs that we have to create the custom ease on beginning of each webpage load, I want to clear/destroy the customease now , 
I have killed the tween and profiled the webpage in chrome but still seeing that the custom ease is not being removed.

 

is there a function like

 

customease.clear() there to do this thing ?

Share this post


Link to post
Share on other sites

First, don't create a custom ease inside an animation. Do it like this:

 

// Create your custom ease
CustomEase.create("myEase", "M0,0,C0.126,0.382,0.282,0.674,0.44,0.822,0.632,1.002,0.818,1.001,1,1");

// Use the ID you gave your custom ease
TweenLite.to(foo, 1, { ease: "myEase", x: 100 });
TweenLite.to(bar, 1, { ease: "myEase", x: 200 });

 

19 minutes ago, anotheruser said:

customease.clear() there to do this thing ?

 

Sure. Just re-create an ease with the same ID.

 

// myEase #1
CustomEase.create("myEase", "M0,0,C0.126,0.382,0.282,0.674,0.44,0.822,0.632,1.002,0.818,1.001,1,1");

// myEase #2
CustomEase.create("myEase", "M0,0,C0,0,1,1,1,1");

// These will use myEase #2 
TweenLite.to(foo, 1, { ease: "myEase", x: 100 });
TweenLite.to(bar, 1, { ease: "myEase", x: 200 });

 

 

  • Like 4

Share this post


Link to post
Share on other sites
45 minutes ago, anotheruser said:

I have killed the tween and profiled the webpage in chrome but still seeing that the custom ease is not being removed.

 

Are you literally trying to remove the ease from memory? You can do this:

 

CustomEase.create("myEase", "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");

delete Ease.map.myEase;

 

But that's pretty much pointless. The performance of your app will improve 0.000000000%. Even if you have 10,000 different custom eases in memory, the performance difference will be negligible.

 

When it comes to profiling animations, the main things you should be mindful of are rendering and painting times in the performance tab. 

 

  • Like 4

Share this post


Link to post
Share on other sites
10 minutes ago, OSUblake said:

delete Ease.map.myEase;

 

This is kind of what i need , I will check it right away

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 


  • Recently Browsing   0 members

    No registered users viewing this page.

×