Jump to content
Search Community

animating scale and opacity

Combustion
Moderator Tag

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

Posted

Hi, 

New to the javascript version of GSAP but have been using greensock for years

 

Im trying to basically animate the scale of an image and also the opacity like this:

 

 

 

 

    $(document).ready(function(){
    
    $('.photo').mouseover(function (e){   
        TweenMax.to($(this), .2, {scaleX:1, scaleY:1, css:{opacity:1}});
    })
    $('.photo').mouseout(function (e){    
        TweenMax.to($(this), .2, {scaleX:0.8, scaleY:0.8, css:{opacity:0.7}});
    })


})
 

But it only seems to do the opacity, but if I take out the opacity it does the scale.
am I missing something painfully obvious?

thanks

C

jamiejefferson
Posted

scale is a property to be tweened by CSSPlugin and should be inside the css object

(with GSAP 1.8, you can also skip the css object altogether if you want)

TweenMax.to($(this), .2, {css:{scaleX:0.8, scaleY:0.8, opacity:0.7}});
// or
TweenMax.to($(this), .2, {scaleX:0.8, scaleY:0.8, opacity:0.7});
I think the mixing of styles is what caused your issue.
  • Like 2
Posted

Yes thats done it thanks! 

  • 5 years later...
lucaskaspary05
Posted
On 2/6/2013 at 1:41 PM, jamiejefferson said:

scale is a property to be tweened by CSSPlugin and should be inside the css object

(with GSAP 1.8, you can also skip the css object altogether if you want)


TweenMax.to($(this), .2, {css:{scaleX:0.8, scaleY:0.8, opacity:0.7}});
// or
TweenMax.to($(this), .2, {scaleX:0.8, scaleY:0.8, opacity:0.7});

I think the mixing of styles is what caused your issue.

 

Posted

Luaskaaspary,

 

I'm guessing your post above where you just quote jamie's answer from 5 years ago was a mistake. 

If you have an actual question please let us know, otherwise I'll delete it. no biggie.

  • Like 1

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