11. “RAPHAËL IS A SMALL JAVASCRIPT
LIBRARY THAT SHOULD SIMPLIFY
YOUR WORK WITH VECTOR
GRAPHICS ON THE WEB.”
http://raphaeljs.com/
12. “SCALABLE VECTOR GRAPHICS
(SVG) IS A FAMILY OF
SPECIFICATIONS OF AN XML-BASED
FILE FORMAT FOR DESCRIBING TWO-
DIMENSIONAL VECTOR GRAPHICS,
BOTH STATIC AND DYNAMIC.”
http://en.wikipedia.org/wiki/Scalable_Vector_Graphics
13. “VECTOR MARKUP LANGUAGE
(VML) IS A DEPRECATED XML
LANGUAGE USED TO PRODUCE
VECTOR GRAPHICS.”
http://en.wikipedia.org/wiki/VML
23. RECTANGLES, HOW DO THEY WORK?
r = Raphael("jobs-graph", 640, 120);
rect = r.rect(481, 30, 7, 90);
rect.attr({stroke: "none",
fill: "#446093"});
This one
24. TEXT, HOW DO THEY WORK?
r = Raphael("jobs-graph", 640, 140);
text = r.text(490, 130, "CLINTON");
text.attr({font: "8px Courier",
fill: "#9c9c9b"});
Hi Bill!
25. THE INVISIBLE HOVER
hover = r.rect(481, 0, 8, 120);
hover.attr({stroke: "none",
"fill": "#fff",
"fill-opacity": 0});
$(hover.node).hover(function () {
rect.attr({"stroke": "#000"});
}, function () {
rect.attr({"stroke": "none"});
});
Only the black line for now
26. EXPECT A BLOG POST ON
CALLOUTS
http://trottercashion.com
The Callout
28. STATES ARE PATHS
r = Raphael("usa", 637, 432);
path = r.path(
"M352,226L401,224L403,227L399,232L407,231L408,233L40
4,235L406,236L405,237L405,238L404,238L404,240L403,23
9L402,240L403,240L402,242L404,244L401,246L401,248L39
9,248L400,250L399,249L398,250L399,251L398,251L398,25
5L397,256L396,256L395,258L394,257L396,259L394,259L39
5,260L394,262L393,261L394,264L392,265L394,266L391,26
6L392,267L391,267L391,269L393,269L392,270L393,269L39
2,270L393,272L394,271L393,273L392,274L392,275L358,27
6L358,269L354,269L353,268L353,242L350,226L352,226Z"
);
path.attr({fill: "#3081c2",
stroke: "#828282"});
29. STATES ARE PATHS
r = Raphael("usa", 637, 432);
path = r.path(
"M352,226 L401,224 L403,227 Z"
);
path.attr({fill: "#3081c2",
stroke: "#828282"});
I grew up here!
32. IMAGES, HOW DO THEY WORK?
r = Raphael("nissan", 1264, 568);
r.image(
"/images/learn/nodes/6/6i1.png",
672,
301,
48,
48
);
This one
33. THE IMAGE FROM BEFORE...
circle.attr({
fill: "270-#58a0ff-#5fe2fe",
stroke: "none"
});
This could have
been a circle!
34. CIRCLES, HOW DO THEY WORK?
circle = r.circle(213, 244, 5);
circle.attr({stroke: "#a2c9e3",
"stroke-width": 4,
"stroke-opacity": 0.6});
Transparency
for teh win!
35. HOW DO WE FIX THE LINE?
rad =30 * Math.PI / 180;
startX =Math.cos(rad) * 7 + 213;
startY =Math.sin(rad) * 7 + 244;
path =["M", startX, startY,
"l 300,100"];
r.path(path);
Transparency
reveals we lose!
36. WHIPLASH!*
circle.click(function () {
circle.animate({cx: 513,
cy: 344},
1000,
"elastic");
});
*Nissan actually swaps the circle out for an
animated gif, which is then animated w/ Raphaël.