issue154:inkscape
Différences
Ci-dessous, les différences entre deux révisions de la page.
Prochaine révision | Révision précédente | ||
issue154:inkscape [2020/03/01 17:20] – créée auntiee | issue154:inkscape [2020/03/09 13:43] (Version actuelle) – andre_domenech | ||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
- | After the JavaScript detour of the past few months, it’s time to head back into the realms of pure Inkscape. Before we dive headlong into the next topic, however, I’m going to spend this month and next tidying up a few loose ends and updating you on some recent Inkscape news items. | + | **After the JavaScript detour of the past few months, it’s time to head back into the realms of pure Inkscape. Before we dive headlong into the next topic, however, I’m going to spend this month and next tidying up a few loose ends and updating you on some recent Inkscape news items. |
- | To begin with, let’s finish up with a little more polish on the JavaScript-based transform animation we’ve been building up through the last few articles. If you followed along, you’ll have ended up with four blocks of code that all look very similar, for each of skewX, skewY, scaleX and scaleY (top right). | + | To begin with, let’s finish up with a little more polish on the JavaScript-based transform animation we’ve been building up through the last few articles. If you followed along, you’ll have ended up with four blocks of code that all look very similar, for each of skewX, skewY, scaleX and scaleY (top right).** |
- | All that changes between them are the variable names, and the only result we use from this code is the single value we create at the end. This block is an excellent candidate for splitting out into a single function that gets called for each of the four transform parameters. Reorganising code to make it simpler, clearer, or more efficient, is referred to as “refactoring”. To refactor this code, therefore, the first step is to copy it into a function of its own, and return the value we’re interested in. We’ll add the new function to the very end of the JS file (bottom right). | + | Après le détour dans JavaScript de ces quelques derniers mois, il est temps de revenir dans le royaume du pur Inkscape. Cependant, avant de plonger dans le sujet suivant, je vais, ce mois-ci et le suivant, remettre un peu d' |
- | We’re going to use this function to replace blocks of code that deal with multiple different properties, so it makes sense to also tidy up the variable names in the function to make them more generic. By passing in the relevant duration, min, and max, from the properties – and also passing the current running time that was supplied to the parent animate() function – we can simplify it to this general purpose function | + | Pour commencer, finissons l' |
- | Now we can replace the original four blocks with something much simpler. Here’s the line to use for skewX – I’ll leave it to you to work out what to do with the others. Note that I’ve split this across multiple lines to squeeze it into a single column in this article, though in a real file I would probably put all of this in a single line of code: | + | **All that changes between them are the variable names, and the only result we use from this code is the single value we create at the end. This block is an excellent candidate for splitting out into a single function that gets called for each of the four transform parameters. Reorganising code to make it simpler, clearer, or more efficient, is referred to as “refactoring”. To refactor this code, therefore, the first step is to copy it into a function of its own, and return the value we’re interested in. We’ll add the new function to the very end of the JS file (bottom right). |
+ | |||
+ | We’re going to use this function to replace blocks of code that deal with multiple different properties, so it makes sense to also tidy up the variable names in the function to make them more generic. By passing in the relevant duration, min, and max, from the properties – and also passing the current running time that was supplied to the parent animate() function – we can simplify it to this general purpose function (below).** | ||
+ | |||
+ | Toutes les différences entre eux tiennent aux noms des variables et le seul résultat que nous tirons de ce code est la valeur unique que nous créons à la fin. Ce bloc est un excellent candidat pour un découpage en une seule fonction appelée par chacun des quatre paramètres de transformation. La réorganisation du code pour le simplifier, le clarifier et l' | ||
+ | |||
+ | Nous allons utiliser cette fonction pour remplacer les blocs de code qui ont trait aux multiples propriétés différentes ; aussi, il est logique de remettre en ordre les noms des variables dans la fonction pour les rendre plus génériques. En passant les durée, min et max adaptés depuis les propriétés - et en passant aussi l' | ||
+ | |||
+ | **Now we can replace the original four blocks with something much simpler. Here’s the line to use for skewX – I’ll leave it to you to work out what to do with the others. Note that I’ve split this across multiple lines to squeeze it into a single column in this article, though in a real file I would probably put all of this in a single line of code: | ||
const skewXAmount = | const skewXAmount = | ||
Ligne 17: | Ligne 25: | ||
); | ); | ||
- | It almost goes without saying, but once you’ve replaced all four blocks of code you should save and reload your page. If everything was correct you should see no change in the animation. | + | It almost goes without saying, but once you’ve replaced all four blocks of code you should save and reload your page. If everything was correct you should see no change in the animation.** |
- | You should, however, be able to see at a glance how much shorter and simpler this change makes the animate() function. It’s gone from being a mathematically heavy chunk of code to a much simpler series of lines that just set up some constants, applies them to the transform() attribute, then calls itself for the next iteration. If you dive further into coding you should always try to keep an eye out for repeated blocks of code that can be refactored into a single function. | + | Maintenant, nous pouvons remplacer les quatre blocs d' |
- | With that, I’m going to draw a line under this part of the series – at least metaphorically speaking, although you should now have enough understanding of SVG and JavaScript to be able to draw a literal line, if you wish. | + | const skewXAmount = |
+ | getAnimAmount( | ||
+ | props.skewXDuration, | ||
+ | props.skewXMin, | ||
+ | props.skewXMax, | ||
+ | runningTime | ||
+ | ); | ||
+ | |||
+ | Ça va presque sans le dire, mais une fois que vous avez remplacé les quatre blocs de code, vous devrez sauvegarder et recharger votre page. Si tout est correct, vous ne devriez voir aucun changement dans l' | ||
+ | |||
+ | **You should, however, be able to see at a glance how much shorter and simpler this change makes the animate() function. It’s gone from being a mathematically heavy chunk of code to a much simpler series of lines that just set up some constants, applies them to the transform() attribute, then calls itself for the next iteration. If you dive further into coding you should always try to keep an eye out for repeated blocks of code that can be refactored into a single function. | ||
+ | |||
+ | With that, I’m going to draw a line under this part of the series – at least metaphorically speaking, although you should now have enough understanding of SVG and JavaScript to be able to draw a literal line, if you wish.** | ||
+ | |||
+ | Cependant, vous devriez vous apercevoir au premier coup d'œil que la fonction animate() est beaucoup plus simple et plus courte grâce à cette modification. Nous sommes passé d'un paquet de code mathématiquement pesant à une série de lignes beaucoup plus simples qui paramètrent juste quelques constantes, les appliquent à un attribut transform(), | ||
+ | |||
+ | Avec ça, je vais tirer une ligne sous cette partie de la série - au moins sous forme de métaphore, bien que vous ayez maintenant une connaissance suffisante de SVG et JavaScript pour être capable d'en tirer réellement une, si vous le souhaitez. | ||
- | Forum News | + | **Forum News |
I’m sad to announce that the long-standing semi-official forum for Inkscape, “inkscapeforum.com”, | I’m sad to announce that the long-standing semi-official forum for Inkscape, “inkscapeforum.com”, | ||
- | Fortunately the lack of communication from the admin acted as a warning, and an officially-official forum was already up and running when the old one vanished – thanks mostly to the sterling efforts of Martin ‘Doctormo’ Owens, a long-standing contributor to the Inkscape project. With its main ‘competitor’ having self-destructed, | + | Fortunately the lack of communication from the admin acted as a warning, and an officially-official forum was already up and running when the old one vanished – thanks mostly to the sterling efforts of Martin ‘Doctormo’ Owens, a long-standing contributor to the Inkscape project. With its main ‘competitor’ having self-destructed, |
- | But what of the many years’ worth of hints, tips, tutorials, questions and answers that had accrued on the old forum? Thankfully it’s not all lost: the Inkscape website is hosting a read-only backup which mostly works, though some threads don’t seem to behave quite as they should. https:// | + | Nouvelles du Forum |
- | Alternatively the Wayback Machine at the Internet Archive site also has a snapshot of the old forum though, again, it’s not perfect. https://web.archive.org/ | + | J'ai le regret d' |
- | Hopefully between these two resources the bulk of the useful content from the site has been preserved. | + | Par chance, le manque de communication de l' |
- | One very useful page from the old forum which hasn’t been completely captured is the index of my Full Circle Magazine articles. The last snapshot | + | **But what of the many years’ worth of hints, tips, tutorials, questions and answers that had accrued |
- | Video Tutorials | + | Alternatively the Wayback Machine at the Internet Archive site also has a snapshot of the old forum though, again, it’s not perfect. https:// |
+ | |||
+ | Mais que sont devenues toutes ces années de conseils, astuces, tutoriels, questions et réponses qui ont alimenté l' | ||
+ | |||
+ | Comme autre solution, Wayback Machine de Internet Archive contient aussi un instantané de l' | ||
+ | |||
+ | **Hopefully between these two resources the bulk of the useful content from the site has been preserved. | ||
+ | |||
+ | One very useful page from the old forum which hasn’t been completely captured is the index of my Full Circle Magazine articles. The last snapshot on the Wayback Machine dates to 2017 and, although the page on the Inkscape site is more up-to-date, I’ve nevertheless copied the content to my own site, where I can continue to update it as new articles are published. You can find it here: http:// | ||
+ | |||
+ | On peut espérer qu' | ||
+ | |||
+ | L' | ||
+ | |||
+ | **Video Tutorials | ||
When I was first starting to learn how to use Inkscape, a valuable resource was a series of tutorial videos created by ‘Heathenx’ and Richard Querin. Unfortunately, | When I was first starting to learn how to use Inkscape, a valuable resource was a series of tutorial videos created by ‘Heathenx’ and Richard Querin. Unfortunately, | ||
+ | |||
+ | https:// | ||
+ | |||
+ | Tutoriels en vidéo | ||
+ | |||
+ | Quand je commencais à apprendre comment utiliser Inkscape, la série des tutoriels vidéos créés par « Heathenx » et Richard Querin était une ressource de qualité. Malheureusement, | ||
https:// | https:// | ||
- | A Shameless Plug | + | **A Shameless Plug |
- | While we’re on the topic of Inkscape resources I’ve posted online, I’m going to take this opportunity for a spot of blatant self-promotion. Long-term readers of this column (or those who read the byline at the end of an article) will know that I create comics and cartoon strips using Inkscape (with the help of a far more artistically talented friend). We’ve been working together in our spare time for over 25 years now, but it’s the last decade that has been the most interesting as far as this column is concerned. During that time, we’ve used Inkscape in the creation of over 250 strips which can be freely viewed on our website. To help encourage new Inkscape users, we’ve made the vast majority of our source files available for download as well, so you can see how we put things together or modify the cartoons to suit your own needs. | + | While we’re on the topic of Inkscape resources I’ve posted online, I’m going to take this opportunity for a spot of blatant self-promotion. Long-term readers of this column (or those who read the byline at the end of an article) will know that I create comics and cartoon strips using Inkscape (with the help of a far more artistically talented friend). We’ve been working together in our spare time for over 25 years now, but it’s the last decade that has been the most interesting as far as this column is concerned. During that time, we’ve used Inkscape in the creation of over 250 strips which can be freely viewed on our website. To help encourage new Inkscape users, we’ve made the vast majority of our source files available for download as well, so you can see how we put things together or modify the cartoons to suit your own needs.** |
- | Given that you’re reading a Linux magazine, I’d like to draw particular attention to our “Elvie” comic strip. This appeared in every edition of the much-missed Linux Voice magazine, and has continued every month in Linux Pro Magazine (just “Linux Magazine” outside North America). Thanks to the kind generosity of the editors and publishers, we’ve been able to release these strips under a very liberal license (Creative Commons BY-SA), and have a Git repository with our Inkscape and MyPaint source files. We’ve even gone so far as to use fonts that are under liberal licenses, so that every single part of these cartoons is as free as possible. | + | Une publicité éhontée |
+ | |||
+ | Pendant que nous sommes dans le chapitre des ressources d' | ||
+ | |||
+ | |||
+ | **Given that you’re reading a Linux magazine, I’d like to draw particular attention to our “Elvie” comic strip. This appeared in every edition of the much-missed Linux Voice magazine, and has continued every month in Linux Pro Magazine (just “Linux Magazine” outside North America). Thanks to the kind generosity of the editors and publishers, we’ve been able to release these strips under a very liberal license (Creative Commons BY-SA), and have a Git repository with our Inkscape and MyPaint source files. We’ve even gone so far as to use fonts that are under liberal licenses, so that every single part of these cartoons is as free as possible. | ||
Aside from Elvie, our other cartoons have appeared in magazines and newspapers, and even in an exhibition at the National Media Museum in the UK. They can all be viewed and downloaded from our website: | Aside from Elvie, our other cartoons have appeared in magazines and newspapers, and even in an exhibition at the National Media Museum in the UK. They can all be viewed and downloaded from our website: | ||
+ | |||
+ | http:// | ||
+ | |||
+ | Étant donné que vous lisez un magazine sur Linux, je voudrais surtout attirer votre attention sur notre bande dessinée « Elvie ». Elle apparaissait dans chaque édition du très regretté magazine Linux Voice et continue mensuellement dans Linux Pro Magazine (simplement « Linux Magazine » en dehors de l' | ||
+ | |||
+ | À part Elvie, nos autres bandes dessinées sont apparues dans des magazines et des journaux, et même dans une exposition au National Media Museum au Royaume-Uni. Elles peuvent toutes être vues et téléchargées sur notre site Web : | ||
http:// | http:// | ||
- | If you want to support us in the work we do to promote Inkscape – or if you want to help in our goal to raise enough funds to relicense some of our earlier cartoons as BY-SA – we also have the near-obligatory Patreon page: https:// | + | **If you want to support us in the work we do to promote Inkscape – or if you want to help in our goal to raise enough funds to relicense some of our earlier cartoons as BY-SA – we also have the near-obligatory Patreon page: https:// |
Inkscape v1.0 Beta | Inkscape v1.0 Beta | ||
- | In classic ‘saving the best for last’ tradition, the final item in this hodgepodge of an article is the announcement of the long awaited release of Inkscape v1.0. Well, nearly. | + | In classic ‘saving the best for last’ tradition, the final item in this hodgepodge of an article is the announcement of the long awaited release of Inkscape v1.0. Well, nearly.** |
- | At the time of writing, the second beta of v1.0 has been released, and is available via the download link on the Inkscape website (https:// | + | Si vous voulez nous soutenir dans le travail que nous faisons pour promouvoir Inkscape - ou si vous voulez nous aider à lever suffisamment de fonds pour passer nos bandes dessinées les plus anciennes sous une license comme BY-SA - nous avons aussi un page Patreon quasi obligatoire : |
+ | |||
+ | https:// | ||
+ | |||
+ | Inkscape v1.0 Beta | ||
+ | |||
+ | Dans la tradition classique du « garder le meilleur pour la fin »; le sujet final de cet article méli-mélo est l' | ||
+ | |||
+ | **At the time of writing, the second beta of v1.0 has been released, and is available via the download link on the Inkscape website (https:// | ||
+ | |||
+ | https:// | ||
+ | |||
+ | Inkscape v1.0 Bêta | ||
+ | |||
+ | Au moment où j' | ||
https:// | https:// | ||
- | A fond farewell… until next month | + | **A fond farewell… until next month |
I had originally intended for this to be my last Inkscape column, having covered just about every feature the program has to offer during the past 8 years. With the imminent arrival of v1.0, however, I’ve decided to stick around to introduce the new features and important changes. Initially this coverage will necessarily be based on the beta versions, but it’s unlikely that there will be significant UI changes before the full release so I’m sure anything I write will still be relevant in a few months’ time. | I had originally intended for this to be my last Inkscape column, having covered just about every feature the program has to offer during the past 8 years. With the imminent arrival of v1.0, however, I’ve decided to stick around to introduce the new features and important changes. Initially this coverage will necessarily be based on the beta versions, but it’s unlikely that there will be significant UI changes before the full release so I’m sure anything I write will still be relevant in a few months’ time. | ||
- | Next month, I’ll be detailing a couple of minor features in Inkscape that have managed to slip through the cracks in previous instalments, | + | Next month, I’ll be detailing a couple of minor features in Inkscape that have managed to slip through the cracks in previous instalments, |
+ | |||
+ | Un grand au-revoir... jusqu' | ||
+ | |||
+ | J' | ||
+ | |||
+ | Le mois prochain, je détaillerai quelques modifications mineures dans Inkscape qui nous ont échappées dans les numéros précédents, |
issue154/inkscape.1583079615.txt.gz · Dernière modification : 2020/03/01 17:20 de auntiee