Jump to content
Search Community

Different widths - same duration

usr1931990 test
Moderator Tag

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

Is it possible?

I have many divs with text that have different width. I want them to move at the same animation speed. This is my code:

 

    startRolling: function($text, $wrap) {
      let duration = $wrap.width() / 40;
      TweenMax.to($wrap, duration, {
        x: -($text.width()),
        ease: Linear.easeNone,
        repeat: -1
      });
    }

 

So this doesn't work, and setting the duration manually to for instance .9 obviously doesn't work.

 

Thanks!

Link to comment
Share on other sites

An extension to the previous pen...

 

In typical fashion around here, one thing leads to another and gets completely off the original topic. Extending Craig's elegant 

x: window.innerWidth

I think I might have come up with a fairly decent option for making transform based animations responsive. It basically uses the parent element as a stage and modifier to animate relative to it.

 

See the Pen XwXQGV by Visual-Q (@Visual-Q) on CodePen

 

 

  • Like 4
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...