News for hackers. Stuff that matters.
Re:Using some good old obsolete HTML to create JavaScript-fr... by pcmaffey on Saturday June 23, 2018 @05:09PM (#17383464)
Highly recommend svg for animations too. Totally JS-free, self-contained files, supported by all browsers but Microsoft (can just show static svg)... Once you get the hang of the syntax and svg layout, animating is pretty straightforward.

Here's a fun 404 page I made that shows just how extensive an animation you can accomplish (let it play for > 1 minute) - https://app.astronomer.io/404

(You can open the image in a new tab and take a look at the svg code (it's --pretty printed)

Re:Using some good old obsolete HTML to create JavaScript-fr... by deergomoo on Saturday June 23, 2018 @05:32PM (#17383568)
The problem with SVG animation is it seems to be abnormally resource intensive. I noticed it on a project I worked on recently -- simply pulsing a few <circle>s larger and smaller pegged a CPU core at a constant 40% on my work machine. Indeed, opening your (very cool) 404 page shows a constant 30% CPU usage.

Fine for a 404 page which people are unlikely to stick around on, not fine for a screen that someone is going to spend a significant amount of time on.

Re:Using some good old obsolete HTML to create JavaScript-fr... by pcwalton on Saturday June 23, 2018 @09:02PM (#17384390)
I'm working on speeding this up via the Pathfinder project, for Firefox. :)
Re:Using some good old obsolete HTML to create JavaScript-fr... by tribby on Saturday June 23, 2018 @10:59PM (#17384698)
awesome - I enjoyed reading up on your work! stuff like this makes me wonder if variable fonts will become a popular method for animating certain things on the web (maybe in the context of UI kits like font awesome, ionicons, etc).

it still kind of blows my mind how quickly we all moved to abandon adobe flash once HTML became viable. I'm not a fan of the attack surface that flash presents, but in retrospect, especially thinking about the hardware I was using 15 years ago, it almost seems like advanced alien technology when contrasted with the state of vector animation on the web today.

Re:Using some good old obsolete HTML to create JavaScript-fr... by polskibus on Sunday June 24, 2018 @04:00AM (#17385520)
Do you know by any chance if support for new SVG standard will ever land?
Re:Using some good old obsolete HTML to create JavaScript-fr... by Izkata on Saturday June 23, 2018 @06:41PM (#17383842)
My Firefox jumps from about 6% to 10% on that page... Noticeable, but not nearly as bad as you're seeing.
Re:Using some good old obsolete HTML to create JavaScript-fr... by tigershark on Sunday June 24, 2018 @10:41AM (#17386733)
How many cores do you have? If you have 8 it is scarily close to 100% for a single core.
Re:Using some good old obsolete HTML to create JavaScript-fr... by dasyatidprime on Saturday June 23, 2018 @07:00PM (#17383921)
What browser/OS/hardware configuration is this? I have never observed such an effect before.
Re:Using some good old obsolete HTML to create JavaScript-fr... by antibland on Saturday June 23, 2018 @10:00PM (#17384544)
Beautiful, but it took a long time (~7 seconds) to paint when viewing it in Brave on an Android Pixel. I'm on a 4g connection. This is a lot to ask of users, for a page that ultimately tells you there's nothing to look at. I haven't experimented with skeleton loading placeholders for SVG heavy presentations, but it may be suitable here.
Re:Using some good old obsolete HTML to create JavaScript-fr... by pcmaffey on Saturday June 23, 2018 @10:24PM (#17384612)
Interesting, will have to look into that... the file itself is only 27kb. So a normal placeholder while it downloads wouldn't do much. I'm not sure if there's a way to set a loading placeholder while the svg paints? ie is there an event for when it's finished painting?
Re:Using some good old obsolete HTML to create JavaScript-fr... by Hello71 on Saturday June 23, 2018 @10:37PM (#17384642)
it's because you load a huge 2.4 MB JS file, and your web server is configured terribly so gzip is off so it really is 2.4 MB.
Re:Using some good old obsolete HTML to create JavaScript-fr... by aplummer on Sunday June 24, 2018 @08:51AM (#17386353)
There are a lot nicer ways to say that FYI
Re:Using some good old obsolete HTML to create JavaScript-fr... by tomsmeding on Sunday June 24, 2018 @05:10AM (#17385711)
If that's true, then pity the mobile users on a capped data plan.
Re:Using some good old obsolete HTML to create JavaScript-fr... by progval on Saturday June 23, 2018 @08:37PM (#17384293)
The image is downloaded by JS code (via astronomer.io's API) :|
Re:Using some good old obsolete HTML to create JavaScript-fr... by pcmaffey on Saturday June 23, 2018 @10:17PM (#17384592)
Well yeah it's a react app... here's a link to the raw svg file on our cdn - https://cdn.astronomer.io/app/img/astronaut.svg
Re:Using some good old obsolete HTML to create JavaScript-fr... by bfred_it on Saturday June 23, 2018 @07:31PM (#17384038)
Don’t do it. Not worth it. Once you get into transforms it’s a waste of time. Anything more complex than a couple `animate` elements and you’re better off with a mini JavaScript lib.

I used to spend time on this but when a little animation takes two hours then you stop.

Re:Using some good old obsolete HTML to create JavaScript-fr... by pcmaffey on Saturday June 23, 2018 @10:26PM (#17384615)
It's not so bad once you figure to create a new <g> tag for every animation. But yeah, there's a lot of trial and error to it (as with any design work)... unless you want to really mentally nail down the coordinate system.
Re:Using some good old obsolete HTML to create JavaScript-fr... by cseelus on Saturday June 23, 2018 @05:47PM (#17383637)
That is indeed inspiring. Running very smoothly even on an old iPhone I tested it with. I will implement something using animated SVG for the 404 and 500 error pages of our webapp.
Re:Using some good old obsolete HTML to create JavaScript-fr... by sethrin on Sunday June 24, 2018 @02:02AM (#17385185)
What tool did you use to author the SVG file? And presumably you optimized it as well?
Re:Using some good old obsolete HTML to create JavaScript-fr... by pcmaffey on Sunday June 24, 2018 @09:37AM (#17386505)
Inkscape for graphics. Text editor for animations. svgo to optimize.
Re:Using some good old obsolete HTML to create JavaScript-fr... by kyle-rb on Sunday June 24, 2018 @12:28PM (#17387117)
Nice! I made an SVG animation myself, but I used embedded CSS animations instead of SMIL: http://nin.ten.dog/img/shibe.svg
Re:Using some good old obsolete HTML to create JavaScript-fr... by ComputerGuru on Sunday June 24, 2018 @01:11AM (#17385045)
Nice animation! Thanks for the Easter egg hint. Loaded immediately on Safari/iPhone 8+ and was butter smooth.
Re:Using some good old obsolete HTML to create JavaScript-fr... by aplummer on Sunday June 24, 2018 @08:53AM (#17386359)
Have a look at bodymovin / Lottie, I appreciate the handmade approach but might save you a bunch of time
Re:Using some good old obsolete HTML to create JavaScript-fr... by aplummer on Sunday June 24, 2018 @08:52AM (#17386355)
Loved the finale