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

2D Rotate Graphic Symbol on Button Press?

Engaged ,
Feb 14, 2022 Feb 14, 2022

Copy link to clipboard

Copied

How should I change the following for rotating the graphic symbol 'RFLensHolder' clock-wise by 1 degree?

function updateRF_RotateCW(){
root.RFLensHolder.x+=1;
}

 

TOPICS
Code

Views

110

Translate

Translate

Report

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

correct answers 1 Correct answer

Engaged , Feb 15, 2022 Feb 15, 2022

OK, not getting any help here...

 

I got it working by adding a `+` before the `=` to increment the values of the rotation angle.

 

So:

function updateRF_RotateCW(){
var angle = 1/Math.PI;
root.RFLensHolder.rotation += angle;
}

However, I'm wondering if this is the **correct** way of doing that code. Any pointers?

Votes

Translate

Translate
Engaged ,
Feb 15, 2022 Feb 15, 2022

Copy link to clipboard

Copied

Tried the following and it roates the symbol 'VerticalRail' what looks like 1 degree CW.  But just the one time.  What to do?

 

//Right Frame Rotate CW Buttons
this.ButtonRotateCWRightFrame.addEventListener("mousedown", RF_RotateCW_Down.bind(this));

this.ButtonRotateCWRightFrame.addEventListener("pressup", RF_RotateCW_Up.bind(this));

this.ButtonRotateCCWRightFrame.addEventListener("mousedown", RF_RotateCCW_Down.bind(this));

this.ButtonRotateCCWRightFrame.addEventListener("pressup", RF_RotateCCW_Up.bind(this));


//Right Frame Rotate CW Buttons functions to move Rotate Frame CW
function RF_RotateCW_Down() {
createjs.Ticker.addEventListener("tick",updateRF_RotateCW);
}

function RF_RotateCW_Up() {
createjs.Ticker.removeEventListener("tick",updateRF_RotateCW);
}

function updateRF_RotateCW(){

 var angle = 1/Math.PI;
  root.VerticalRail.rotation = angle;
}

 

Votes

Translate

Translate

Report

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
Engaged ,
Feb 15, 2022 Feb 15, 2022

Copy link to clipboard

Copied

LATEST

OK, not getting any help here...

 

I got it working by adding a `+` before the `=` to increment the values of the rotation angle.

 

So:

function updateRF_RotateCW(){
var angle = 1/Math.PI;
root.RFLensHolder.rotation += angle;
}

However, I'm wondering if this is the **correct** way of doing that code. Any pointers?

Votes

Translate

Translate

Report

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