Jump to content
GreenSock

jesper.landberg

Tween not completing?

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,

 

I'm trying to animate elemens when they are in viewport. However, they often stop animating.

 

My "in-view" code:

const elems = [...document.querySelectorAll('[data-scroll]')]

this.observer = new IntersectionObserver(entries => {
  entries.forEach(entry => {
    if (entry.intersectionRatio > 0) {
      TweenMax.from(entry.target, 2, { y: 200, alpha: 0, ease: Expo.easeOut })
    } else {
      TweenMax.set(entry.target, { clearProps: 'all' })
    }
  })
})

elems.forEach(elem => {
  this.observer.observe(elem)
})

 

Why is this?

 

EDIT: I't works if i do fromTo instead of from. But why?

 

Attached image of issue.

 

scrollproblems.jpg

Link to comment
Share on other sites

Hi @jesper.landberg,

 

Could you set up a reduced case example? I am guessing you are using Vue.js but regardless it will be pretty hard to help without seeing what's going wrong.

 

 

  • Like 3
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.
×