Jump to content
Search Community

Yoyo plugin together with TweenLite?

Tookster test
Moderator Tag

Go to solution Solved by GreenSock,

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,

 

Working on some banner ads, where filesize is important, I was wondering if it is possible to use the yoyo effect without loading TweenMax.min.js . At the moment it's the only effect I'm using TweenMax for, but it's an extra 76 kb if I'm not mistaking.

I included a codepen demo where I built the yoyo effect as a TweenLite sequence, but it's not very beautiful to copy paste this every time I want a similar effect.

Been looking around at the forum, but can't really find a solution (Using the CDN links is of course an option, I know). Thanks in advance,

 

Wouter

See the Pen PwWBpa by anon (@anon) on CodePen

Link to comment
Share on other sites

  • Solution

No, it isn't an extra 76k. According to my grunt task runner, the entire gzipped size of TweenMax is under 23kb. http://prntscr.com/5qymtjPerhaps you were looking at the non-gzipped number. Most servers gzip things these days. 

 

Diaco's solution is solid. You can just parameterize the target (and maybe the number of iterations) in that function and you're good-to-go. 

  • Like 1
Link to comment
Share on other sites

Thanks Diaco and Jack.

I'm kinda new to JavaScript but Diaco's solution looks great.

@Jack, how would I use the gzip file? Use the regular TweenMax.min.js for the concept (to show the client) and check if the platform (where the banner ads are sended to) if they gzip the files (automatically)?

Link to comment
Share on other sites

Thanks Jack.

Btw, just talked to the tech-guys at the platform and they said it's fine to use the CDN. Thought they wanted to keep these kind of things in there own hand or something, but I was wrong. Saves me a bunch of kb's :)

Still good to know about gzip though.

  • Like 2
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.
×
×
  • Create New...