« Tutoriel GreenSock GSAP » : différence entre les versions
Aller à la navigation
Aller à la recherche
Ligne 41 : | Ligne 41 : | ||
Pareil que ci-dessus, mais ajout d'autres paramètres d'animation. | Pareil que ci-dessus, mais ajout d'autres paramètres d'animation. | ||
* http://tecfa.unige.ch/guides/gsap/gsap-animation-2.html | * http://tecfa.unige.ch/guides/js/gsap/gsap-animation-2.html | ||
<source lang="html5"> | <source lang="html5"> |
Version du 27 septembre 2013 à 12:28
Cet article est une ébauche à compléter. Une ébauche est une entrée ayant un contenu (très) maigre et qui a donc besoin d'un auteur.
Exemples
Simple animation de movement
Important:
- L'élément à animer doit être positionné "relativement"
TweenLite.to(thing, 3, {left:"600px", ease:Bounce.easeOut});
veut dire qu'on bouge un objet "thing" pendant 3 secondes dans une position côté gauche = 600px (par rapport au containeur, en occurence le div.easeWrapper.
<!doctype html>
<html>
<head>
<title>Simple animation with GSAP</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script type="text/javascript" src="src/minified/plugins/CSSPlugin.min.js"></script>
<script type="text/javascript" src="src/minified/easing/EasePack.min.js"></script>
<script type="text/javascript" src="src/minified/TweenLite.min.js"></script>
<script>
window.onload = function() {
var thing = document.getElementById("thing");
TweenLite.to(thing, 3, {left:"600px", ease:Bounce.easeOut});
}
</script>
</head>
<body>
<!-- define a box within which the thing will move -->
<div id="easeWrapper" style="width:800px">
<span id="thing" style="position:relative; border-style:solid; background:yellow">HELLO</span>
</div>
</body>
</html>
Simple animation de movement et de couleur
Pareil que ci-dessus, mais ajout d'autres paramètres d'animation.
<!doctype html>
<html>
<head>
<title>Simple animation with GSAP</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script type="text/javascript" src="src/minified/plugins/CSSPlugin.min.js"></script>
<script type="text/javascript" src="src/minified/easing/EasePack.min.js"></script>
<script type="text/javascript" src="src/minified/TweenLite.min.js"></script>
<script>
window.onload = function() {
var thing = document.getElementById("thing");
TweenLite.to(thing, 3, {left:"600px",
backgroundColor:"black",
color:"white",
ease:Bounce.easeOut});
}
</script>
</head>
<body>
<!-- define a box within which the thing will move -->
<div id="easeWrapper" style="width:800px">
<span id="thing" style="position:relative; border-style:solid; background:yellow">HELLO</span>
</div>
</body>
</html>
Problèmes
Attention aux permissions et noms de fichiers et répertoires. Testez si les libraires chargés sont accessibles
Liens
Documentation officielle
- Greensock (home page)
- GSAP: Professional-Grade HTML5 Animation
- Jump Start: GSAP JS (démo donné dans le cours)
- Getting Started Guide
Tutos, exemples
- Greensock JavaScript Animation, Blog post, 2012.