JSFiddle - React, Tailwind, and code Playground
by Jecs9
JavaScript
paper = Raphael(0, 0, 500, 500);
var ox = 0;
var oy = 0;
var screenSet = paper.set();
screenSet.push(paper.rect(0, 0, 100, 75, 0).attr({
fill: 'red', stroke: 'none'
}));
screenSet.push(paper.circle(10,10,5).attr({ "anchor": "start" }));
start = function() {
ox = this.attr("x");
oy = this.attr("y");
screenSet.attr({
opacity: 1
});
},
move = function(dx, dy) {
var att ={
x: ox + dx,
y:oy + dy
};
screenSet.attr(att);
},
up = function() {
this.attr({
opacity: .5
});
ox = 0, oy = 0;
};
screenSet.drag(move, start, up);