📜  指向鼠标灯芯编辑器 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:08.290000             🧑  作者: Mango

代码示例1
onEvent('update', function () {
    pointTo(this, mouseX, mouseY);
});

function pointTo(obj, loc_x, loc_y) {
    angle = Math.atan2(loc_x - obj.x, - (loc_y - obj.y) )*(180/Math.PI);      
    obj.rotation = angle;
}