Jump to content
Search Community

Help with logo zoom

jillianadriana test
Moderator Tag

Recommended Posts

Hey friendly GSAP folks,

 

I am following

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

to create a logo that shrinks and pins on scroll but I can't get the starting position and size to be where/what I want.

 

The goal is for it to begin at full size, or at least 100% of the width of the right column, just above the line of text. And then on scroll it shrinks to the top left.

 

Should I put it in the right column div? Is that where the issue is? I had tried that previously but wasn't able to get it to go to the top left corner of the screen, just the top left of the column it was in.

See the Pen GRmJyEG by jillianadriana (@jillianadriana) on CodePen

Link to comment
Share on other sites

I'm trying to visualize this...so you want it to sit centered above the text on the left, filling the width of that column at first? And then when you scroll past 100px, you want it to animate to a fixed position on the left (in the left column)? It seems like that'd look weird because if you make room for the logo above the text on the right, wouldn't you want the text to be lower (not centered top-to-bottom without the logo)? And then wouldn't the logo be less than 100px from the top? So it would scroll with the page initially (thus starting to go off-screen) and then once you hit 100px, it animates down and over to the left? 

 

Anything is possible, of course. 

 

If you're animating between two completely different contexts like this where you're literally changing how it flows in the document (from position: absolute to position: fixed in a different column), it's a perfect use case for Flip plugin. You'd simply set it up the way you want it to look on the right, then use a ScrollTrigger to fire a callback when it gets to 100px and in that callback you'd do a Flip animation and re-nest the element in the DOM and let Flip handle all the animation from one position to the other seamlessly. 

 

 

Flip is a membership benefit for Club GreenSock members, so you'd need to sign up to get access. You can use it as much as you want on CodePen, though, for free using this URL https://assets.codepen.io/16327/Flip.min.js

 

Here's a fork with this strategy in place: 

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

 

Is that more like what you wanted? 

  • Like 3
Link to comment
Share on other sites

Now you have me questioning my design, haha.

 

You are almost correct except the shrinking has nothing to do with 100px. Basically it goes from being centred in that right column to shrinking into the typical logo position on scroll. When you scroll back up, the logo goes back to that middle spot.

 

A. Full screen hero / starting point:

931424367_ScreenShot2021-07-06at9_24_44AM.png.3c8d74f56df5878c91136a28f82686d5.png

 

B. The next sections below the top section/hero:2052221689_ScreenShot2021-07-06at9_25_13AM.png.2bd145b58476d31d223cd345d4c6ed17.png

 

Does that make sense? I forgot that I ended up removing that line of text from the right column and gave it its own section, so hopefully that helps with some of your confusion.

 

Is Flip also useful for animating flexbox elements with ScrollTrigger? I have been playing around on Codepen and when I try to pin flexbox divs, they don't work very well because of the whole absolute/fixed position thing. I was also trying to see if I could get some sections to fade in while others did other things and it was just a disaster. I am having fun learning and trying to figure all of this out!

 

See the Pen gOWPmeo by jillianadriana (@jillianadriana) on CodePen

Link to comment
Share on other sites

Maybe something like this?

I haven't really experimented with FLIP that much so this may be the wrong way to do it.)I'm not entirely sure how to handle resizing either. I'll poke around a bit more and come back to this in a bit ☺️

See the Pen QWvyXyE?editors=1111 by GreenSock (@GreenSock) on CodePen



And yep - It works great with flexbox - the docs have a flexbox example

https://greensock.com/docs/v3/Plugins/Flip

  • Like 1
  • Thanks 1
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...