Jump to content
Search Community

I want the scaling to go from scale:3, to scale:1, on scrub. ANYBODY??!!

IbraheemHaseeb test
Moderator Tag

Recommended Posts

Okay so I wrote this code such that when I am scrolling it zooms in to an image and when I further scroll it zooms out to its original state of scale:1.

 

Maybe my codepen URL won't work because of the locally stored images. Can anyone just help how to zoom in with scroll then maintain that zoomed in state and then zoom out from that zoomed in state. My code just jumps to zoomed out state with going slowly with scrub:true .

index.html style.css app.js

See the Pen wvgQBdx?editors=0010 by ibraheemhaseeb7 (@ibraheemhaseeb7) on CodePen

Link to comment
Share on other sites

 

Hey @IbraheemHaseeb

 

You are actually making one of the most common ScrollTrigger-mistakes, creating .to() logic issues.

 

Easy fix here: set immediateRender: false on your second .to()-tween.

Or follow any of the other suggestions in the article linked above.

 

I modified your pen a bit to better demonstrate it working now. Welcome to the forums :) 

 

See the Pen 253f951a6ea342d99ef605f7f377eb5e by akapowl (@akapowl) on CodePen

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