Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I realize this sounds silly. Let me explain:

I just came across this page about using CSS elements to create shapes- square, circle, triangle, star, yin-yang (yin-yang!), etc. using pseudo elements.

Having struggled with HTML5 Canvas drawing in the past, I immediately thought that some combination of JavaScript and CSS pseudo-elements should be able to draw just about anything.

So I first googled "CSS Fractals". No dice. Then "JS Fractals". Some dice, but not what I was looking for.

Am I crazy, or is there potential here? jQuery can add and remove elements from the DOM by the thousands all day long. It seems to me that--given the existence of triangles via pure CSS--there is potential for a nice drawing mechanism (2D and 3D) sans Canvas.

Any thoughts, frameworks, tutorials, white papers, etc would be appreciated!

share|improve this question
    
It seems like a large leap to go from hacky shapes with border tricks, to drawing, in plain CSS and JS. Canvas is just JS anyway... –  sevenseacat Jan 6 '12 at 4:28
    
I can see why it would seem that way, and maybe I am completely wrong here, but the issue is gnawing at me a bit. I spend most of my time working with large datasets--not graphics--so I am very familiar with how quickly I can render various styled elements to the view with jQuery/CSS/JSON (for providing the data). This includes rounded corners, shadows, gradients, etc. So it just seems like rendering and interacting with graphics in this paradigm may be worth looking into. To what end? I dunno yet. . . –  Matthew Patrick Cashatt Jan 6 '12 at 4:35
    
If canvas is too client-side / scripty for you, maybe you want to have a look at svg? –  tdammers Jan 6 '12 at 7:31

2 Answers 2

up vote 2 down vote accepted

Donatello

This is what I think you have been looking for.

share|improve this answer
    
Thanks Expressions! Looks like you nailed it! –  Matthew Patrick Cashatt Jan 6 '12 at 14:06

Donatello, as the above answer suggests, is a great answer, especially if you're looking for graphs. If you want to do more general drawing, Donatello is built on Raphael.js, and it's more generalized. Raphael can do most anything you want when it comes to 2-D (and even simulated 3-D) graphics. Everything from charts to 3-D shaded spheres... it's pretty much amazing. If you want to do fractals and more computationally complex imaging, you might want to look at specialized libs that utilize web workers, for instance Fractaljs.

The combination of HTML5 Canvas, CSS3, and JavaScript (especially jQuery) is definitely the answer. Finding the right tolls and frameworks on top of those technologies is the next step. The ones listed here are a great place to start.

share|improve this answer
1  
He did say sans canvas... but hey. –  sevenseacat Jan 6 '12 at 9:27
    
@Karpie, oops! Looks like I missed the 'sans'. I got that he was frustrated with Canvas, but I thought that was due to the lack of suitable frameworks... it can be a beast dealing with it raw. Thanks for pointing that out... but hopefully Donatello and/or Raphael can use their ninja turtle powers to defeat his fear of Canvas ;-) –  Jason Lewis Jan 6 '12 at 9:31
    
@JasonLewis- Thanks for your answer! I had to select Expressions answer because it fit a bit better to the question, but your points were well taken. I am going to give canvas another year or so to mature but I know I will be back. The thing is, I can't quite get the cross-browser support or dev knowledge I need to move forward with it on an enterprise app at the moment, though I know how strong it is. Thanks again! –  Matthew Patrick Cashatt Jan 6 '12 at 14:06
    
@MatthewPatrickCashatt "Cross-browser support for an enterprise app" is one of the most terrifying phrases in the English language. I feel your pain. The only thing that saves my sanity having to support IE is being allowed to require Chrome Frame. Best of luck. –  Jason Lewis Jan 6 '12 at 15:39
    
@JasonLewis- Sadly, about half of my projects come from Microsoft, so Chrome Frame is a no-go :) :). –  Matthew Patrick Cashatt Jan 6 '12 at 15:44

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.