Jump to content
Search Community

combining scrollTrigger that zooms in timeline already on scrollTrigger for other tweens

jeanettable test
Moderator Tag

Go to solution Solved by GreenSock,

Recommended Posts

In an attempt to make my pinned text slideshow feature more interesting with a zoom that is also on a scrub, I ended up with nested scrollTriggers. It appears to be working, but I am wondering if this is a good approach, and also about how I should go about specifying duration for the nested scrollTrigger? I ended up manually adding the other durations that follow it, in hopes that the zoom would take the full time of the text appearance tweens, and could not come up with another way to adjust for duration from the docs since it measures in seconds. 

The other piece that doesn't work as I expected is to do with the text getting zoomed with the image. Is this to do with how I'm trying to target text by id's for tweens, and the class with the background-image for the zoom?

** Further explanation: I have been playing with the markup (div ending originally on 19 for .intro, but tried separating it by closing it on ln 5...) because I was trying to separate the div that has the background img content specified in CSS, thinking that if I triggered only the .intro with the background I want to zoom, that the text specified by hierarchical id's would remain unbothered appearing in the main container. Any insight on why the text is also zooming would be helpful to my understanding of how to target these things separately to create a type of text slideshow feel with a zoom.

 

Thank you for your mental energy, time, and the always helpful assists!

See the Pen OJjpaWN by jeanettable (@jeanettable) on CodePen

Link to comment
Share on other sites

  • Solution

You definitely shouldn't be nesting ScrollTriggers - that creates a logical impossibility (both would be trying to control the same animation). 

 

The text is zooming too because you're scaling the entire container (which includes all the text). If you want to just zoom the image, you need to create a separate element for that. 

 

Just put all your animations into one timeline. You can add the zoom last and just use the position parameter to make it start at the very beginning of the timeline, and set its duration to whatever the duration of the timeline is like this: 

See the Pen rNzyRZq?editors=0010 by GreenSock (@GreenSock) on CodePen

 

Is that more like what you wanted? 

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