raphael

44
Raphaël JavaScript Library for Vector Graphics Dmitry Baranovskiy WSG meeting 11 March 2009

Upload: dmitry-baranovskiy

Post on 15-May-2015

3.417 views

Category:

Technology


3 download

DESCRIPTION

Web Standards Group talk about Raphaël — JavaScript Vector Library http://raphaeljs.com

TRANSCRIPT

Page 1: Raphael

Raphaël

JavaScript Library for Vector Graphics

Dmitry BaranovskiyWSG meeting

11 March 2009

Page 2: Raphael

Cool

Page 3: Raphael
Page 4: Raphael

Cool Cool Cool WTF

Page 5: Raphael
Page 6: Raphael

Raphaël

Page 7: Raphael
Page 8: Raphael

What is it for?

Page 9: Raphael

Demo

Page 10: Raphael

What is it?

Page 11: Raphael

JavaScript

Page 12: Raphael

window.onload = function () { var hldr = document.getElementById("holder"); var text = hldr.getElementsByTagName("p")[0].innerHTML; hldr.innerHTML = ""; var R = Raphael("holder", 640, 480), txt = R.set(), attr = {"font": '50px "Georgia"', opacity: 0.5}; txt.push(R.text(320, 240, text).attr("fill", "#0f0")); txt.push(R.text(320, 240, text).attr("fill", "#f00")); txt.push(R.text(320, 240, text).attr("fill", "#00f")); txt.attr(attr); var mouse = null, rot = 0; document.onmousemove = function (e) { if (mouse === null) { mouse = e.pageX; return; } rot += e.pageX - mouse; txt[0].rotate(e.pageX - mouse); txt[1].rotate((e.pageX - mouse) /1.5); txt[2].rotate((e.pageX - mouse) /2); mouse = e.pageX; };};

Page 13: Raphael

window.onload = function () { var hldr = document.getElementById("holder"); var text = hldr.getElementsByTagName("p")[0].innerHTML; hldr.innerHTML = ""; var R = Raphael("holder", 640, 480), txt = R.set(), attr = {"font": '50px "Georgia"', opacity: 0.5}; txt.push(R.text(320, 240, text).attr("fill", "#0f0")); txt.push(R.text(320, 240, text).attr("fill", "#f00")); txt.push(R.text(320, 240, text).attr("fill", "#00f")); txt.attr(attr); var mouse = null, rot = 0; document.onmousemove = function (e) { if (mouse === null) { mouse = e.pageX; return; } rot += e.pageX - mouse; txt[0].rotate(e.pageX - mouse); txt[1].rotate((e.pageX - mouse) /1.5); txt[2].rotate((e.pageX - mouse) /2); mouse = e.pageX; };};

Raphael("holder", 640, 480)

Page 14: Raphael

How does it work?

Page 15: Raphael

Canvas SVG VML

Page 16: Raphael

Canvas SVG VML

pixels DOM DOM

Page 17: Raphael

SVG VML

Page 18: Raphael

DOM?

Page 19: Raphael

SVG VML

Page 20: Raphael

API

Page 21: Raphael

circleellipseimagepathrecttext

Page 22: Raphael

circleellipseimagepathrecttext

animateattrgetBBoxhideinsertAfterinsertBeforeremoverotatescaleshowstoptoBacktoFronttranslate

Page 23: Raphael

circleellipseimagepathrecttext

animateattrgetBBoxhideinsertAfterinsertBeforeremoverotatescaleshowstoptoBacktoFronttranslate

Page 24: Raphael

circleellipseimagepathrecttext

animateattrgetBBoxhideinsertAfterinsertBeforeremoverotatescaleshowstoptoBacktoFronttranslate

fillfill-opacityfontfont-familyfont-sizegradientopacityrotationscalestrokestroke-dasharraystroke-linecapstroke-linejoinstroke-miterlimitstroke-opacitystroke-widthtranslation

Page 25: Raphael

circleellipseimagepathrecttext

animateattrgetBBoxhideinsertAfterinsertBeforeremoverotatescaleshowstoptoBacktoFronttranslate

fillfill-opacityfontfont-familyfont-sizegradientopacityrotationscalestrokestroke-dasharraystroke-linecapstroke-linejoinstroke-miterlimitstroke-opacitystroke-widthtranslation

cxcyheightpathrrxrysrcwidthxy

Page 26: Raphael
Page 27: Raphael
Page 28: Raphael
Page 29: Raphael

Element.node

Page 30: Raphael

Circle.node.onclick = function () {…};

Page 31: Raphael

$(Circle.node).click(…);

Page 32: Raphael

16 Kb

Page 33: Raphael
Page 34: Raphael
Page 35: Raphael
Page 36: Raphael
Page 37: Raphael

0.6.4

Page 38: Raphael

0.7

Page 39: Raphael

gRaphaël

Page 40: Raphael

Yet Another Demo

Page 41: Raphael

Raphaël could make you stand out of the crowd.

Page 42: Raphael

Using Raphaël could amaze your colleagues

Page 43: Raphael

http://RaphaelJS.com/

Page 44: Raphael

Thank You