Catch up on stories from the past week (and beyond) at the Slashdot story archive

 



Forgot your password?
typodupeerror
×
Graphics Software

Processing Visualization Language Ported To Javascript 171

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."
This discussion has been archived. No new comments can be posted.

Processing Visualization Language Ported To Javascript

Comments Filter:
  • Second Step (Score:5, Informative)

    by AKAImBatman ( 238306 ) <akaimbatman@g m a i l . c om> on Friday May 09, 2008 @12:32PM (#23351648) Homepage Journal

    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 [whatwg.org] 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. :-)
  • Re:'polished turd' (Score:2, Informative)

    by teknopurge ( 199509 ) on Friday May 09, 2008 @12:38PM (#23351746) Homepage
    Flash, when used non-gratuitously, has always run fast for me. Check out http://varriastudios.com/ [varriastudios.com] for a site that illustrates what I'm talking about.
  • by Anonymous Coward on Friday May 09, 2008 @12:41PM (#23351786)
    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.
  • Re:Rival?! (Score:5, Informative)

    by AKAImBatman ( 238306 ) <akaimbatman@g m a i l . c om> on Friday May 09, 2008 @01:02PM (#23352108) Homepage Journal

    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!
  • Re:My Post (Score:3, Informative)

    by Anonymous Coward on Friday May 09, 2008 @01:19PM (#23352362)
    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.
  • Re:'polished turd' (Score:3, Informative)

    by teknopurge ( 199509 ) on Friday May 09, 2008 @01:25PM (#23352448) Homepage
    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.
  • by MightyYar ( 622222 ) on Friday May 09, 2008 @01:27PM (#23352472)

    Javascript is far too fragmented to be a competitor to flash.
    The author's most famous project, jQuery [jquery.com], 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.
  • Re:Rival?! (Score:2, Informative)

    by Manfre ( 631065 ) on Friday May 09, 2008 @01:53PM (#23352806) Homepage Journal

    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.
  • Re:My Post (Score:3, Informative)

    by ardor ( 673957 ) on Friday May 09, 2008 @02:49PM (#23353412)
    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.
  • Re:'polished turd' (Score:3, Informative)

    by AKAImBatman ( 238306 ) <akaimbatman@g m a i l . c om> on Friday May 09, 2008 @03:20PM (#23353886) Homepage Journal
    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. :-)
  • Re:My Post (Score:2, Informative)

    by bb5ch39t ( 786551 ) on Friday May 09, 2008 @03:35PM (#23354104)
    Which was part of the design criteria for COBOL. It was so that "low level" (PFC) military "grunts" could write code that would work.
  • Re:My Post (Score:2, Informative)

    by tkinnun0 ( 756022 ) on Friday May 09, 2008 @03:35PM (#23354110)

    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.
  • Re:'polished turd' (Score:1, Informative)

    by Anonymous Coward on Friday May 09, 2008 @03:45PM (#23354260)
    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?
  • by nova_ostrich ( 774466 ) on Saturday May 10, 2008 @02:10PM (#23362350) Homepage

    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).

  • Re:'polished turd' (Score:3, Informative)

    by BungaDunga ( 801391 ) on Saturday May 10, 2008 @03:18PM (#23362910)
    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.

"The one charm of marriage is that it makes a life of deception a neccessity." - Oscar Wilde

Working...