4 ms·
There are other factors to consider here besides performance. Security for one.
by kjf 17y ago
There are other factors to consider here besides performance. Security for one.
- arethuza 17y agoNot to mention functionality - code the same thing in Flash and using Canvas and compare what is involved. Some things that are trivial in Flash/Flex are (as far as I can see) pretty difficult when using Canvas. Note that I really want to use Canvas - but at the moment when it comes to interactive graphical applications I don't think the two are currently directly comparable.
- robin_reala 17y agoI don't think the two are currently directly comparable. They’ll never be directly comparable. Canvas is a bitmap drawing field, Flash is a vector drawing field with enhancements. If you want to do vector stuff you’re probably better off using SVG.
- arethuza 17y agoAbsolutely, which is why I pretty much gave up using Canvas and decided to try Raphaël http://raphaeljs.com/ http://raphaeljs.com/
- Groxx 17y agoGive it time. The canvas element isn't even out of draft phases yet. How long has Flash been around? Honestly, I think canvas will catch up to Flash in capabilities pretty quickly. And I'm holding out hope for OpenCL hooks for Javascript for this reason precisely. What's really needed now is a good editor like Flash's studio. People are still largely doing everything by hand-coding things. Put Flash on that same level, and see how easy things are to do.
- arethuza 17y agoWell, I hand code ActionScript using a vanilla editor and use the command line compiler and I still find Flex/Flash easier to use than Canvas.
- Groxx 17y agoNice. I haven't done much AS, and I'm really not too surprised. Since you've done both, I'll definitely keep your view in mind; many haven't. Is the main part of the ease due to the language / core API though, or ActionScript's libraries? Canvas has effectively no mature libraries as far as I can tell, though there are some impressive ones. You're rather hardcore compared to most Flash developers I've run across, though. I'd wonder if most are just using whichever one has bigger / better tools. (not that this implies anything about the language, of course)
- gb 17y agoActually a lot of Flash apps are mainly code + assets now, that's certainly the way we make things. I've tried using canvas to replicate some things that we've made in Flash, and quickly ran into some problems: 1) There is no way of interacting with elements drawn to canvas, as it's just a flat image (as someone else mentioned in the comments here, canvas is just a way of drawing bitmaps). You could obviously write your code to deal with mouse and keyboard interaction, but it's even more overhead on something that is already quite slow, and even if you could interact with individual elements it brings me to the other thing... 2) Flash has everything in layers that can be updated independently, when it comes to canvas if you want to change something you have to redraw that section of the image entirely, something that isn't always practical which means you end up redrawing the whole canvas. Essentially Flash does the same thing, but as the compositing is handled by the plugin it is far faster than anything you can do in Javascript at the moment. Also related to the above, the drawImage method that draws bitmap data to the canvas is painfully slow at the moment, so compositing using that is out of the question. If that can be optimised significantly it will certainly help. Basically canvas is too low level to duplicate the kind of functionality Flash offers at the moment. Until manipulating the canvas and Javascript is optimised further it's not possible to layer in the interaction or flexibility of rendering that Flash has. I'm sure a framework offering this will happen one day, but it won't be any time soon.
- arethuza 17y agoI briefly considered writing some kind of framework for Canvas that would emulate the Flex DisplayObject and related container classes together with some useful behaviors. I gave up when I realized how big a task this would be and that the result would probably be slow and almost surely superseded in some future release of Canvas.
- gb 17y agoIt depends what side of it you're trying to do, just getting a tree structure of Sprite-like things working is actually quite easy - canvas' drawing transform stack is ideal for resolving the nested transforms for each shape. The trickier part is re-rendering the smallest region of canvas possible when you do change part of the display list. Maybe I should post a link to my stuff when I get around to working on it some more!
- est 17y ago> Security for one. Install base is a big factor to security.