Jump to content
Search Community

How can add TweenLite Code with ScrollTrigger

Riyas Ahamed test
Moderator Tag

Recommended Posts

I want to add this  Tweenlite code when my trigger reach the start point. ( I was Using ScrollTrigger )

TweenLite.to("#one", 1, {
  // ease: Power4.easeInOut,
  ease: Linear.easeNone,
  css: {"opacity": "1",
  "z-index": "99"
  }
 

});

 

 

 gsap.timeline({
    scrollTrigger:{
      trigger:".one",
      toggleClass:"active",
      start:"top 80px",
      end : "bottom top",
      scrub:true,
      pin:false,
      markers:true,}
 
  });

Link to comment
Share on other sites

Hi Ryas, 

it would help if you could post an example of your problem in a codepen but looking at your code it seems that you are trying to mix tweenlite (an old version of green sock) with gsap3.timeline() and scrolltrigger() - a recently added plugin.

there are some instructions on how to create a codepen and if you look in the docs you can find the differences and how to convert tweenlite to the more recent gsap.to() from() and toFrom() methods.

  • Like 1
Link to comment
Share on other sites

Yeah, it's difficult to know what's going on without a minimal demo, but I assume you wanted something like this: 

 

let tl = gsap.timeline({
	scrollTrigger:{
		trigger: ".one",
		toggleClass: "active",
		start: "top 80px",
		end: "bottom top",
		scrub: true,
		pin: false,
		markers: true
	}
});

tl.to("#one", {
	duration: 1,
	ease: "none",
	opacity: 1,
	zIndex: 99
});

If you're migrating from an old GSAP version, you might want to check out

 

Happy tweening (and scrolling)!

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