Skip to content

Instantly share code, notes, and snippets.

@arisetyo
Created November 13, 2012 06:09
Show Gist options
  • Save arisetyo/4064247 to your computer and use it in GitHub Desktop.
Save arisetyo/4064247 to your computer and use it in GitHub Desktop.
A simple animation using the Greensock for JS library
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8"/>
<title>Basic Greensock</title>
<script src="minified/TweenMax.min.js"></script>
<script type="text/javascript">
function init() {
var b = document.getElementById('brie');
TweenMax.to(b, 3, {width:100, ease:Elastic.easeOut, onComplete:animDone});
//OTHER EXAMPLES
//TweenMax.to(b, 3, {width:"-=200", ease:Elastic.easeOut, onComplete:animDone});
//TweenMax.to(b, 3, {width:"+=200", ease:Elastic.easeOut, onComplete:animDone});
}
function animDone() {
alert("hi there..");
}
</script>
</head>
<body onload="init()">
<img src="alison_brie.jpeg" id="brie"/>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment