JSFiddle - React, Tailwind, and code Playground

HTML

<div id="paper" />

CSS

#paper {
    border: solid 1px;
    width: 300px;
    height: 260px;
}

JavaScript

var R = Raphael("paper", 300, 260);
var p = R.path('M0 0L100 0L50 80Z');

p.attr({
    "fill": "green",
    'opacity':0.8
});

var start = function(x, y) {
    this.attr({
        opacity: 1
    });
    this.lastX = x;
    this.lastY = y;
},
    move = function(dx, dy, x, y) {
        var deltaX = x - this.lastX;
        var deltaY = y - this.lastY;
        this.translate(deltaX, deltaY);
        this.lastX = x;
        this.lastY = y;
    },
    up = function() {
        this.attr({
            opacity: 0.8
        });
    };

p.drag(move, start, up);