Jump to content
Search Community

animating scale and opacity

Combustion test
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

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

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