JSFiddle - React, Tailwind, and code Playground
HTML
<div id="result"></div>
<!-- пример сайта know-online.com -->
CSS
#result {
width: 500px; height:500px;
}
JavaScript
var canvas = Raphael("result");
var circle = canvas.circle(30, 30, 15).attr({
'fill':'#0F0',
'cursor': 'pointer'
});
// код перед началом передвижения объекта
var start = function () {
this.ox = this.attr("cx");
this.oy = this.attr("cy");
};
// код во время передвижения объекта
var move = function (dx, dy) {
this.attr({cx: this.ox + dx, cy: this.oy + dy});
};
// код после передвижения объекта
var stop = function () {};
// перемещение объекта
circle.drag(move, start, stop);