For the last few months I’ve primarily been tinkering with different chrome extensions/plugins. From extensions that simply darken your webpage, to extensions that override the new tab and inject in it a ton of websites, to create sort of a workspace. You can check my latest work here https://chrome.google.com/webstore/search/k.ivanow
Everything that is described bellow can be done with pure canvas js codding, instead of using PixiJS. However I’ve grown quite fond of PixiJS since I have used it at work and for several side projects.
At first icons are the most boring part of any project (especially for developers like myself). However this is exactly why some minor touches in an icon can have great impact on the users. I have seen a lot of extensions for Chrome (all adblockers, Limitless, etc) that use the icon badge to display text in it (how many ads are blocked, how much time have you spent on the current webpage, etc).
However earlier today I thought that I haven’t seen any extension, that animates its icon. I searched for a while and saw several StackOverflow posts that explain how to animate icon, by switching between a set of images, defined in the manifest. I decided that it has to be a better way and found that chrome.browserAction.setIcon()
receives not only path to the icon, but can accept imageData as well! Hooray!!! Now, let us proceed to the main part of this article.
The thought process is straight forward and the execution is easy:
So, I created a clock class that creates and animates a clock (who would’ve guessed).
The concept is simple
Here is the end result. I use two styles for the arrows depending on the webpage the user is at.
I guess
I just came up with something that I haven’t seen done (at least so far. Feel free to correct me if I am wrong) and how to do it and decided to share it.
Something similar can be done with a large set of assets, that can be switched to simulate an animation, which is the most common approach I’ve seen while my brief research for the article.
The exact same result can be done with a simple canvas and JS code. I prefer PixiJS because I am familiar with it and it allows me to make more complex animations, if I decide to.
I hope that you found this article interesting, even if it is for the sole fact that you can just take some part of animated canvas or WebGL context and use it as an icon for chrome extension, instead of a simple png. You can even create your whole icon by simple shapes and filters or blend modes, if you have the time and desire to do so.
P.S. Check out the extension, that was the cause for the idea behind this article.