Jump to content
GreenSock

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

animating scale and opacity

Recommended Posts

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

Link to comment
Share on other sites

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
Link to comment
Share on other sites

  • 5 years later...
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.

 

Link to comment
Share on other sites

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