lang:android:animation
Différences
Ci-dessous, les différences entre deux révisions de la page.
Prochaine révision | Révision précédente | ||
lang:android:animation [2023/05/29 10:18] – Création avec "Animation" root | lang:android:animation [2023/08/23 11:04] (Version actuelle) – Ajout de "SurfaceView" root | ||
---|---|---|---|
Ligne 34: | Ligne 34: | ||
+ Permet d' | + Permet d' | ||
+ | |||
+ | + Peuvent s' | ||
+ | |||
+ | - Ne peut s' | ||
- Nécessite plus de ressource. | - Nécessite plus de ressource. | ||
Ligne 70: | Ligne 74: | ||
</ | </ | ||
- | ====Exemple==== | + | ====Exemples==== |
<code java> | <code java> | ||
Ligne 89: | Ligne 93: | ||
</ | </ | ||
+ | Ici, animation est un '' | ||
+ | |||
+ | =====Animator===== | ||
+ | |||
+ | ====Ressources==== | ||
+ | |||
+ | * Plusieurs animations simples à la suite | ||
+ | |||
+ | <code xml> | ||
+ | <?xml version=" | ||
+ | <set xmlns: | ||
+ | android: | ||
+ | <!-- wait --> | ||
+ | < | ||
+ | < | ||
+ | android: | ||
+ | android: | ||
+ | android: | ||
+ | android: | ||
+ | </ | ||
+ | < | ||
+ | android: | ||
+ | android: | ||
+ | < | ||
+ | android: | ||
+ | android: | ||
+ | android: | ||
+ | < | ||
+ | android: | ||
+ | android: | ||
+ | android: | ||
+ | < | ||
+ | android: | ||
+ | android: | ||
+ | android: | ||
+ | android: | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | * Faire zoomer une image svg | ||
+ | |||
+ | Attention, il faut que les deux images svg soient compatibles (mêmes nombres de points). | ||
+ | |||
+ | <code xml> | ||
+ | <?xml version=" | ||
+ | <set xmlns: | ||
+ | < | ||
+ | android: | ||
+ | android: | ||
+ | android: | ||
+ | android: | ||
+ | android: | ||
+ | android: | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | * Image animée | ||
+ | |||
+ | L' | ||
+ | |||
+ | <code xml> | ||
+ | <?xml version=" | ||
+ | <set xmlns: | ||
+ | < | ||
+ | android: | ||
+ | android: | ||
+ | android: | ||
+ | android: | ||
+ | android: | ||
+ | android: | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | L' | ||
+ | |||
+ | <code xml> | ||
+ | <?xml version=" | ||
+ | <vector xmlns: | ||
+ | android: | ||
+ | android: | ||
+ | android: | ||
+ | android: | ||
+ | |||
+ | <path | ||
+ | android: | ||
+ | android: | ||
+ | android: | ||
+ | android: | ||
+ | |||
+ | </ | ||
+ | </ | ||
+ | |||
+ | L' | ||
+ | |||
+ | <code xml> | ||
+ | <?xml version=" | ||
+ | < | ||
+ | android: | ||
+ | |||
+ | <target | ||
+ | android: | ||
+ | android: | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | ====Exemples==== | ||
+ | |||
+ | * Minimaliste | ||
+ | |||
+ | <code java> | ||
+ | Animator animator = AnimatorInflater.loadAnimator(context, | ||
+ | Button button = myView.findViewById(R.id.button); | ||
+ | animator.setTarget(button); | ||
+ | </ | ||
+ | |||
+ | * Modifier une valeur d'un champ. | ||
+ | |||
+ | Il n' | ||
+ | |||
+ | <code java> | ||
+ | ((ValueAnimator)((AnimatorSet) animator).getChildAnimations().get(0)).getValues()[0].setFloatValues(0.1f); | ||
+ | </ | ||
+ | |||
+ | * Piloter plusieurs animations | ||
+ | |||
+ | <code java> | ||
+ | AnimatorSet animatorSet = new AnimatorSet(); | ||
+ | animatorSet.playTogether(anim1, | ||
+ | animatorSet.addListener(new AnimatorListenerAdapter() { | ||
+ | @Override | ||
+ | public void onAnimationEnd(Animator animation) { | ||
+ | callback.run(); | ||
+ | } | ||
+ | }); | ||
+ | animatorSet.start(); | ||
+ | </ | ||
+ | |||
+ | Attention, si une animation a un '' | ||
+ | |||
+ | < | ||
+ | |||
+ | =====Limitations===== | ||
+ | |||
+ | * SurfaceView / GLSurfaceView | ||
+ | |||
+ | Il n'est pas possible d' | ||
+ | |||
+ | La solution est d' | ||
+ | |||
+ | [[https:// |
lang/android/animation.1685348316.txt.gz · Dernière modification : 2023/05/29 10:18 de root