Beta
×

Welcome to the Slashdot Beta site -- learn more here. Use the link in the footer or click here to return to the Classic version of Slashdot.

Thank you!

Before you choose to head back to the Classic look of the site, we'd appreciate it if you share your thoughts on the Beta; your feedback is what drives our ongoing development.

Beta is different and we value you taking the time to try it out. Please take a look at the changes we've made in Beta and  learn more about it. Thanks for reading, and for making the site better!

Processing Visualization Language Ported To Javascript

kdawson posted more than 6 years ago | from the time-to-buy-stock-in-noscript dept.

Graphics 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."

cancel ×

171 comments

Sorry! There are no comments related to the filter you selected.

Heh AvP comes ot mind here (4, Funny)

Uncle Focker (1277658) | more than 6 years ago | (#23351576)

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.
Whoever wins, we lose.

Re:Heh AvP comes ot mind here (4, Insightful)

Anonymous Coward | more than 6 years ago | (#23352078)

You lose anyway. You and the rest of the "ASCII text forever" crowd don't speak for me.

Re:Heh AvP comes ot mind here (5, Funny)

edalytical (671270) | more than 6 years ago | (#23352852)

Score one for the "UTF-8 text forever" crowd. Thanks for the support!

Re:Heh AvP comes ot mind here (2, Interesting)

Uncle Focker (1277658) | more than 6 years ago | (#23353112)

You lose anyway.
It comes with the territory.

You and the rest of the "ASCII text forever" crowd don't speak for me.
And this crowd, whose membership I've been forced into against my will, doesn't speak for me either.

Re:Heh AvP comes ot mind here (4, Funny)

Paradise Pete (33184) | more than 6 years ago | (#23354336)

And this crowd, whose membership I've been forced into against my will, doesn't speak for me either.

4F682079657320776520646F2E

Re:Heh AvP comes ot mind here (2, Funny)

Uncle Focker (1277658) | more than 6 years ago | (#23354454)

4F682079657320776520646F2E
You do not!!! Damn you hex text bastards!

Re:Heh AvP comes ot mind here (1)

Dachannien (617929) | more than 6 years ago | (#23353624)

That's okay. Your vote only counts if you log in.

Re:Heh AvP comes ot mind here (2, Insightful)

rbanffy (584143) | more than 6 years ago | (#23353220)

All we need is a decent and fast implementation of JavaScript. Apple seems to have a nice one in Safari that appears decent in Midori/Webkit.

And, BTW, we need one badly, because the Flash (I don't trust Adobe) and Silverlight (I don't trust MS) crowds are coming and won't wait for a fast JavaScript engine.

My Post (-1, Troll)

slackoon (997078) | more than 6 years ago | (#23351586)

First of all...All hail Java and it's multi-planform goodness. I say a Flash take over is just what is needed. Second of all....FIRST POST :)

Re:My Post (5, Funny)

LighterShadeOfBlack (1011407) | more than 6 years ago | (#23351676)

First of all... you got second post. Second of all, TFA is about Javascript, not Java.

Other than that your post was completely relevant.

Re:My Post (1)

youthoftoday (975074) | more than 6 years ago | (#23351966)

Not true. It wasn't the first post either. Apart from those points, entirely relevant.

Re:My Post (1, Funny)

Thuktun (221615) | more than 6 years ago | (#23352184)

First of all... you got second post.
Not true. It wasn't the first post either.
Er, yeah.

Re:My Post (2, Funny)

maxume (22995) | more than 6 years ago | (#23352226)

Well muddled.

Re:My Post (3, Informative)

Anonymous Coward | more than 6 years ago | (#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:My Post (5, Funny)

truthsearch (249536) | more than 6 years ago | (#23352752)

Jules: Whoa, whoa, whoa, whoa... stop right there. Javascript and Java ain't even the same fsckin' thing.
Vincent: It's not. It's the same ballpark.
Jules: Ain't no fsckin' ballpark neither. Now look, maybe your method of programming differs from mine, but, you know, writing a web page, and coding for the JVM, ain't the same fsckin' ballpark, it ain't the same league, it ain't even the same fsckin' sport. Look, Javascript don't mean shit.

Re:My Post (1)

dotancohen (1015143) | more than 6 years ago | (#23354712)

Jules: Whoa, whoa, whoa, whoa... stop right there. Javascript and Java ain't even the same fsckin' thing.
Vincent: It's not. It's the same ballpark.
Jules: Ain't no fsckin' ballpark neither. Now look, maybe your method of programming differs from mine, but, you know, writing a web page, and coding for the JVM, ain't the same fsckin' ballpark, it ain't the same league, it ain't even the same fsckin' sport. Look, Javascript don't mean shit.
I _have_ seen someone thrown out the window for coding in Java.

Re:My Post (5, Insightful)

fuzzy12345 (745891) | more than 6 years ago | (#23353164)

javascript is crappy scripting language for use with HTML. [...] Java is a full blown object oriented programming language
I think you meant to say "Javascript is a full blown power-users' language, basically Lisp but with syntax problems, whereas Java is a crappy low-level language; the COBOL of the millenium."

Re:My Post (4, Interesting)

compro01 (777531) | more than 6 years ago | (#23353380)

COBOL is still alive and kicking in the financial sector and it's fairly decent for what it's designed to do. i really wouldn't want to use it for general programming, but i wouldn't want to write a payroll app in C++ either.

Re:My Post (1, Insightful)

Uncle Focker (1277658) | more than 6 years ago | (#23353530)

Java is a crappy low-level language
Java's a low level language? That's news to me.

the COBOL of the millenium."
So you mean it's highly ubiquitous language with 100s of billions of lines of code written in it that spreads over innumerable applications?

Re:My Post (3, Insightful)

Free the Cowards (1280296) | more than 6 years ago | (#23353762)

So you mean it's highly ubiquitous language with 100s of billions of lines of code written in it that spreads over innumerable applications?
Pretty much. Both Java and COBOL blow great big donkey chunks, but they're both used all over the place. They both have this great property of making it difficult to shoot yourself in the foot, which makes it practical to unleash hordes of medium/low quality programmers on a code base and actually come up with something that kinda sorta works.

Re:My Post (2, Informative)

bb5ch39t (786551) | more than 6 years ago | (#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 (2, Informative)

tkinnun0 (756022) | more than 6 years ago | (#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:My Post (1)

Uncle Focker (1277658) | more than 6 years ago | (#23354164)

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.
I don't think that word means what you think it does.

In computer science, a low-level programming language is a language that provides little or no abstraction from a computer's microprocessor.
That clearly doesn't describe Java.

Re:My Post (1)

tkinnun0 (756022) | more than 6 years ago | (#23354666)

In computer science, a low-level programming language is a language that provides little or no abstraction from a computer's microprocessor.
That clearly doesn't describe Java.
From a 100% Pure Java viewpoint, the JVM is the microprocessor. Within environments like Jazelle [arm.com] , that true even in practice.

Re:My Post (1)

fredrik70 (161208) | more than 6 years ago | (#23354816)

You nowhere near describing a stackbased cpu with the java language, it's not low level, ok? if you ever done low lewel you know what I mean

Re:My Post (1)

Mongoose Disciple (722373) | more than 6 years ago | (#23354344)

Javascript is a full blown power-users' language

It gets a bad rap because poor developers will use that power to write powerfully terrible code, and "smart" developers will typically use that power to write clever but unmaintainable code.

Re:My Post (0)

Anonymous Coward | more than 6 years ago | (#23354386)

I don't know where you learned to program, but you have a VERY warped view of programming languages. Javascript is not a power-users' language by any means. Furthermore comparing it to Lisp is an insult to Lisp, the programmers who use Lisp, and any machine that Lisp has ever been run on. Javascript sucks donkey.

Re:My Post (0)

Anonymous Coward | more than 6 years ago | (#23355114)

As a COBOL programmer, your comparison offends me.

Re:My Post (2, Informative)

ardor (673957) | more than 6 years ago | (#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.

Creator of WHAT?! (0)

Anonymous Coward | more than 6 years ago | (#23351606)

I was a bit excited to read about a JS library that can potentially compete with Flash, but then I saw the writer is the same person behind JQuery. I'll still play around with it a little, but my hopes are somewhat tempered now.

Re:Creator of WHAT?! (5, Insightful)

grahamd0 (1129971) | more than 6 years ago | (#23352340)

Can someone please explain to me why anyone would regard jquery as a black mark on John Resig's work?

I've found it very useful for anything but the most mundane js tasks. Certainly better than the piles of other libraries that all seem to be based around the fallacy that javascript needs classical inheritance. (Hint: It doesn't. It has prototypal inheritance.)

Re:Creator of WHAT?! (0)

Anonymous Coward | more than 6 years ago | (#23352496)

I never said there's anything wrong with JQuery, it's just that, like you said, it's only useful for the most mundane of website-related tasks (not to mention it'll be more-or-less obsolete as support for CSS3 becomes more widespread).

Re:Creator of WHAT?! (4, Insightful)

grahamd0 (1129971) | more than 6 years ago | (#23352732)

Actually, I said it was useful for anything except the most mundane tasks (where the overhead of loading a library is not justified by the task).

Re:Creator of WHAT?! (0)

Anonymous Coward | more than 6 years ago | (#23353126)

Are you and I talking about the same JS library here? Uses a wrapper for GetElementsByTagName and GetElementByClass, has syntax that allows methods to be "chained" in order of execution, does mostly DHTML stuff with a little AJAX tacked on for hype? I have to concede, it's extremely clever, but it's not really useful for anything beyond blinging up your site.

Re:Creator of WHAT?! (1)

fredrik70 (161208) | more than 6 years ago | (#23354836)

try mochikit. having said that, they both play nicely together, so you can have the best of both worlds

Re:Creator of WHAT?! (0, Offtopic)

hkgroove (791170) | more than 6 years ago | (#23352906)

You can now draw Homer Simpson with CSS and Javascript

http://nedbatchelder.com/blog/200805/css_homer_animated.html [nedbatchelder.com]

Re:Creator of WHAT?! (1)

IdeaMan (216340) | more than 6 years ago | (#23354738)

Yes but will it run without turning off NoScript?

'polished turd' (3, Insightful)

teknopurge (199509) | more than 6 years ago | (#23351636)

This is some great work....

but this is like a polished-turd. Flash doesn't exist anymore to do animation or dynamic graphics, it exists to run fast. JS engines were not designed to process this kind of data efficiently, as seen by your CPU graph when running the demos.

I don't want to take away from the work, because it's a slick hack, but it's not the right tool for this job.

Regards,

Re:'polished turd' (5, Insightful)

AKAImBatman (238306) | more than 6 years ago | (#23351694)

Flash doesn't exist anymore to do animation or dynamic graphics, it exists to run fast.

Wait, are we talking about the same Flash? Because I've done a lot of Flash and Actionscripting, and "Fast" is not even in the vocabulary. Software rendered graphics pipeline? Check. Slow VM interpreter that makes Java 1.0 look fast? Check. Lack of direct rendering APIs? Check. Focus on animation at the expense of dynamic scene creation? Check.

Granted, Flash 9 is a major improvement, but it is arriving rather late in the game.

Re:'polished turd' (1, Informative)

teknopurge (199509) | more than 6 years ago | (#23351746)

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.

Re:'polished turd' (5, Interesting)

AKAImBatman (238306) | more than 6 years ago | (#23351856)

Check out http://varriastudios.com/ [varriastudios.com] for a site that illustrates what I'm talking about.

A user interface? I think you have a very odd definition of "Fast". All you've proven is that Flash is designed to do pretty animations. Well, that's kind of the point. Not to run "Fast". "Fast" was never a part of the design. Just look up the "Actions" portion of the Flash 8 spec sometime and you'll be utterly horrified.

That being said, Flash does do animations well. That's what it was designed for. As a result, it has even been used to create games [newgrounds.com] . It never did games all that well, but Moore's law eventually made it possible to come up with some fairly decent stuff.

Of course, if you're referring to "my Flash animations move faster than my DHTML animation", that's just plain user-error. The Flash animations work better because Flash Studio works out all the timings of the motions for you. If you Actionscripted your motions, they'd come out about the same as they would in Javascript. (And being nearly the same language, it's possible to try the same motion code in both.)

This issue is what the Javascript PVL is intended to solve. i.e. A standard framework for providing animation/motion with minimal input from the developer.

Re:'polished turd' (1, Troll)

teknopurge (199509) | more than 6 years ago | (#23352044)

Of course, if you're referring to "my Flash animations move faster than my DHTML animation", that's just plain user-error. The Flash animations work better because Flash Studio works out all the timings of the motions for you. If you Actionscripted your motions, they'd come out about the same as they would in Javascript. (And being nearly the same language, it's possible to try the same motion code in both.)
Completely and utterly false.

JS interpreters are not optimized to do image manipulation, DOM updates, etc. Now this isn't to say they aren't moving in that direction, but as of now they are atrocious at these tasks.

Flash is a completely separate environment from the browser, is vector based and inherently performs animation better. Right now it's always faster(CPU %) to do an animation in Flash then it is to do the same animation in JS.

Regards,

Re:'polished turd' (4, Insightful)

AKAImBatman (238306) | more than 6 years ago | (#23352228)

JS interpreters are not optimized to do image manipulation, DOM updates, etc.

Whiskey Tango Foxtrot. Optimized for image manipulation? You do absolutely ZERO image manipulation in Javascript. Same with Actionscript. All that is pushed down into the Canvas and Flash rendering engines, respectively. Same thing with DOM manipulations. Sure, you say "insert this item" or "delete this object", but it's the C/C++ engine under the covers that does the heavy lifting.

People haven't done their own image manipulation since Amigas stomped the earth.

Right now it's always faster(CPU %) to do an animation in Flash then it is to do the same animation in JS.

You make that statement, yet you posted a benchmark that showed Javascript to be faster than Flash. I'm rather confused. You do realize that the benchmark you posted below was in millisecond and not operations per second, right? i.e. Lower is better.

You have zero evidence for your statements. Listen to someone who actually knows something about these platforms. There's no reason why Javascript can't perform the same function as Flash using the Canvas APIs. And you know what? That's not a bad thing. :-)

Re:'polished turd' (2, Informative)

teknopurge (199509) | more than 6 years ago | (#23352448)

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.

Re:'polished turd' (2, Insightful)

AKAImBatman (238306) | more than 6 years ago | (#23352762)

Please check that link again as it appears you ahve misread it.

Actually, you should check my post below as I explained in detail why Flash lost that handily. The short version is that Flash 9 is not comparable right now because the VM is not in use by many projects. By the time it's in heavy use, FireFox will be using the exact same engine.

Did you even look at the JS code that is your "framework" to this stuff?

Sure. And the piece you picked (like most of the code) is motion computations. The piece you picked does a handful of mulitplies and library (fast!) calls for log, random, and square root. That *could* be heavily optimized with lookup tables, but there wouldn't be much point. That's not even a blip on the processor's time. All the real work is done in the Canvas API calls where the blitting happens.

There is no image manipulation in Javascript or Actionscript. The computations you see could be faster if Javascript had true primitive support, but at the end of the day it just doesn't matter. I know that because that was optimization 101 back when we developers had to write our own 3D engines. A routine that runs once per frame is far less of a concern than a routine that runs once a line or even once a pixel! Moore's law has continued to reinforce that truth. :-)

Re:'polished turd' (1)

ardor (673957) | more than 6 years ago | (#23353474)

That *could* be heavily optimized with lookup tables, but there wouldn't be much point.
Nowadays, lookup tables for log and sqrt are unwise. The CPU has instructions for this, and lookup tables just trash the cache. Random numbers *can* be reasonable as a LUT, especially pseudorandom stuff like Perlin Noise. But your average random() function does not belong in a LUT either.

Re:'polished turd' (1)

MrMunkey (1039894) | more than 6 years ago | (#23355090)

Thanks so much for all the great information about Javascript. As Doug Crockford says, it's The World's Most Misunderstood Programming Language [crockford.com] Just a few months ago I started a project (in my spare time of course) to see how I could push my knowledge of the language, and I came up with this: Track Attack [primateapplications.com] . It's far from complete, but uses Javascript for everything except sound (which uses an API to flash to handle it). The browser isn't taxed too much (after some tweaking on the music) and it was a fun experiment. All the code is in-line so that you can view the source quite easily. Kind of off-topic, but I thought I'd throw it out there. Javascript can be useful in the right hands.

Re:'polished turd' (1)

pjt33 (739471) | more than 6 years ago | (#23354016)

People haven't done their own image manipulation since Amigas stomped the earth.
I have, working for a company which makes Java games and still supports MSJVM. We wrote our own libraries to do almost everything because there wasn't available library support for it.

Re:'polished turd' (1)

teknopurge (199509) | more than 6 years ago | (#23352094)

found this:

http://www.oddhammer.com/actionscriptperformance/set4/ [oddhammer.com]

don't know the accuracy, but interesting nonetheless.

Re:'polished turd' (5, Insightful)

AKAImBatman (238306) | more than 6 years ago | (#23352324)

I mentioned this above, but I'll reiterate it here. In that benchmark, LOWER IS BETTER. The brand-new Flash 9 VM engine did excellent (as I expected it would), but the Flash 7 and 8 engines were generally creamed by the Javascript engines. Which I don't think is what you're trying to prove at all.

The secret to the performance of Flash 9 is this little beauty: http://www.mozilla.org/projects/tamarin/ [mozilla.org]

A fully modern, high-performance, Just In Time compiler that gives the JVM a run for its money. It's an amazing piece of Javascript technology that Adobe has donated to the Mozilla project for inclusion in the next major revision of FireFox. Wonderful, wonderful engine that absolutely no one is using yet.

See, if you compiled to Flash 7 or 8, you're still triggering the Flash 8 engine. The Flash 9 engine is a complete rewrite that only works with Flash 9 content. So the next chapter of performance wars has yet to be written.

Q.E.D.

Re:'polished turd' (1)

MenTaLguY (5483) | more than 6 years ago | (#23353202)

And of course, by the time Flash is using Tamarin, so will Javascript be (at least in Firefox).

Re:'polished turd' (1)

mad.frog (525085) | more than 6 years ago | (#23353640)

Tamarin is used in all Flash Players since version 9.

Re:'polished turd' (1, Informative)

Anonymous Coward | more than 6 years ago | (#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?

Re:'polished turd' (1)

mad.frog (525085) | more than 6 years ago | (#23353488)

> absolutely no one is using yet

Er, except for Flash 9. Which it was originally written for.

Re:'polished turd' (2, Informative)

AKAImBatman (238306) | more than 6 years ago | (#23353886)

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:'polished turd' (1)

erickhill (1235704) | more than 6 years ago | (#23352374)

You obviously have never used Gameday at mlb.com - play-by-play of ever single real-time pitch/hit/play. Come on man, Get real.

Speaking of polished turds (1)

UbuntuLinux (1242150) | more than 6 years ago | (#23351898)

That site is a fucking abomination, not so much a polished turd as a turd with white mould all over it. Please remove the link at once.

Re:'polished turd' (1)

GweeDo (127172) | more than 6 years ago | (#23353490)

That site is a great example of how not to use Flash. Not one thing there couldn't easily be done with standard HTML+CSS+Javascript. All they have now is a site that is hard to crawl and index and un-usable by the impaired. Go Flash!

Re:'polished turd' (1)

teknopurge (199509) | more than 6 years ago | (#23354940)

I used it as an example of how it was much faster for the developer to make it using Flash authoring tools to get the look he was after then using HTML. Of course you could make a similar site using HTML+CSS - that's not the point.

It also take significantly fewer request to load(i.e. 2) then a normal site.

Re:'polished turd' (1)

Dachannien (617929) | more than 6 years ago | (#23353546)

Flash, when used non-gratuitously
Well, there's yer problem!

Re:'polished turd' (3, Insightful)

frosky (42740) | more than 6 years ago | (#23352616)

As a longtime Flash developer i can also tell you that wether u use it for animation, GUIs or for basic web apps, the primary appeal to people like me was that Macromedia created avery easy to learn authoring environment. And even as the application grew to include programming and such, its concept of timeline, tweens, movieclips, etc. was far simpler to learn than the alternatives - including MM Director. To me that is the core strength of Flash. So whoever attempts to compete should take that into consideration. Before Adobe acquired MM they failed miserably at competing because they had a very clunky authoring environment (at least as noted by most of my developer peers at the time)

Re:'polished turd' (2, Funny)

Uncle Focker (1277658) | more than 6 years ago | (#23351702)

Flash doesn't exist anymore to do animation or dynamic graphics, it exists to run fast.
So when is Adobe finally going to get around to meeting that goal?

Re:'polished turd' (1)

teknopurge (199509) | more than 6 years ago | (#23351788)

no idea - I'm not a flash guy by trade. If you want to talk Java and JavaFX I'm all for it. :)

Kind Regards,

Re:'polished turd' (1)

Uncle Focker (1277658) | more than 6 years ago | (#23353434)

So, half past a blue moon?

Re:'polished turd' (1)

Kenoli (934612) | more than 6 years ago | (#23351742)

Agreed. The life demo is especially laggy. ( http://ejohn.org/apps/processing.js/examples/topics/conway.html [ejohn.org] )

Re:'polished turd' (1)

kestasjk (933987) | more than 6 years ago | (#23352330)

This is an example, and it's an impressively large grid running at decent speeds.

Bram Cohen (bittorrent guy) had a JavaScript game of life on his page at one point, which used tables instead of Canvas, and it was much, much slower on a much, much smaller grid. (I can't find a link for comparison now though)

Re:'polished turd' (1)

Kenoli (934612) | more than 6 years ago | (#23352982)

Still, it cripples my browser.
Do you think something like this could be drastically optimized?

Re:'polished turd' (2, Insightful)

kestasjk (933987) | more than 6 years ago | (#23354466)

Conway's game of life isn't a very realistic use case, a large bit-array with lots of sequential reads/writes. It's always going to be a CPU-bound task, no matter what optimization it gets More interesting and realistic are the graphical demos, which show off Canvas. The ones which draw something in Canvas and then do nothing more are probably the most realistic real-world-like demos, and they shouldn't cripple anything.

Flash is just Adobe Javascript (4, Informative)

Anonymous Coward | more than 6 years ago | (#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:Flash is just Adobe Javascript (1)

truthsearch (249536) | more than 6 years ago | (#23351948)

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.
A language and it's implementation are two different things. Just because a language has a feature doesn't mean an engine is written well to use it.

Re:Flash is just Adobe Javascript (1)

IdeaMan (216340) | more than 6 years ago | (#23354902)

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.
Sorry with NoScript on HTML and CSS are the only tools for the job.

Re:'polished turd' (1, Interesting)

Anonymous Coward | more than 6 years ago | (#23351936)

Flash doesn't exist anymore to do animation or dynamic graphics, it exists to run fast.
Clearly you've never run Flash on Mac OS.

Re:'polished turd' (1)

teknopurge (199509) | more than 6 years ago | (#23352470)

I do every day.

I should have said "in an optimized manner" instead of 'fast'. Instead of splitting hairs my point is that Flash is designed to do particular things and has the tools to do them in a reasonable way.

JS does not.

Re:'polished turd' (1)

Uncle Focker (1277658) | more than 6 years ago | (#23353836)

I should have said "in an optimized manner"
So then you clearly haven't run Flash on Mac OS X.

Re:'polished turd' (3, Interesting)

kestasjk (933987) | more than 6 years ago | (#23352252)

JS engines aren't currently designed for it, but this is what Canvas (and a lot of HTML5) is all about..

If you prefer think of this as Processing on Canvas, rather than Processing on JavaScript, because Canvas is the enabling technology here.

And I don't know where you get off calling it a "polished turd". (Makes me want to poke around your homepage-vertisement, and see if you have a right to make those judgements)

The Java requirement was always a pain to deal with before, and this "polished turd" removes that and makes visualizations much more portable and easier to play around with.

Also the moving visualizations have always been CPU intensive, that's the nature of what they are; they're supposed to be easy to create visualizations of data, it's not a video game. It was like this on Java too.
Note that the static practical visualizations, which take dynamic data, draw the visualization and then end, need much less CPU than dynamic ones like you might see in a flashy demo.

This is a very good thing, and a very welcome surprise; Processing really does offer something that's pretty unique, and I look forward to seeing more of it. Kudos Resig

Re:'polished turd' (1)

vandit2k6 (848077) | more than 6 years ago | (#23354452)

But if Javascript does the job well, than what exactly is the problem? Does it really matter in the end? When you buy a piece of furniture in the store do you abide by the rules of using the furniture. For example do you always sit on a chair and never stand on it.

Second Step (5, Informative)

AKAImBatman (238306) | more than 6 years ago | (#23351648)

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

Not going to happen (3, Insightful)

stonecypher (118140) | more than 6 years ago | (#23351810)

The primary strength of Flash is its single vendor, rigorously portable, rigorously backwards compatible runtime. Javascript is far too fragmented to be a competitor to flash.

Re:Not going to happen (4, Insightful)

ozamosi (615254) | more than 6 years ago | (#23352278)

I know, and so does everyone else.

You know, I recently heard about a project by John Resig (creator of jQuery) called Processing.js. It's a Javascript port of the Processing Visualization Language, which means it could be viewd as a rival to Flash for online graphics content.

You should check out his blog post [ejohn.org]

In case the sarcasm wasn't obvious enough: that's one of the most important things that Javascript libraries solve

Re:Not going to happen (2, Funny)

Arslan ibn Da'ud (636514) | more than 6 years ago | (#23353540)

In case the sarcasm wasn't obvious enough: that's one of the most important things that Javascript libraries solve


Wow! A library that helps people detect sarcasm...that IS a killer feature!!!

Re:Not going to happen (2, Informative)

MightyYar (622222) | more than 6 years ago | (#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:Not going to happen (0)

Anonymous Coward | more than 6 years ago | (#23354102)

rigorously portable
Oh is it now? So why am I here with my 64-bit browser and no flash?
Don't talk about 32-bit browsers in a 64-bit OS.
Talk about no 64-bit flash.

Re:Not going to happen (1)

chromatic (9471) | more than 6 years ago | (#23354748)

The primary strength of Flash is its single vendor, rigorously portable....

That has to be sarcasm, right? Satire? Sardonicism?

Rival?! (1)

LSD-OBS (183415) | more than 6 years ago | (#23351982)

Javascript being a rival to Flash for online graphics content

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.

It is very handy to have though, apart, of course, from having to perform kludgery to get it working roughly in IE (by using excanvas.js to emulate the canvas object in VML).

Re:Rival?! (4, Informative)

AKAImBatman (238306) | more than 6 years ago | (#23352108)

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:Rival?! (2, Informative)

Manfre (631065) | more than 6 years ago | (#23352806)

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:Rival?! (1)

HeroreV (869368) | more than 6 years ago | (#23354928)

There's no way in HELL canvas & javascript together could ever approach the render and execution performance of Flash.
You're not very imaginative. Once JavaScript has the same JIT as ActionScript [mozilla.org] , the language will be just as fast. And once Canvas has a hardware accelerated 3D API [mozilla.org] , it'll be much faster than Flash. 3D content in Flash is extremely slow and takes up a lot of storage space, because it has to be converted to 2D content beforehand.

Eric (5, Insightful)

erickhill (1235704) | more than 6 years ago | (#23352140)

Regardless if this is usable today for client work, this is insane stuff. The first iteration of Flash eons ago had plenty of nay-sayers. He made this over the course of seven months? Bow down, I say. Very impressive.

doesn't matter (0)

Anonymous Coward | more than 6 years ago | (#23352720)

Even using bitmaps instead of vectors, the hardcoded C++ software rendering is the limiting factor above ECMA scripting performance. Theoretically, then, JS/Canvas could approximate the speed of Flash ... other than the fact that Flash has years of optimization on their side.

What really matters, however, is that this *IS* slow, and that it doesn't run *AT ALL* on 50+% browsers.

Other than that, Mrs. Lincoln, how was the play? (4, Insightful)

Em Ellel (523581) | more than 6 years ago | (#23352778)

Thus, anything outside of the above (images, pixel processing, and text) should work "ok" everywhere.
Is it just me or does graphical language that does not fully support image, pixel, or text processing seems a bit.... silly.

Don't get me wrong, I think its a cool toy I will be playing with, but until it actually works in more than one beta browser, its is no threat to Flash at all.

-Em

Re:Other than that, Mrs. Lincoln, how was the play (1)

thestudio_bob (894258) | more than 6 years ago | (#23353234)

Don't get me wrong, I think its a cool toy I will be playing with, but until it actually works in more than one beta browser, its is no threat to Flash at all.

You mean like say, FireFox AND Webkit?

Neat, but not necessarily useful (1)

togofspookware (464119) | more than 6 years ago | (#23353246)

It looks to me like the big accomplishment here is that he parses processing language code and API calls and converts it to JavaScript that uses a canvas. It's pretty cool that it's possible to do that (similar to the Java -> JavaScript converter or the Ruby VM in JavaScript mentioned a few days ago), but the end product doesn't seem that useful to me, as the processing language isn't significantly better than JavaScript for this kind of thing, anyway. I'd be more interested if this guy had found a way to make processing perform better (translated to JS or otherwise), or if he came up with an entirely new language that made certain graphics really simple to express (certain [contextfreeart.org] fractal [sourceforge.net] generators [nuke24.net] come to mind). Though it feels likely that proofs-of-concept such as this will inspire something really great in the near future.

JS a rival to flash? (1)

museumpeace (735109) | more than 6 years ago | (#23353428)

has the writer of that claim read chapters 8 and 9 from Flanagan's Javascript 5th ed.? It is a hopelessly messy language that is congenitally unable to do a decent job of OO implementations. Flex has classes in a more normal sense of the word. Sounds like hype. Does the newly offered code somehow bury the variable scoping sloppiness of JS?

Riddle me this... (1)

argent (18001) | more than 6 years ago | (#23353882)

Why is the distinction between objects that you can inherit from (classes) and ones you can't (instances) so important?

example from TFA and why we're in the OO stoneage (0)

Anonymous Coward | more than 6 years ago | (#23353732)

The author goes to describe a 'Spin' class. Then he defines a SpinArm that extends (concrete inheritance ) the Spin class. So we really have an 'Arm' that 'is-a' Spin. Oh really?

Then the SpinArm class contains its own function to display itself. Oh really?

This shows that the guy is clueless about what OO is all about.

This kind of stuff, that makes it frontpage on /., it's part of the reason we're still in the OO stone-age.

OO analysis? Anyone?

Now of course I'm not surprised about the lack of good OO practice from anyone spewing random JavaScript or Java here and there: I'm not saying good OO is not possible in these languages, simply that 99.9% of the projects out there written in Java or JavaScript (or C#) are written by people that have no idea what OO is about.

If you're interested in good OO practices in Java, check out the Spring framework (used, amongst other, by Voca to process daily 100 millions of bank-to-bank transactions). Guys behind such frameworks know wtf they're doing.

The dude from TFA doesn't have the singlest clue about OOP, let alone OOD or OOA (he probably never heard these terms).

I'm pissed off by such article containing phrase such as: "this is an example of inheritance".

"This is an example of incompetence", that's all it is.

Re:example from TFA and why we're in the OO stonea (1)

togofspookware (464119) | more than 6 years ago | (#23354034)

I think the guy who did this deserves more credit than you give him, if only because re-implementing all the processing functions and parsing the language is a relatively large undertaking for anyone who doesn't have mountains of free time on their hands, and the fact that it works at all is good sign that this guy isn't completely incompetent.

All that said, I agree that a 'SpinArm' extending a 'Spin' isn't the best example of inheritance. I also realize that seemingly small things like this can be very frustrating to read for people who are well-versed in the subject. But it was my understanding that he threw out that 'this is an example of inheritance' line just to show processing syntax (and assuming the reader already knows what inheritance is and that that's not a very good example of its use), and I'm guessing that most of his code is more sensible - if his entire project was written that sloppily it doesn't seem likely that he would have gotten as far with it as he did.

learning Processing (1)

ystar (898731) | more than 6 years ago | (#23353994)

(sorry this is tangential to the topic)

This summer my goal is to start working with Processing. I'm at home in C/C++/Lisp and I have a tiny bit of experience with openGL (probably safe to assume it's worthless though - I pretty much recycled other folks' shaders when I was working with it). Do any folks here have some advice, such as where they started when they began working with Processing? Thanks :)

Re:learning Processing (1)

stokes (148512) | more than 6 years ago | (#23354950)

The best resource for learning Processing is just taking apart the example code that comes with it.

Processing is extremely easy if you have previous programming experience. It's really just Java with a simple IDE and some automatically-loaded libraries; when a Processing 'sketch' compiles, it's actually wrapping it in a Java class and building that.

SVG anyone? (1)

DerPflanz (525793) | more than 6 years ago | (#23354296)

Wasn't SVG (with Javascript) supposed to be the Flash killer? We use it a lot in SCADA systems, and it works great.

Just ported our system to Firefox' native SVG as Adobe's plugin reached its end-of-life.

Re:SVG anyone? (1)

Cthefuture (665326) | more than 6 years ago | (#23354570)

I agree. SVG is intended to do everything Flash does and more. Currently dynamic stuff is pretty slow but there have been some very good advancements lately in the Firefox SVG engine. The main problem is Microsoft has completely ignored SVG. Probably because of Flash being popular and proprietary (more money for all). Plus now they have Silverlight.

You still have to contend with the awful Javascript language though. The engines are slow because the language is convoluted.

SVG should be the future. It's the best choice out of all the options. The only change I would make is to ditch Javascript or at least allow the option of using another language (Lua would be my first choice, tiny and fast).
Load More Comments
Slashdot Login

Need an Account?

Forgot your password?