Jump to content
Search Community

PNG Sequence within pinned section

DevC test
Moderator Tag

Go to solution Solved by Cassie,

Recommended Posts

Hi,

 

Right now your example is using a video element and seems to work as expected.

 

If you want to use a bunch of images I'd strongly recommend you to use canvas, as it seems you're trying, but is not really clear to me TBH.

 

Take a look at this example by @OSUblake and I think you should be on your way:

Hopefully that helps you get started.

 

Happy Tweening!

  • Like 1
Link to comment
Share on other sites

I've simplified the code so the video piece doesn't confuse anyone. The desired outcome is a pinned container with 4 stacked sections within. I'd like each section to stay pinned until you've scrolled through the full animated sequence. I've thought using a scroller might be the solution or a timeline within a timeline, but I know these can get very complicated.

Link to comment
Share on other sites

You made one of the most common mistakes - you nested a ScrollTrigger in an animation inside a timeline that has a ScrollTrigger. That's logically impossible - the playhead can't be controlled by both the parent timeline AND the scrollbar position. 

 

Here's a fork that just uses that one timeline/ScrollTrigger: 

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

 

I'm not entirely sure how you want things to work, but hopefully that gets you moving in the right direction. 👍

  • Like 1
Link to comment
Share on other sites

Thanks for the help. This is getting closer, but one thing I can't figure out. Each `scene` is going to have it's own image sequence. I need to run through the sequence before transitioning to the next scene. Playing with your example, after adding any siblings after the one with the image sequence it no longer scrubs through the images.

For simplicity, this fork doesn't actually use anymore image sequences, only more scenes. Don't want to complicate.

See the Pen rNKgbJp by dcha (@dcha) on CodePen



 

Link to comment
Share on other sites

  • Solution

Heya, 

So this largely comes down to an understanding of the position parameter and how and when each tween is being adde to the timeline
 

In your latest example the canvas image sequence tween has no position parameter so it's being added in at the end of the timeline, you want to add that tween in when that section is actually visible.

So as you loop through the sections, check if it's a section with a canvas sequence, and add that tween in.

See the Pen JjZQYVr?editors=1011 by GreenSock (@GreenSock) on CodePen


Take a little look at the position parameter here...
 

 

If you're a bit confused I'd suggest trying to write the timeline out without a loop, that's what gets most people muddled! Just write each step manually. Timelines are hard enough by themselves without being abstracted away.


 

  • Like 2
Link to comment
Share on other sites

You rock. Thank you.

 

For any future visitors, this type of component thoroughly borked the order of my tweens. If you find yourself with mismatched start points on the subsequent pieces, you'll want to check out `refreshPriority`.

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