Jump to content
GreenSock

kittichai

Clip animation doesn't animate

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 have isolate the simplest code here:

 

index.html


<html>
<head>
<script src="jquery-1.8.3.js"></script>
<script src="tweenmax.min.js" type="text/javascript"></script>
<script src="index.js"></script>
</head>
<body>
</body>
</html>

 

index.js

(function() {
'use strict';

$(document).ready(function() {
var divImage1 = $('<div>');
var onloadHandler = function () {
TweenMax.to(image1, 3, {css:{clip:"rect(0px,275px,95px,0px)"}});
// TweenMax.to(image1, 3, {css:{left: "500px"}});
}

var image1 = $('<img>');//
image1.css('position', 'absolute');
image1.css('left','200px');
divImage1.css('top','0px');
divImage1.css('position', 'absolute');
divImage1.append(image1);
$(document.body).append(divImage1);
image1.css('clip', 'rect(30px, 80px, 80px, 30px)');
image1.load(onloadHandler);
image1.attr('src', 'https://www.google.com/images/srpr/logo3w.png');
});

})();

 

The image appears clipped, as indicates by CSS. But, the TweenMax CSS clip doesn't animate at all. First, I tried just adding TweenMax and it didn't work, so I think may be I should wait for image to load. So, I add the TweenMax inside onload, still doesn't work.

 

I have used debugger, and it definitely run the TweenMax line. If you remove the comment on another the line that said

TweenMax.to(image1, 3, {css:{left: "500px"}});

You will see that image move just fine.

Link to comment
Share on other sites

OK... I found the problem. I use incorrect minified version.

So, why some version of TweenMax.min.js includes CSSPlugin, and some version don't?

The paid version's min already include CSSPlugin, but the one I got from first page don't.

Link to comment
Share on other sites

No, all versions of TweenMax include CSSPlugin. I'm really confused - can you send me the one that doesn't include it? I'm really curious to see it.

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