Making paths and images draggable in Raphael js

前端 未结 7 452
夕颜
夕颜 2021-01-31 10:45

Is it possible to be able to drag and drop objects other than just circles and rectangles around a page using Raphael js?

I want to add in paths and images which you can

7条回答
  •  温柔的废话
    2021-01-31 11:18

    Try this for non-circles. Circles attributes are different than images, text, etc, I think.

        var start = function () {
            this.ox = this.attr("x");
            this.oy = this.attr("y");
            this.animate({r: 70, opacity: .25}, 500, ">");
        },
        move = function (dx, dy) {
            this.attr({x: this.ox + dx, y: this.oy + dy});
        },
        up = function () {
            this.animate({r: 50, opacity: .5}, 500, ">");
        };
    

提交回复
热议问题