Adobe Animate CC JavaScript:当响应处于活动状态时,鼠标随动器未对齐
Adobe Animate CC JavaScript: Mouse follower is not aligned when responsive is active
我已经在 Adobe Animate CC 上创建了一个网站,我使用以下代码片段完成了鼠标跟随:
this.stage.canvas.style.cursor = "none";
this.mouseEnabled = true;
this.addEventListener("tick", fl_CustomMouseCursor.bind(this));
function fl_CustomMouseCursor() {
this.plus_mc.x = stage.mouseX;
this.plus_mc.y = stage.mouseY;
this.black_plus_mc.x = stage.mouseX;
this.black_plus_mc.y = stage.mouseY;
}
当我检查使其在发布设置时响应时,随动器未与鼠标光标对齐,只有当我将光标定位在浏览器左上角时它才会对齐,然后它会随着我移动光标而变远。
我通过 ClayUUID 从 Adobe 论坛找到了解决方案:
我把坐标除以stage.scaleX和scaleY。
以下是使页面响应且光标跟随器对齐的正确代码:
this.stage.canvas.style.cursor = "none";
this.mouseEnabled = true;
this.addEventListener("tick", fl_CustomMouseCursor.bind(this));
function fl_CustomMouseCursor() {
this.plus_mc.x = stage.mouseX / stage.scaleX;
this.plus_mc.y = stage.mouseY / stage.scaleY;
this.black_plus_mc.x = stage.mouseX / stage.scaleX;
this.black_plus_mc.y = stage.mouseY / stage.scaleY;
}
谢谢
我已经在 Adobe Animate CC 上创建了一个网站,我使用以下代码片段完成了鼠标跟随:
this.stage.canvas.style.cursor = "none";
this.mouseEnabled = true;
this.addEventListener("tick", fl_CustomMouseCursor.bind(this));
function fl_CustomMouseCursor() {
this.plus_mc.x = stage.mouseX;
this.plus_mc.y = stage.mouseY;
this.black_plus_mc.x = stage.mouseX;
this.black_plus_mc.y = stage.mouseY;
}
当我检查使其在发布设置时响应时,随动器未与鼠标光标对齐,只有当我将光标定位在浏览器左上角时它才会对齐,然后它会随着我移动光标而变远。
我通过 ClayUUID 从 Adobe 论坛找到了解决方案:
我把坐标除以stage.scaleX和scaleY。
以下是使页面响应且光标跟随器对齐的正确代码:
this.stage.canvas.style.cursor = "none";
this.mouseEnabled = true;
this.addEventListener("tick", fl_CustomMouseCursor.bind(this));
function fl_CustomMouseCursor() {
this.plus_mc.x = stage.mouseX / stage.scaleX;
this.plus_mc.y = stage.mouseY / stage.scaleY;
this.black_plus_mc.x = stage.mouseX / stage.scaleX;
this.black_plus_mc.y = stage.mouseY / stage.scaleY;
}
谢谢