如何与Raphael JS一起使用jQuery?

时间:2014-04-29 21:00:26

标签: jquery raphael javascript

$(document).ready(function() {
        var canvas = $('#canvas');
        var paper = Raphael(document.getElementById('canvas'), 500, 500);

        var circ = paper.circle(250, 250, 40);
        circ.attr({fill: 'green', stroke: 'none', 'stroke-width': 15, 'stroke': 'red', 'fill-opacity': .5});
        var text = paper.text(250, 250, 'Bye Bye Circle!');
        text.attr({opacity:0, 'font-size': 12}).toBack();

        circ.animate({ 'transform': 'r90T100,0'}, 2000);

        circ.node.onclick = function() {
            text.animate({opacity: 1}, 2000);
            circ.animate({opacity: 0}, 2000, function() {})
        };
    });

•例如,我如何能够替换第二行? $('#canvas')似乎不起作用。

•circ.node.onlick:是否可以使用jQuery完成处理程序?如何使用jQuery访问circ节点?

0 个答案:

没有答案