Outils pour utilisateurs

Outils du site


issue153:inkscape

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
Prochaine révisionLes deux révisions suivantes
issue153:inkscape [2020/02/08 07:59] d52frissue153:inkscape [2020/02/09 09:02] d52fr
Ligne 80: Ligne 80:
  
 At last we have our object rotating, skewing and scaling, all while centered in the browser window – though a static screenshot doesn’t really do it justice. At last we have our object rotating, skewing and scaling, all while centered in the browser window – though a static screenshot doesn’t really do it justice.
 +
 I’m going to finish this month with a couple of exercises for you to try, which build on the animation we’ve created over these previous few articles:** I’m going to finish this month with a couple of exercises for you to try, which build on the animation we’ve created over these previous few articles:**
 +
 +Comme pour les fonctions skew, nous voulons les animer entre un minimum et un maxium, puis revenir - contrairement au mouvment dans un seul sens que nous avions avec rotate(). Par conséquen, nous avons besoin de quelques blocs de codes pour calculer la valeur correcte à tout instant, en modifiant la direction après chaque période. Ci-dssous, voici le code pour la mise à l'échelle sur l'axe des x ; comparez-le au bloc équivalent du mois dernier pour skewX() et vous devriez pouvir reproduire vous-même le code pour la mise à l'échelle sur l'axe des y.
 +
 +Et, bien sûr, nous avons besoin d'ajouter notre fonction scale() et deux nouveaux paramètres à l'attribut transform (en haut à droite).
 +
 +Enfin, nous avons un objet qui tourne, se déforme et change d'échelle, tout cela centré dans la fenêtre du navigateur - bien qu'une copie d'écran, statique, ne lui rende pas vraiment justice.
 +
 +Je terminerai ce mois avec quelques exercices que vous essaierez, qui s'ajoutent à l'animation que nous avons créé pendant ces quelques derniers mois.
  
 **• Our final transform attribute has a fixed translate() function to position the square in the middle of the screen. Why not add another two sets of parameters to also animate the x and y position, causing the square to move around the window a little as well. Setting min and max values either side of 50 means you can replace the hard-coded coordinates in the existing translate(). Or you could have a negative min and positive max, then use the values in a second translate() function – but be careful of the ordering! **• Our final transform attribute has a fixed translate() function to position the square in the middle of the screen. Why not add another two sets of parameters to also animate the x and y position, causing the square to move around the window a little as well. Setting min and max values either side of 50 means you can replace the hard-coded coordinates in the existing translate(). Or you could have a negative min and positive max, then use the values in a second translate() function – but be careful of the ordering!
 • Try replacing the contents of the group with something else. It could be a more interesting single shape, such as a star or more faceted polygon, but it could also be any other Inkscape drawing – with multiple shapes and colors. Simply replacing the <rect> with an <image> element makes for an interesting effect, reminiscent of the kind of thing that required a Hollywood budget back in the 1980s.** • Try replacing the contents of the group with something else. It could be a more interesting single shape, such as a star or more faceted polygon, but it could also be any other Inkscape drawing – with multiple shapes and colors. Simply replacing the <rect> with an <image> element makes for an interesting effect, reminiscent of the kind of thing that required a Hollywood budget back in the 1980s.**
 +
 +••Notre attribut transform final a une fonction translate() fixe pour positionner le carré au milieu de l'écran. Pourquoi ne pas ajouter aussi un autre ensemble de paramètres pour animer la position en x et en y, entraînant un peu un mouvement du carré dans la fenêtre. Le paramétrage de valeurs min et max de part et d'autre des 50 vous permet de remplacer les coordonnées codées en dur dans l'actuelle translate(). Ou, vous pouvez avoir une valeur mi négative et un max positif, puis utiliser les valeurs dans une seconde fonction translate() - mais attention à l'ordre !
 +••Essayez de remplacer le contenu du groupe avec quelque chose d'autre. Ce peut être une forme unique plus intéressante, telle qu'étoile ou un polygone à plus de faces, mais ce peut être aussi par n'importe quel dessin d'Inkscape - avec de nombreuses formes et couleurs. Le simple remplacement du <rect> par un élément <image> donne un effet intéressant, rappelant le genre de chose qui nécessitait un budget hollywwodien dans les années 80.
  
 **The most important thing to remember is that this animation code – and the JS that we used previously in this series – are just examples to get you going. There’s no reason why you can’t create an animation that messes with the transform attribute whilst at the same time altering the fill and stroke, or manipulating the “d” attribute of a <path> in order to change the shape being drawn. With an understanding of how to change attributes and properties from JS you can create interactive or animated SVG images that go way beyond the frame-based limitations of an animated GIF. It’s a bit of a cliché, but the only real limit is your own imagination.** **The most important thing to remember is that this animation code – and the JS that we used previously in this series – are just examples to get you going. There’s no reason why you can’t create an animation that messes with the transform attribute whilst at the same time altering the fill and stroke, or manipulating the “d” attribute of a <path> in order to change the shape being drawn. With an understanding of how to change attributes and properties from JS you can create interactive or animated SVG images that go way beyond the frame-based limitations of an animated GIF. It’s a bit of a cliché, but the only real limit is your own imagination.**
 +
 +Ma chose la plus important à mémoriser est que le code de cette animation - et le JS que nous avons utilisé précédemment dans cette série - ne sont que des exemples pour que vous alliez plus loin. Il n'y a aucune raison que vous ne puissiez pas créer une animation qui est mixée avec l'attribut transform, tout en ayant dans le même temps une modification du remplissage et du contour, ou en manipulant l'attribut « d » d'un <path> de façon à changer la forme qui se dessine. En comprenant comment modifier les attributs et les propriétés dans le JS, vous pouvez créer des images SVG interactives ou animées qui dépassent les limitations des animations GIF, basées sur des trames. C'est un peu un cliché, mais la seule vraie limite, c'est celle de votre imagination.
  
  
issue153/inkscape.txt · Dernière modification : 2020/02/10 10:43 de auntiee