Jump to content
Search Community

Timeline not working correctly

Imperyum test
Moderator Tag

Recommended Posts

Hi, 
I created animation and translation in my locahost and now I've transfered my files on a wordpress website and I've import all the same librairies.

One of the translation that I've created is not working properly.

Here is the code:

const hp360 = gsap.timeline({
      scrollTrigger: {
         trigger: ".hp-360",
         start: "35% 70%",
         end: "35% 70%",
         scrub: true,
         markers: true
      }
   });
   hp360.from(".hp-360-text", {
      yPercent: 25,
      duration: 0.4
   })
   hp360.from("#hp-360-desc", {
      yPercent: -100,
      duration: 0.2
   })


What it should look like at the end of the translation:
image.thumb.png.925c5b9f0c182cb9065084134c51b7df.png

This is what the animation should do:
image.thumb.png.81bef9726eb09ea7fe003d29f31c8672.png

I found that the property transform: translate(0, -125px) is not supposed to be there. If I want to my translation to work, I would need to have transform: translate(0).

Thanks

See the Pen dydWBBZ by Imperyum (@Imperyum) on CodePen

Link to comment
Share on other sites

It's pretty tough to troubleshoot without a minimal demo - the issue could be caused by CSS, markup, a third party library, your browser, an external script that's totally unrelated to GSAP, etc. Would you please provide a very simple CodePen or CodeSandbox that demonstrates the issue? 

 

Please don't include your whole project. Just some colored <div> elements and the GSAP code is best (avoid frameworks if possible). See if you can recreate the issue with as few dependancies as possible. If not, incrementally add code bit by bit until it breaks. Usually people solve their own issues during this process! If not, then at least we have a reduced test case which greatly increases your chances of getting a relevant answer.

 

Here's a starter CodePen that loads all the plugins. Just click "fork" at the bottom right and make your minimal demo

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

 

If you're using something like React/Next/Nuxt/Gatsby or some other framework, you may find CodeSandbox easier to use. 

 

Once we see an isolated demo, we'll do our best to jump in and help with your GSAP-specific questions. 

Link to comment
Share on other sites

There are a few problems here.

  • Your trigger element (.hp-360) doesn't exist
  • There are several elements with CSS transitions
  • Your start and end are both set to "35% 70%", but you have scrub set to true

 

If you decide which element should be the trigger and remove the CSS transitions on everything GSAP will be animating, I think you'll be good to go.

 

Happy tweening.

:)

 

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