Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
Locked
0

Converting Actionscript Interactive animation to HTML5

Community Beginner ,
Oct 16, 2022 Oct 16, 2022

This is my code, I am getting no errors but the eye are not moving.

var root = this;
var container, var1, var2, var3, radius1, radius2, eyeR, eyeL;
var shapes = [];

function main()
{
root.stop();
container = root.container;
eyeR = root.eyeR;
eyeL = root.eyeL;
container.mouseChildren = false;
eyeR.mouseChildren = false;
eyeL.mouseChildren = false;
stage.enableMouseOver(20);
container.on("mouseMove", mouseMoved);
}

 

function mouseMoved(e)
{
var1 = e.stageY - 270 / stage.scaleY;
var2 = e.stageX - 380 / stage.scaleX;
var3 = e.stageX - 580 / stage.scaleX;
radius1 = Math.atan2(var1,var2);
radius2 = Math.atan2(var1, var3);
eyeR.setTransform(580,270,1,1,radius2);
eyeL.setTransform(380,270,1,1,radius1);
}

 

main();

 

 

This is how I made it work in P5.js and ActionScript for refernce on how it should work.

https://editor.p5js.org/JWNimble/sketches/4-cBgdHkH

 ActionScript Code

stage.addEventListener("mouseMove", arjun);
function arjun(e:MouseEvent):void
{
var var1 = mouseY - eyeR.y;
var var2 = mouseX - eyeR.x;
var radiusR = Math.atan2(var1,var2);
var degreeR = radiusR / (Math.PI / 180);
eyeR.rotation = degreeR;

var var3 = mouseY - eyeL.y;
var var4 = mouseX - eyeL.x;
var radiusR1 = Math.atan2(var3,var4);
var degreeR1 = radiusR1 / (Math.PI / 180);
eyeL.rotation = degreeR1;
}

79
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 17, 2022 Oct 17, 2022
LATEST

duplicated serveral times.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines