Slashdot Mirror


Processing Visualization Language Ported To Javascript

Manfre writes "On his birthday, John Resig (creator of jQuery) has given a present to developers by releasing Processing.js. This is a Javascript port of the Processing Visualization Language and a first step towards Javascript being a rival to Flash for online graphics content. His blog post contains an excellent writeup with many demos."

15 of 171 comments (clear)

  1. Second Step by AKAImBatman · · Score: 5, Informative

    This is a Javascript port of the Processing Visualization Language and a first step towards Javascript being a rival to Flash for online graphics content.

    Second step, actually. Apple and the WHATWG took the first step by introducing the Canvas API to the HTML 5 spec. That gave web developers the ability to do Flash-like content. This language is the second step, in that it gives programmers a standard framework from which to create impressive animations.

    Kudos to Mr. Resig on a job well done! I can't wait to play around with this project more. :-)
  2. Re:'polished turd' by teknopurge · · Score: 1, Informative

    Flash, when used non-gratuitously, has always run fast for me. Check out http://varriastudios.com/ for a site that illustrates what I'm talking about.

  3. Flash is just Adobe Javascript by Anonymous Coward · · Score: 4, Informative

    Flash itself uses a dialect of ECMAScript (the common parent language of Javascript and ActionScript). So your assertion that Javascript engines were not written to do this is flat out wrong.

    All this shows is just how terrible most browser's Javascript engines really are. Notice, modern browsers do considerably better on these demos than older ones, mainly because so much of the web has shifted to using Javascript and dynamic content, such that JS becomes a limiting factor in usability. Once JS engines have caught up to ActionScript in speed, what more use do we have for Flash? We already have Mozilla working to make use of the Tamarin byte-code engine, which will turn JS from being a slow, interpreted language into being a byte-code compiled language (speed on the order of modern scripting languages such as Python/Ruby and to some extent Java/C#).

    So sorry, Javascript is the right tool for the job. It's the only tool for the job as far as Open Standards are concerned.

  4. Re:Rival?! by AKAImBatman · · Score: 4, Informative

    The article submitter has clearly never actually used the HTML canvas object.

    Oh? I have, and I don't disagree. Of course, I've USED Flash quite a bit too, so I know how God-aweful slow that platform was up until version 9. ;-)

    There's no way in HELL canvas & javascript together could ever approach the render and execution performance of Flash.

    Why not? Flash == Software renderer. Canvas == Software renderer. Actionscript == ECMAScript engine. Javascript == ECMAScript engine. I'm not seeing the issue.

    Hell, once FireFox is on the Tamarin engine, the two platforms will be practically the same!
  5. Re:My Post by Anonymous Coward · · Score: 3, Informative

    I am sick and tired of people confusing Java and javascript. They are not the same language. They are not even related languages. javascript is crappy scripting language for use with HTML. It is run my the browser and aids in display time processing. Java is a full blown object oriented programming language which runs on the Java Virtual Machine. Sine the JVM handles interfacing with the operating system Java itself is mostly platform independent.

  6. Re:'polished turd' by teknopurge · · Score: 2, Informative
    Please check that link again as it appears you ahve misread it.

    Lower is better. Got it.

    Array join (array size 1000, 500 iterations)
    JS: FF2 - 375ms, Flash - 303ms

    substring (10000 iterations)
    JS: FF2 - 16ms, Flash - 3ms

    Did you look at the link I posted at all? Even the older versions of Flash were split with JS ~50/50 on the various datapoints.

    I'm not implying it's a bad thing to try, but seriously. Did you even look at the JS code that is your "framework" to this stuff? Let me grab you a piece:


        do {
                        v1 = 2 * p.random(1) - 1; // between -1.0 and 1.0
                        v2 = 2 * p.random(1) - 1; // between -1.0 and 1.0
                        s = v1 * v1 + v2 * v2;
                    } while (s >= 1 || s == 0);
                    var multiplier = Math.sqrt(-2 * Math.log(s)/s);
                    nextNextGaussian = v2 * multiplier;
                    haveNextNextGaussian = true;

                    return v1 * multiplier;


    The JS engines are not optimized to do the above. Sure they will do it, but not with any semblance of efficiency.
  7. Re:Not going to happen by MightyYar · · Score: 2, Informative

    Javascript is far too fragmented to be a competitor to flash. The author's most famous project, jQuery, addresses this weakness, though. It is a smallish framework that does a very good job abstracting you from the browser-to-browser differences in Javascript.

    I haven't played with this new toy of his, but it stands to reason that he'll take the same care with it that he did with jQuery.

    In other words, Javascript may be too fragmented, but this Processing language is not... and you write your code in Processing, not Javascript.
    --
    W..w..W - Willy Waterloo washes Warren Wiggins who is washing Waldo Woo.
  8. Re:Rival?! by Manfre · · Score: 2, Informative

    The article submitter has clearly never actually used the HTML canvas object. There's no way in HELL canvas & javascript together could ever approach the render and execution performance of Flash.

    I have used the HTML canvas object. It's not on par with Flash 9, which is why I wrote "a first step towards Javascript being a rival to Flash". I styled that to help you with reading comprehension. Processing.js is an enabler that will lower the bar for many developers and give it the attention needed to improve the weaknesses that exist.
  9. Re:My Post by ardor · · Score: 2, Informative

    Except that Javascript is much more powerful than Java can ever hope to be. It's the environment thats crappy, not the language.

    Seriously, you should at least *understand* the languages before you talk nonsense.

    --
    This sig does not contain any SCO code.
  10. Re:'polished turd' by AKAImBatman · · Score: 2, Informative

    I think you missed the point. If your Flash code is not compiled for Flash 9, Tamarin is not used. The old Flash 8 engine gets loaded instead. Since the vast majority of Flash content is still Flash 8, no one is using Flash 9. :-)

  11. Re:My Post by bb5ch39t · · Score: 2, Informative

    Which was part of the design criteria for COBOL. It was so that "low level" (PFC) military "grunts" could write code that would work.

  12. Re:My Post by tkinnun0 · · Score: 2, Informative

    Java is a crappy low-level language Java's a low level language? That's news to me. Well, yeah, before Java 5 with its generics, autoboxing and the rest, that was pretty much the case. Much like C is a low-level language to produce assembler code, Java was (and mostly still is) a low-level language to produce JVM byte-code. If you take ever take a look at results of javap -c on a simple method you'll see what I mean.
  13. Re:'polished turd' by Anonymous Coward · · Score: 1, Informative

    Tamarin is used in all Flash Players since version 9.

    And all of the web designers upgraded their Adobe Flash, and deleted all their old .swf files in favor of re-creating them in Tamarin-compatible form?

  14. VM not in use by many projects?! by nova_ostrich · · Score: 2, Informative

    The short version is that Flash 9 is not comparable right now because the VM is not in use by many projects.

    Are you serious? As a software engineer who works with Flash and Flex daily, I've worked exclusively with Flash Player 9 and ActionScript 3 for over two years. Almost anyone who calls him or herself a Flash developer will say the same. I might have let your argument slide a year ago, but with Flash Player 9 installed on well over 90% of web-connected computers, it's silly not to use AS3. Anyone still working with AS2 and Flash 8 is probably a designer building simple "experience sites" or advertisements who knows a little about coding or a developer who doesn't know any better (or is a masochist).

    --
    It's scary being a Flash and Flex developer on Slashdot. You guys are unnaturally rabid.
  15. Re:'polished turd' by BungaDunga · · Score: 2, Informative

    The AS2 version of Papervision has basically been discontinued: all the shiny stuff is in the AS3 version. There's quite an incentive to run it in AS3, because it's relatively fast compared to the old AVM. Since I started messing around in PV3D I've switched entirely to AS3: it's not really much of a change in coding style.