Jump to content
GreenSock

bs.choi

How can I use quickSetter() or set() to improve the performance of that code?

Recommended Posts

Hi.
I made a custom cursor with gsap.TweenMax.

However, looking at a few examples, they are created using set() or quickSetter().

The official documentation says there is a performance difference, so I would like to improve the performance.

But I'm not sure how to refactor it. (I want to keep the function as it is)

Please advise.
thank you.

 

https://jsfiddle.net/5dpzhfe0/28/

Link to comment
Share on other sites

You would need to update to version 3+. quickSetter is not available in version 2.

 

Link to comment
Share on other sites

If you want to use the quickSetter, we have a demo that you should be able to adapt.

 

See the Pen WNNNBpo by GreenSock (@GreenSock) on CodePen

 

You just need to create x and y setters for your additional elements and then do similar calculations in the gsap.ticker part. Each element should have a different speed value.

 

Link to comment
Share on other sites

@OSUblake 

I saw an example and implemented it.

However, additional elements are moving at the same time.

Is this method wrong?

I've looked at the official documentation, but I don't know how to add duration or delay.

I want to make a clean and fast (without a lot of easeing) function like the example I asked in the first question.

https://jsfiddle.net/b5t9jxh6/4/

 

gsap is so amazing and awesome but still too hard for me....

Link to comment
Share on other sites

2 hours ago, bs.choi said:

However, additional elements are moving at the same time.


Heya!


I don't understand what you mean by this - could you explain what you're trying to do?

 

Your demo looks fine to me.

Link to comment
Share on other sites

Each element needs it own position object.

 

See the Pen XWeBBQr by GreenSock (@GreenSock) on CodePen

 

But if you need a delay or a different easing, then you should probably just keep the code you have. The quickSetter is not meant to replace all the functionality of tweens.

Link to comment
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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×