Slashdot Mirror


HTML 5 Canvas Experiment Hints At Things To Come

An anonymous reader writes with an interesting and impressive demonstration of modern browsers' HTML 5 capabilities. "From the 9elements blog: 'HTML5 is getting a lot of love lately. With the arrival of Firefox 3.5, Safari 4 and the new 3.0 beta of Google Chrome, browsers support some great new features including canvas and the new audio/video tags. [...] We've created a little experiment which loads 100 tweets related to HTML 5 and displays them using a javascript-based particle engine.' The site warns "(beware: sophisticated browser needed)"; Firefox 3.5 seems to work fine.

44 of 321 comments (clear)

  1. I just checked it out with Firefox 3.5.2 by rampant+mac · · Score: 4, Funny

    ...And I see a lot of floating dots.

    "HTML 5 Canvas Experiment Hints At Things To Come"

    Seizures?

    --
    I like big butts and I cannot lie.
    1. Re:I just checked it out with Firefox 3.5.2 by sumdumass · · Score: 5, Insightful

      I was sort of thinking the same things.

      Now I'm wondering if the things I hate about Flash wasn't the actual software but what people were doing with it.

  2. Re:Awesome by moredots · · Score: 4, Funny

    Regardless of what the answer is to this question, I am wondering if HTML 5 can provide most of the functionality of Javascript without posing as much of a security risk.

  3. Awesomely CPU Hungry by The+Real+Nem · · Score: 4, Insightful

    It was so awesome it pegged a whole core on my E8400. I expect to web to fuel larger hard drives, but faster CPUs? That's gettinga little out of hand.

    1. Re:Awesomely CPU Hungry by Microlith · · Score: 2, Interesting

      It's sad that it has to eat an entire core's worth of processing time, the whole time I was on the page I had an extremely powerful GPU sitting idle.

      I think before anything like that can truly take off, they need a means of taking advantage of the hardware we have.

    2. Re:Awesomely CPU Hungry by Phroggy · · Score: 2, Informative

      Weird. My iBook isn't fast enough to play YouTube videos, but handled this with no problem at all.

      --
      $x='S24;r)>63/* h@<5+oZ)32"5cz';$me='phroggy'x$];
      $x=~y+ -xz+\0-Tx+;print$_^chop$me for split'',$x;
    3. Re:Awesomely CPU Hungry by t0y · · Score: 2, Informative

      In simple terms, it'll go as smooth (framerate) as your CPU will allow. That's why it's maxing out.
      It's not surprising since this is a tech demo, and in reality most javascript animations you see today already do this to maximize fluidness.

  4. How do I mute the audio? by ender- · · Score: 3, Insightful

    This is great, but it really needs a way to mute the audio. Or better yet, make the audio optional [opt-in] from the start.

    And no, I don't want to just turn off my speakers. Maybe I'm listening to some music, now all of a sudden I've got some cheezy web-site music blaring in my headphones or out my speakers. Not cool...

    1. Re:How do I mute the audio? by Jared555 · · Score: 2, Insightful

      It is even more fun if you are feeding sound into a stereo system playing music and a random sound comes on loud enough to deafen you. This is why I disable sound on any program possible.

      Lost a speaker once because even with the volume controls on the stereo and computer turned to almost maximum whatever was playing was extremely quiet, all of a sudden either a program or website (I forget) started playing sound unexpectedly.

      Yes windows allows per program control and pulse audio on linux probably allows control for every separate flash applet depending on the configuration but if you don't react fast enough you can still get hit with annoying/deafening sounds.

    2. Re:How do I mute the audio? by Anonymous Coward · · Score: 2, Funny

      For XP and Linux, there's PulseAudio which has the same feature.

      When it works, you can control volumes individually. When it doesn't, you don't get sound at all. Either way, no cheesy music.

  5. Usabiliteless awkwardness by Koookiemonster · · Score: 2, Interesting

    This demo reminds me of fancy flash sites with horrible usability.

    1. Re:Usabiliteless awkwardness by infinityxi · · Score: 2, Interesting

      Well, remember the utility of Flash 10 years ago? It was basically a 400MB flash applet that loaded to play some crappy downloaded metal song while spinning some text 360 degrees. No doubt this will be abused to high hell before it gets some pretty useful utility. I prefer this demo rather than those stupid angelfire sites that crippled my computer because someone had a hardon for spinning text and Fear Factory.

      --
      Turn based strategy game that runs over XMPP. Phalanx
  6. Dots? by Spikeles · · Score: 5, Interesting

    How about some actual cool examples like this instead?

    --
    I don't need to test my programs.. I have an error correcting modem.
  7. Re:I dunno... by actionbastard · · Score: 3, Funny

    "Is compiling a bunch of "tweets" really the best use of all the great new HTML5 capabilities?"/em>

    It's the only use for it.

    --
    Sig this!
  8. One particle, one tweet? by vidnet · · Score: 2

    Each particle represents a tweet - click on one of them and it'll appear on the screen.

    Is it just me or does it seem to pick a random one regardless of where you click?

  9. Re:Works great in Opera 10.... by MichaelSmith · · Score: 3, Funny

    I stared at this thing much longer than any sane person should have.

    Programming is complete. Return to your normal activities. You will receive instructions when required.

  10. Compared to flash... by timeOday · · Score: 3, Insightful

    ..what are the advantages of doing this in HTML? If HTML 5 can obviate a bunch of complex, unrelated web technologies that make programming for the Web today such a mess, then great... but if it just adds to the pile, and doesn't build on expertise in "classical" HTML, then it's just adding to the problem.

    1. Re:Compared to flash... by dyefade · · Score: 2, Interesting

      The demo uses processing.js - essentially a Java library. Whether this has any more utility than Flash (remembering that the flash of today is not the monstrosity most of /. seems to remember and think it still is) could be debated, but it's definitely more in line with standards compliance.

    2. Re:Compared to flash... by LiquidFire_HK · · Score: 5, Insightful

      Is eliminating Flash not enough? HTML5 is open and (being) standardised; anyone is free to implement it. (And you can see there are already several competing implementations in progress) Flash is a proprietary platform and you are solely dependant on the whims of Adobe. If even just for the lack of choice, Flash is a worse platform. Nothing's forcing Adobe to fix their player, while the HTML5 browsers definitely have some competition going on and are improving at an amazing rate - and in fact when HTML5 starts to pick up, Adobe will be forced to do something, as HTML5 itself will be competition to Flash.

      Some people complain about how fast that thing runs (or how much CPU usage it takes), but I bet a flash version would not be even twice as fast, and Flash has existed for how long compared to browser support for HTML5 technologies?

    3. Re:Compared to flash... by Dragonshed · · Score: 2, Informative

      Processing is a Java library, parts of which has been ported to javascript.

      http://en.wikipedia.org/wiki/Processing_(programming_language)

    4. Re:Compared to flash... by Fallen+Seraph · · Score: 4, Interesting

      More control for one. Flash is essentially a self contained program running in your browser. HTML5 will allow things like audio volume per tab, or per domain, more interaction between the page itself, the content, and the user.

      Here's a fantastic example of the sorts of things this'll make possible, which simply can't be done with flash:
      http://www.double.co.nz/video_test/video.svg

      I actually think this is a better HTML5 example than the article. There you have video transparency, which can be a variable, you can selective audio based on the last thing you clicked, it can be moved, rotated, and resized freely by dragging the corners, etc. You can pause, play, mute, and adjust volume to each one completely independently of the other (though the volume control is blocked by the draggable corners, remember you can right click the video and click Show Controls in firefox). I once even saw a demo where the edges of video were distortable, allowing you to skew it, etc, and it was smoothly done too, better than most compiled applications I've seen. Not to mention effects like reflecting video content below the video in real-time (like it's on a glassy surface).

      What'll be really impressive is when SVG is finally fully implemented, because that'll give us an open standard for filters and many other things (you can alter colors in a video on the fly, generate images, gradients, and effects dynamically, etc, as well as animations without any javascript at all.

      What it comes down to is changing the notion of what's possible with just a browser... If you think that AJAX webapps are impressive now, just you wait...

    5. Re:Compared to flash... by dave420 · · Score: 2, Informative

      Most folks don't give a crap about Adobe owning Flash - they just want stuff to work. If Adobe tanks, and no one buys them out, and they're stuck, then they'll start to care. But until then, don't expect anyone to lose any sleep over Flash being closed source. And yes, Flash is muuuch faster when it comes to particles. here is a demo that has over 300,000 particles, compared to the 100 or so in the HTML5 demo, and it runs faster, and with less CPU usage. So you're right - in this highly-arbitrary test you proposed it's not twice as fast, flash is at least 1,000 times as fast ;). I'm sure HTML5 will get better, but it's definitely not there yet. Flash is decent, if used correctly. Just like a car, just like a computer, just like an internet connection, just like everything else in the world.

    6. Re:Compared to flash... by Stan+Vassilev · · Score: 2, Informative

      More control for one. Flash is essentially a self contained program running in your browser. HTML5 will allow things like audio volume per tab, or per domain, more interaction between the page itself, the content, and the user.

      The fact it's self-contained doesn't mean it's isolated from the page. It's in fact a benefit, because it quickly becomes a burden to serve your app as a hundred of tiny images and js files. The "minification" and "sprite" techniques the community is forced to use in JS/HTML/CSS apps, are tedious, limited and just a poor-man's compilation technique, a sign that in practice a compressed one-off-download container is the better choice for web apps.

      There is also fast two-way connection between JS and Flash that works in all browsers today. Anything the browser provides as settings and per-tab controls and so on, which is accessible to JavaScript/DOM, is accessible to Flash as well. As an example of this feature in action, you can see the HTML5 features like canvas and SVG implemented transparently via Flash. You can also use most of the essential Flash features directly from JavaScript with libraries like Aflax.

      Here's a fantastic example of the sorts of things this'll make possible, which simply can't be done with flash: http://www.double.co.nz/video_test/video.svg [double.co.nz]

      Would you care to elaborate what is in that demo that Flash can't easily top today. I see scalable rotatable rectangles with transluccent video in them. Nothing Flash couldn't do few years ago. Today, in Flash you can also map videos like that on waving flags in 3D space or have full-blown alpha mask for dynamic compositing, if you wish. I shouldn't need to mention also that Flash provides consistent codec support (including H264/AAC) on all platforms and browsers in turns on, today. All this while even non-MS browser makers can't agree on a common codec to use (let alone Microsoft joining them any time soon).

      You have true 3D engines with shader support or full-blown music synthesis and sequencing applications built directly on top of the flash platform.

      All in all, most arguments against Flash I've seen, are arguments out of ignorance and bias. I would be the first to call out a poor use of Flash when I see one, but it works the other way too. In the end, can't we have both instead of either? Who stands to win by "eliminating" either option when they both fill different, though partially overlapping roles?

    7. Re:Compared to flash... by Jeppe+Salvesen · · Score: 2, Insightful

      That demo is so quick it was done before rendering on FF 3.5.2 on Centos 5.3, with 64bit flash.

      Hoooray for Flash.

      --

      Stop the brainwash

  11. To my very pleasant surprise... by SilasMortimer · · Score: 5, Interesting

    KDE4's Konqueror handled the page for me much better than did Firefox. I have Firefox 3.5.1 and Konqueror 4.2.98. While Konqueror gave me no sound and Firefox did, when I tried it with Firefox, it ate up so many resources that I couldn't even get my key combo for xkill to work. Fortunately, I was able to get to a virtual terminal and kill it, but it wound up crashing my window manager. Konqueror did much better. I need to try it with Opera (which I understand is supposed to be very good).

    Anyway, it's pretty neat. I think I'll start making some pages for the heck of it and put it on my local network.

    --
    Omnes tuae crepidines sunt nobis sunt. Ascendo tuum!
    1. Re:To my very pleasant surprise... by TeXMaster · · Score: 4, Informative

      Opera too. No sound, but smooth animations and low resource usages. I wonder why these browsers were not mentioned in the summary. ;-)

      --
      "I'm never quite so stupid as when I'm being smart" (Linus van Pelt)
  12. Re:Slideshow by El_Muerte_TDS · · Score: 2, Informative

    Runs quite well on my old Toshiba Satellite Pro M10 (Pentium M 1.5, 512MB RAM, FF3.5.2, Windws XP)

  13. Re:No audio here thank god by Red+Alastor · · Score: 5, Insightful

    Websites that (successfully) make noise at me are one of my pet hates.

    That's why I think it's awesome that HTML5 includes sound. You can't block the sound from a plugin that's executable code that does whatever it wants, however browser makers (and extension writers) can put settings options to let you opt-out for the sounds. Or prevent things from playing until you switch to the tab that wants to play them.

    --
    Slashdot anagrams to "Sad Sloth"
  14. Extremely impressive indeed! by johannesg · · Score: 4, Funny

    In fact, it looks just like an Amiga demo from 20+ years ago!

  15. Re:Awesome by JuzzFunky · · Score: 2, Informative

    Yeah, it's not even that hard. As mentioned in TFA, they use Processing.js, which is a javascript port of Processing

    --
    Unexpect the expected!
  16. FPS? by SickLittleMonkey · · Score: 3, Interesting

    Come now, that's merely a toy!
    Explore the raw power of the canvas on an Apple II emulated in Javascript!

    http://scripple-2.appspot.com/
    Paste this in and press enter:
    10 TEXT : HGR
    20 HCOLOR=3
    30 FOR I = 0 to 279 step 4
    40 HPLOT I,0 TO 279-I,191
    50 NEXT I
    RUN

    (Only hires is on the canvas.)

    SLM

    --
    main() {1;} // zen app
    1. Re:FPS? by plams · · Score: 2, Interesting

      Ahh, HPLOT... back in those days you didn't need an SI prefix to measure fillrate.

      10 TEXT : HGR
      20 HCOLOR=3
      30 FOR I = 0 TO 16
      40 HPLOT I+130,30 TO I+80,161
      50 NEXT I
      60 FOR I = 0 TO 15
      70 HPLOT I+150,145 TO I+150,161
      80 NEXT I
      RUN

  17. Re:Awesome by xouumalperxe · · Score: 2, Informative

    What the GP said is that Javascript doesn't expose enough of the client's resources to the server to be a problem in and of itself. As in, the server doesn't get to know stuff about the client that the client wouldn't want.

    Alas, I somewhat disagree. The point is very much that Javascript makes it easy to find yourself typing personal information somewhere you shouldn't.

  18. Re:Awesome by Tony+Hoyle · · Score: 2, Insightful

    IE6 is dead. You might as well ask if it runs under Firefox 1.0. It'll probably run under IE8 which is being pushed out as a critical update right now..

  19. vs Flash by Toonol · · Score: 2, Insightful

    It seems that a lot of people are viewing this as a way to get rid of flash. I don't think that will work. The only way it will dispense with flash, is if can be made to do all the annoying things that people hate flash for. 99% of the use for this will be annoying web apps that shouldn't be using all these features, advertisements, the occasional game, some streaming video...

    Flash isn't that bad, it's just used very often for irritating purposes. Just as anything that could replace it will be.

  20. Re:No audio here thank god by IndieKid · · Score: 2, Informative

    They do on Vista and Windows 7. In fact, every application has its own volume control.

    See this link on MSDN

  21. Re:Canvas as Video Codec? by dingen · · Score: 2, Informative

    The video tag is not halted at all. They just decided not to mandate a specific codec, because they couldn't come to a consensus on which codec it should be.

    --
    Pretty good is actually pretty bad.
  22. Re:Awesome by jcupitt65 · · Score: 2, Insightful

    Lots of key sites (eg. youtube) are dropping IE6 support. Use rates on most top sites have dropped below 10%. The web is not useable with IE6. Most sites in development now are not supporting it, except by accident. IE6 is dead. Hooray!!

  23. Re:Slideshow by binkzz · · Score: 2, Interesting

    The only problem with game development is that javascript doesn't support sound. You can use background music with , but the only way games have been using sound in canvas so far is by using an additional flash applet controlled by javascript =\

    --
    'For we walk by faith, not by sight.' II Corinthians 5:7
  24. Re:Slideshow by toopok4k3 · · Score: 2, Interesting

    I've got ff 3.0.13 on windows XP. Worked for me.

  25. Re:Slideshow by PouletFou · · Score: 4, Funny

    Runs fine here on my pentium 3 with windows ME and netscape 4.

  26. Re:Awesome by tolan-b · · Score: 2, Informative

    YouTube are going to be dropping support for IE6 soon. Bet you see the numbers drop off rapidly then.

  27. Re:Awesome by maxume · · Score: 2, Insightful

    The entire point of canvas is programmatic drawing.

    If you don't like javascript, that's fine, but I'm not sure how you expect an interactive drawing canvas to work without some sort of 'instructions' written in some sort of 'language'.

    The advantages are supposed to be that it is standards based, and faster than DOM/CSS tricks, not that it doesn't involve javascript.

    --
    Nerd rage is the funniest rage.
  28. Re:Slideshow by jorgevillalobos · · Score: 2, Informative

    You can load a sound and have it buffer without playing it, but there's a limited media cache so it may require some juggling to have all the right sounds available at the right time. Probably enough to run a decent game :)

    Source: https://developer.mozilla.org/En/HTML/Element/Audio