[jQuery] Oooh! These are pretty!
Canvas is Mozilla's implementation... IE doesn't support that however.
A JQ drawing lib would be great but quite a pain in the ass to code so
it was cross browser.
-----Original Message-----
From: discuss-bounces@jquery.com [mailto:discuss-bounces@jquery.com] On
Behalf Of Bryan Buchs
Sent: Friday, October 27, 2006 11:14 AM
To: jQuery Discussion.
Subject: Re: [jQuery] Oooh! These are pretty!
I might be wrong, but isn't that what Canvas is for? Drawing shapes?
> Sam,
>
> Yes, some thing like that would be great. It would also be nice to
> handle arrays of locations without the 'px' so it is easy to do math
on
> them.
>
> // place a circle at the center of some container
> $("#container").drawShape("circle", { origin: "centre", radius: 30})
>
> // draw a circle
> $("#container").drawShape("circle", { origin: [5,8], radius: 30})
>
> // draw multiple circles and style them all the same
> $("#container").drawShape("circle", { origin: [[5,8],[30,45],...],
> radius: 30, style: {color: "red", opacity: .5, border-color: #900,
> border-style: "solid"}})
>
> // draw a polyline
> $("#container").drawShape("line" { path: [[5,8],[30,45],...], style:
> {color: "red", line-style: "dashed", lineWidth: 2}}).bind("mouseover",
> function(e){alert("I'm a line");});
>
> I also think there is something to be said for creating shape objects
like:
>
> var redcircle = {
> id: "circle01",
> type: "circle",
> x: 5,
> y: 8,
> radius: 30,
> style: {color: #f00;},
> };
> var bluecircle = {
> id: "circle02",
> type: "circle",
> x: 5,
> y: 8,
> radius: 10,
> style: {color: #00f;},
> };
> var shapes = [];
> shapes.push(redcircle);
> shapes.push(bluecircle);
>
> // add to circles, then hide the larger
> $("#container").addShape(shapes);
> $("#circle01").hide();
>
> or
>
> // add two circles (nested), then hide both of them
> $("#container").addShape(redcircle);
> $("#circle01").addShape(bluecircle);
> $("#circle01").hide();
>
> Anyway you get the idea.
>
> -Steve
>
> Sam Collett wrote:
>> On 27/10/06, Stephen Woodbridge <woodbri@swoodbridge.com>