Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentes Révision précédente Prochaine révision | Révision précédente | ||
objets:animation [2019/03/11 13:20] admin [Créer un objet Animation] |
objets:animation [2019/03/13 22:16] (Version actuelle) admin [Position et taille] |
||
---|---|---|---|
Ligne 7: | Ligne 7: | ||
* Créer un objet Animation : | * Créer un objet Animation : | ||
- | <code tangara> | + | <code declick> |
uneAnimation = new Animation() | uneAnimation = new Animation() | ||
</code> | </code> | ||
Ligne 13: | Ligne 13: | ||
* Créer un objet Animation en chargeant une image depuis un fichier : | * Créer un objet Animation en chargeant une image depuis un fichier : | ||
- | <code tangara> | + | <code declick> |
uneAnimation = new Animation("fichier.png") | uneAnimation = new Animation("fichier.png") | ||
</code> | </code> | ||
Ligne 25: | Ligne 25: | ||
* Placer l’Animation : | * Placer l’Animation : | ||
- | <code tangara> | + | <code declick> |
uneAnimation.définirPosition(300,200) | uneAnimation.définirPosition(300,200) | ||
uneAnimation.définirPositionCentre(300,200) | uneAnimation.définirPositionCentre(300,200) | ||
Ligne 31: | Ligne 31: | ||
/* | /* | ||
- | *uneAnimation.définirCoordonnéeX(300); | + | *uneAnimation.définirCoordonnéeX(300) |
- | *uneAnimation.définirCoordonnéeY(200); | + | *uneAnimation.définirCoordonnéeY(200) |
*/ | */ | ||
- | /* | ||
- | * * Récupérer les coordonnées de l’Animation : | ||
- | * | ||
- | *uneAnimation.récupérerCoordonnéeX(); | ||
- | *uneAnimation.récupérerCoordonnéeY(); | ||
- | */ | ||
+ | * Récupérer les coordonnées de l’Animation : | ||
+ | <code declick> | ||
+ | uneAnimation.récupérerCoordonnéeX() | ||
+ | uneAnimation.récupérerCoordonnéeY() | ||
+ | </code> | ||
/* | /* | ||
* * Changer la taille de l’Animation : | * * Changer la taille de l’Animation : | ||
Ligne 56: | Ligne 55: | ||
* Montrer / Cacher l’animation : | * Montrer / Cacher l’animation : | ||
- | <code tangara> | + | <code declick> |
uneAnimation.montrer() | uneAnimation.montrer() | ||
uneAnimation.cacher() | uneAnimation.cacher() | ||
Ligne 65: | Ligne 64: | ||
* Ajouter une image : | * Ajouter une image : | ||
- | <code tangara> | + | <code declick> |
uneAnimation.ajouterImage("fichier.png") | uneAnimation.ajouterImage("fichier.png") | ||
</code> | </code> | ||
Ligne 71: | Ligne 70: | ||
* Ajouter une image en l'assignant à un ensemble d'images : | * Ajouter une image en l'assignant à un ensemble d'images : | ||
- | <code tangara> | + | <code declick> |
uneAnimation.ajouterImage("fichier.png", "ensemble") | uneAnimation.ajouterImage("fichier.png", "ensemble") | ||
</code> | </code> | ||
Ligne 77: | Ligne 76: | ||
* Supprimer une des images : | * Supprimer une des images : | ||
- | <code tangara> | + | <code declick> |
uneAnimation.supprimerImage("fichier.png") | uneAnimation.supprimerImage("fichier.png") | ||
</code> | </code> | ||
Ligne 83: | Ligne 82: | ||
* Supprimer les images d'un ensemble d'images : | * Supprimer les images d'un ensemble d'images : | ||
- | <code tangara> | + | <code declick> |
uneAnimation.supprimerImages("ensemble") | uneAnimation.supprimerImages("ensemble") | ||
</code> | </code> | ||
Ligne 90: | Ligne 89: | ||
* Afficher une des images : | * Afficher une des images : | ||
- | <code tangara> | + | <code declick> |
uneAnimation.afficherImage("fichier.png") | uneAnimation.afficherImage("fichier.png") | ||
</code> | </code> | ||
Ligne 98: | Ligne 97: | ||
* Afficher l’image suivante / l'image précédente : | * Afficher l’image suivante / l'image précédente : | ||
- | <code tangara> | + | <code declick> |
uneAnimation.afficherImageSuivante() | uneAnimation.afficherImageSuivante() | ||
uneAnimation.afficherImagePrécédente() | uneAnimation.afficherImagePrécédente() | ||
Ligne 105: | Ligne 104: | ||
* Afficher l’image suivante / l'image précédente d'un ensemble d'images : | * Afficher l’image suivante / l'image précédente d'un ensemble d'images : | ||
- | <code tangara> | + | <code declick> |
uneAnimation.afficherImageSuivante("ensemble") | uneAnimation.afficherImageSuivante("ensemble") | ||
uneAnimation.afficherImagePrécédente("ensemble") | uneAnimation.afficherImagePrécédente("ensemble") | ||
Ligne 131: | Ligne 130: | ||
* Rendre une couleur transparente : | * Rendre une couleur transparente : | ||
- | <code tangara> | + | <code declick> |
uneAnimation.rendreTransparent("couleur") | uneAnimation.rendreTransparent("couleur") | ||
</code> | </code> | ||
- | {{couleurs.png}} | + | {{ :objets:couleurs.png |}} |
/* | /* | ||
Ligne 151: | Ligne 150: | ||
* Faire bouger l’Animation : | * Faire bouger l’Animation : | ||
- | <code tangara> | + | <code declick> |
uneAnimation.avancer(50) | uneAnimation.avancer(50) | ||
uneAnimation.reculer(50) | uneAnimation.reculer(50) | ||
Ligne 161: | Ligne 160: | ||
* Faire bouger l’Animation sans s’arrêter : | * Faire bouger l’Animation sans s’arrêter : | ||
- | <code tangara> | + | <code declick> |
uneAnimation.avancer() | uneAnimation.avancer() | ||
uneAnimation.reculer() | uneAnimation.reculer() | ||
Ligne 170: | Ligne 169: | ||
ou | ou | ||
- | <code tangara> | + | <code declick> |
uneAnimation.avancerToujours() | uneAnimation.avancerToujours() | ||
uneAnimation.reculerToujours() | uneAnimation.reculerToujours() | ||
Ligne 179: | Ligne 178: | ||
* Arrêter l’Animation : | * Arrêter l’Animation : | ||
- | <code tangara> | + | <code declick> |
uneAnimation.arrêter() | uneAnimation.arrêter() | ||
</code> | </code> | ||
Ligne 195: | Ligne 194: | ||
* Changer la vitesse : | * Changer la vitesse : | ||
- | <code tangara> | + | <code declick> |
uneAnimation.définirVitesse(100) | uneAnimation.définirVitesse(100) | ||
</code> | </code> | ||
Ligne 225: | Ligne 224: | ||
* Supprimer l’objet Animation : | * Supprimer l’objet Animation : | ||
- | <code tangara> | + | <code declick> |
uneAnimation.supprimer() | uneAnimation.supprimer() | ||
</code> | </code> | ||
+ | /* | ||
=== Rotations === | === Rotations === | ||
* tourner | * tourner | ||
{{ :creer:sans_titre.gif?nolink |}} | {{ :creer:sans_titre.gif?nolink |}} | ||
+ | */ | ||
+ | |||
+ | |||
===== Gestion des événements ===== | ===== Gestion des événements ===== | ||
Ligne 257: | Ligne 260: | ||
* Pour chaque collision, on peut dire à l'objet Animation d'exécuter des commandes : | * Pour chaque collision, on peut dire à l'objet Animation d'exécuter des commandes : | ||
- | <code tangara> | + | <code declick> |
uneAnimation.siCollision("commande") | uneAnimation.siCollision("commande") | ||
</code> | </code> | ||
Ligne 263: | Ligne 266: | ||
* On peut dire à l'objet Animation de n'exécuter des commandes que s'il rencontre un objet particulier, grâce à l'action : | * On peut dire à l'objet Animation de n'exécuter des commandes que s'il rencontre un objet particulier, grâce à l'action : | ||
- | <code tangara> | + | <code declick> |
uneAnimation.siCollision("commande", objet) | uneAnimation.siCollision("commande", objet) | ||
</code> | </code> | ||
ou | ou | ||
- | <code tangara> | + | <code declick> |
uneAnimation.siCollisionAvec(objet, "commande") | uneAnimation.siCollisionAvec(objet, "commande") | ||
</code> | </code> | ||
Ligne 273: | Ligne 276: | ||
* On peut également dire à l'objet Animation de n'exécuter des commandes que s'il rencontre une catégorie d'Animations : | * On peut également dire à l'objet Animation de n'exécuter des commandes que s'il rencontre une catégorie d'Animations : | ||
- | <code tangara> | + | <code declick> |
uneAnimation.siCollision("commande", "catégorie") | uneAnimation.siCollision("commande", "catégorie") | ||
</code> | </code> | ||
ou | ou | ||
- | <code tangara> | + | <code declick> |
uneAnimation.siCollisionAvec("catégorie", "commande") | uneAnimation.siCollisionAvec("catégorie", "commande") | ||
</code> | </code> | ||
Ligne 283: | Ligne 286: | ||
* Définir la catégorie d'une Animation : | * Définir la catégorie d'une Animation : | ||
- | <code tangara> | + | <code declick> |
uneAnimation.définirCatégorie("catégorie") | uneAnimation.définirCatégorie("catégorie") | ||
</code> | </code> | ||
Ligne 289: | Ligne 292: | ||
Si on fait plusieurs fois appel à une des actions ci-dessus, les commandes s'ajoutent. Par exemple : | Si on fait plusieurs fois appel à une des actions ci-dessus, les commandes s'ajoutent. Par exemple : | ||
- | <code tangara> | + | <code declick> |
uneAnimation.siCollision("commande1") | uneAnimation.siCollision("commande1") | ||
uneAnimation.siCollision("commande2") | uneAnimation.siCollision("commande2") | ||
Ligne 298: | Ligne 301: | ||
* Désactiver / Réactiver la détection des collisions : | * Désactiver / Réactiver la détection des collisions : | ||
- | <code tangara> | + | <code declick> |
uneAnimation.surveillerCollisions(false) | uneAnimation.surveillerCollisions(false) | ||
uneAnimation.surveillerCollisions(true) | uneAnimation.surveillerCollisions(true) |