views:

1092

answers:

4

I'm making a slideshow and the images won't be static, they'll be pulled in dynamically through an array and finally it will look like this:

What i'm wondering is, what is more CPU friendly, CSS3 & jQuery making transitions fade simply by changing the CSS class of the div that will fill the screen, or, Canvas with drawn on it refreshing each time?

+3  A: 

You don't have to use HTML5, but there is nothing stopping you... in fact, here is a slideshow about HTML5 (Using HTML5)!

http://apirocks.com/html5/html5.html

scunliffe
Nice link, really shows what we allready can accomplish with HTML5, can come in handy! thanks!
Noor
+1  A: 

Webkit (Safari, Chrome, etc.) has built-in support for CSS-based transitions effects, and Mozilla is working on adding them as well. Being able to use the browser-supplied transitions, where available, will definitely provide a performance boost.

I'm not sure what your browser compatibility requirements are, but keep in mind that no version of IE supports <canvas> yet. You can use a JavaScript library to provide it with pseudo-support, but I would imagine that's going to lead to a performance hit.

awgy
I think that you made my choice pretty simple and you gave me a good reason to why I should use CSS3 and on top of that, why not canvas.. Thanks!
Noor
+1 for using CSS3 transitions and being in the frontier!
jholster
+1  A: 

Given the sad state affairs we are in at the moment where IE doesn't support CANVAS then I'd say stick with the jQuery version. Unless, of course, you don't mind excluding IE - but bare in mind it's still by far the most popular browser out there.

I'd also say that sliders aren't that CPU intensive and I would always put maintainability and compatibility first.

Dan Diplo
I've been totally ignoring the fact that IE doesn't support canvas yet and the only reason is that I want to see the final outcome of the site which is very wrong. As i have understood it IE9 will support canvas but it's still not here yet.I think i'll recode the page to use css3 since it's implemented to almost all the browsers by now, and it really shouldn't slow down a PC in this "modern" world..! thanks for your input
Noor
@Noor - MSFT has stated support for SVG in IE9 (as well as many other things, but AFAIK they have not yet stated they will support CANVAS)
scunliffe
A: 

Plenty of options came into my mind:

  1. Transitions by JS/CSS are well-tested & quick to implement. CPU usage is unlikely to be a problem.

  2. However, if you want to experience with the canvas option and support the Redmond-based browsing-thingy, you can simplify your life by drawing through Raphaël cross-browser API.

  3. Pure CSS transitions are the most elegant (arguably) method. Unfortunately folks outside Cupertino have been lazy to implement them, so their use is currently mostly limited to impressive extra eye candy.

  4. Retro way: pretend it's 2001 and these guys enables you to do some serious CPU burning for few hundred bucks.

jholster