Jump to content
GreenSock

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

CustomEase memory clear

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.

×