Ceci est une ancienne révision du document !
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).
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).
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 =
getAnimAmount( props.skewXDuration, props.skewXMin, props.skewXMax, runningTime );
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.
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.
Forum News
I’m sad to announce that the long-standing semi-official forum for Inkscape, “inkscapeforum.com”, is no longer around. It hasn’t been actively supported by its administrator for a number of years, but had still been the go-to place for the English-speaking Inkscape community. Despite the efforts of a number of users and developers – myself included – to transfer the forum into the stewardship of the Inkscape project, the admin did not provide either a backup of the database, nor enough access for us to obtain it ourselves. A couple of months ago the site simply disappeared, and has not returned.
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, the official forum has grown in popularity, and should now be seen as the best place to go if you have an Inkscape question, or just want to show off your Inkscape-created images. The new forum is linked from the main Inkscape website, or you can access it directly at the following address: https://inkscape.org/forums/
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://alpha.inkscape.org/vectors/www.inkscapeforum.com/
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/web/20190910200439/http://www.inkscapeforum.com/
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://www.peppertop.com/blog/?p=1563
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, their website has long-since disappeared, but I was able to get a current email address for Heathenx and contacted him about re-posting the videos online. I’m delighted to report that he was extremely helpful, and happy for them to be uploaded to Youtube. There are over a hundred videos in total, most of which are still relevant to the current Inkscape release. I uploaded them over a number of months, adding my own notes to clarify any tweaks or changes that are required for recent Inkscape versions. I urge you to take a look at them, as they provide a great example of the many and varied effects that can be produced with Inkscape if you have a little artistic flair.
https://www.youtube.com/c/PeppertopComics
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.
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:
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://www.patreon.com/peppertop
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.
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://inkscape.org). There’s no definite date for the final release, and I don’t know if there will be any other beta releases in the meantime, but what’s there already feels pretty stable and polished. I encourage readers to give the beta a try, and report any issues they find to the Inkscape bugtracker. Note that the project is no longer using Launchpad to track issues, having switched to GitLab some time ago. If you do want to file a bug report, or view those that have already been filed, there’s a page on the Inkscape site that will redirect you to the correct location:
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.
Next month, I’ll be detailing a couple of minor features in Inkscape that have managed to slip through the cracks in previous instalments, to fully ‘clear the decks’ before diving into the exciting new features of v1.0.