BizTalk Utilities CV ,   Jobs ,   Code library
 
Go to the front page to continue learning about XML or select below:

Contents

ReBlogger Contents

Previous posts in Biztalk Adapters

 
 
Page 2200 of 19334

Raphaël: Simple graphics wrapper on top of SVG and VML

Blogger : Ajaxian Blog
All posts : All posts by Ajaxian Blog
Category : Biztalk Adapters
Blogged date : 2008 Aug 08

Dmitry Baranovskiy of Atlassian has created Raphaël "a small JavaScript library that should simplify your work with vector graphics on the web. In case you want to create your own specific chart or image crop-n-rotate widget, you can simply achieve it with this library."

Raphaël uses SVG and VML as a base for graphics creation. Because of that every created object is a DOM object so you can attach JavScript event handlers or modify objects later. Raphaël’s goal is to provide an adapter that will make drawing cross-browser and easy. Currently library supports Firefox 3.0+, Safari 3.0+, Opera 9.5+ and Internet Explorer 6.0+.

The API looks like this:

JAVASCRIPT:
  1.  
  2. // Creates canvas 320 × 200 at 10, 50
  3. var paper = Raphael(10, 50, 320, 200);
  4. // Creates circle at x = 50, y = 40, with radius 10
  5. var circle = paper.circle(50, 40, 10);
  6. // Sets the fill attribute of the circle to red (#f00)
  7. circle.attr("fill", "#f00");
  8. // Sets the stroke attribute of the circle to white (#fff)
  9. circle.attr("stroke", "#fff");
  10.  

Check out demos showing reflection, image rotation, and text rotation.

Here is the reflection:

done via:

JAVASCRIPT:
  1.  
  2. $(function () {
  3.     var src = $(".image img")[0].src;
  4.     var R = Raphael("mirror", 320, 240);
  5.     var gradient2 = {type: "linear", dots: [{color: "#000", opacity: .5}, {color: "#000"}], vector: [0, 0, 0, "100%"]};
  6.     R.image(src, 0, 0, 320, 320).matrix(1, 0, 0, -1, 0, 280);
  7.     R.rect(-2, -2, 322, 83).attr({gradient: gradient2, "stroke-width": 0});
  8.     R.rect(-2, 80, 322, 240).attr({fill: "#000", "stroke-width": 0});
  9. });
  10.  

(via Charles Miller)


Read comments or post a reply to : Raphaël: Simple graphics wrapper on top of SVG and VML
Page 2200 of 19334

Newest posts
 

    Email TopXML