Hacker News new | past | comments | ask | show | jobs | submit login
Vivus, bringing your SVGs to life (maxwellito.github.io)
291 points by plurby on Feb 25, 2015 | hide | past | favorite | 34 comments



> They all start and finish at the same time, hence the name `async`.

Since the "async" animation is the only one that is synchronous, it seems a bit misnamed!


Yes, surely the "delay" one should be Asynchronous, the "async" one should be Synchronous and "one by one" should be Sequential.


async and sync aren't even the correct terms here. Parallel, Serial, and Staggered seem more apropos.


Maybe instead of Delayed, Async, OneByOne, have: Staggered, Together, OneByOne

Keep the names friendly and not too technical.


I felt bad that my impulse coming from that page was to come here and complain about the use of (and poor definition of) 'async.' Imagine my relief when it was already tackled!

The good news is this is really quite beautiful and I like the fact that - unlike other monolithic js animation libraries that do similar things like Raphael - it's super slim.


Is it called "async" because they're All Synchronised? Bit of a long shot, but it's the most logical thing I could think of...!


Sorry, I can't use software that isn't "made with love". Consider revising. You might also consider having your code snippets hosted with ❤.

Kidding of course -- the love that went into this is self-evident.


I initially misread the footed as "Make love with a keyboard" :P


Speaking of which... where the hell did that "made with ❤" meme started anyway?


This technique reminds me (aesthetically) a lot of the drawing of RIP images [1], though that only happened because they took forever to download :)

[1] http://en.wikipedia.org/wiki/Remote_Imaging_Protocol


Oh WOW, it's been forever since I thought about RIP. Memories of graphics coming across at 2400 baud...


Yep! RIP and even animated ANSI opened up some cool animations when it was exploited to make things like simulated motion and stuff like that, the good old days!


The strokeDashOffset trick is a great hack.

I used it to animate a route on a US map. http://live.watsonswander.com/


You can see an great example of Vivus in use at Estée Lauder http://www.esteelauder.com/boutiques/the-classics/index.tmpl



They look good. However, clock8.svg is broken in Chrome 40 on OSX 10.10.


Had to do some similar animations recently. Wrote up a super simple function that can be combined with any easing function, and where you're in full control of the animation progress.

It's not specific to SVGs and doesn't do very much on it's own. Thankfully, you can use off-the-shelf easing functions and higher-order functions to have time/frame/whatever-based animation progress (e.g. as an advanced example, i actually utilised the accelerometer as input for animation progress)

Check app.js for example of fading element's opacity and animating an SVG path https://gist.github.com/WickyNilliams/af30ad9b1557f894efab


This looks great. I like how it normalises the shapes into paths too. But are there any tools to do this for the command line that "simplify" SVGs so your library won't have to worry about this?


It seems like it wouldn't be a Herculean task to take pathformer.js and turn it into a standalone CLI utility: https://github.com/maxwellito/vivus/blob/master/src/pathform...


Quick and dirty, but this does the trick I think: https://gist.github.com/benshimmin/4bd6bb9cb8733a6acba7


Yes, SVGO is really good at this and other kinds of SVG optimisation and manipulation: https://github.com/svg/svgo/


This is great, though none of the examples have any fills - just stroked paths.

From what I understand, this would not work with filled paths (or it would only animate a stroke, not the fill), right?


It's a hack with path strokes to make it appear as if being drawn, so yes it won't work with fills. Although if you approximate the fill with a zig-zagged stroke you could get a good impression of an animated, drawn fill as well with this.


Really nice and easy to use! I have added an example to the Paths.js demo where I show how it can integrate with Vivus to provide animation of the generated paths

http://andreaferretti.github.io/paths-js-react-demo/


This looks awesome, but as someone who never uses SVGs in practice: what kind of gotcha's should I look out for when using this? I'm thinking incompatible SVGs, performance issues due to abuse, that kind of thing.


I feel like this has been posted before--I recognize the aperture demos--but I can't find the thread. Any ideas? Did this change names?


this could potentially be a really cool alternative to a 'spinner' on initial load of an app.


Coursera does something like this IIRC


I see some strange "dots" floating before the start of the animation, with firefox


https://github.com/maxwellito/vivus#firefox For Firefox users, you might encounter some glitches depending on your SVG and browser version. On versions before 36, there is a problem to retrieve path length via getTotalLength method.


Is this going to be cool if I use it with Rickshaw? Because it seems like it might.


This is super cool! Good work!


Awesome


Oh that's nice.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: