Jump to content

Search In
  • More options...
Find results that contain...
Find results in...

Scale not appearing to work on image/div

Go to solution Solved by Jonathan,

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

I'm trying to create an infographic using scrollmagic/greensock, where I have everything in layers, and each layer tweens down to nothing as you scroll down, so whatever is beneath it is revealed on scroll. I already tried using svgs and clippaths, which was a nightmare since I'm new to them and scrollmagic both. So I decided to use css border-radius. My problem right now is that I'm trying to scale these down and nothing seems to be happening. If I look in my console I will see the styles scaleX: 0 and scaleY: 0 have been applied but the image will still be the same width and height. It doesn't move at all. 

See the Pen BoXOMJ by kathryncrawford (@kathryncrawford) on CodePen

Link to comment
Share on other sites

  • Solution

Hello kathryn.crawford,


You really love Bill Murray :D


It looks like you were using the AttrPlugin since you had your CSS properties wrapped in the attr:{} object


See the Pen mVdwpz by jonathan (@jonathan) on CodePen


So convert this:

tl.to("#scroll-img1", 1, {attr:{scaleX: 0, scaleY: 0, transformOrigin: "50% 50%"}});

to this without the attr:{} object:

tl.to("#scroll-img1", 1, {scaleX: 0, scaleY: 0, transformOrigin: "50% 50%"});

Also if you want the image to keep it's border-radius then you will need to add the border-radius to your <img> tag as well

.scroll-container > img{
    border-radius: 50%;

Does that help?

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