Example 3

Моя “Доминикана” или Я и Рафаэль.

HTML

<script src="https://raw.github.com/DmitryBaranovskiy/g.raphael/master/min/g.raphael-min.js"></script>
<script src="https://raw.github.com/DmitryBaranovskiy/g.raphael/master/min/g.bar-min.js"></script>
<div id='holder'></div>

JavaScript

var paper = Raphael(0, 0, 400, 400);
var attr = {
    fill: "yellow",
    stroke: "red",
        "stroke-width": 1,
        "stroke-linejoin": "round"
};
var tr1 = paper.path("M 100 100 L 300 100 L 200 300 z").attr(attr);

// draw a circle at coordinate 10,10 with radius of 10
var c = paper.circle(100, 100, 100);
c.attr("fill", "red");
c.node.id1c = "круг";

c.node.onclick = function () {
    color = Raphael.getColor();
    c.attr("fill", color);
};
c.node.onmouseover = function () {
    c.attr("fill", "blue");
};
c.node.onmouseout = function () {
    c.attr("fill", "green");
};

tr1.node.id1c = "треугольник";
tr1.node.onclick = function () {
    color = Raphael.getColor();
    tr1.attr("fill", color);
};