Skip to main content
ristenkAdobe
Participant
August 16, 2017
Answered

code snippet - continuous rotation

  • August 16, 2017
  • 3 replies
  • 1226 views

The code snippet works but it makes the movie clip go at super-speed and even if I edit it, it doesn't change and keeps going super speed. any thoughts, suggestions?

    This topic has been closed for replies.
    Correct answer RandomlyFish

    That isn't actually going faster and faster, if it would look like it would go backwards and stop at certain points. It's going extremely fast because it is rotating 10 degrees every frame. if the framerate is set to 30, then it is rotating 300 degrees every second. So you need to use a smaller value for the rotation to make it rotate slower.

    3 replies

    ristenkAdobe
    Participant
    August 17, 2017

    Here is a link:

    ferrisWheel

    Here is the code:

    this.addEventListener("tick",fl_RotateContinuously_4.bind(this));

    function fl_RotateContinuously_4(){

    this.movieClip_1.rotation+=10;

    }

    this.stop();

    Here is the output:

    WARNINGS:

    ** 30 Bitmaps packed successfully into 1 spritesheet(s).

    Frame numbers in EaselJS start at 0 instead of 1. For example, this affects gotoAndStop and gotoAndPlay calls. (2)

    I'm new to Animate CC. I have used Edge Animate in the past but trying to learn this new environment. Any help is so much appreciated. Thank you, Kristen

    RandomlyFishCorrect answer
    Inspiring
    August 17, 2017

    That isn't actually going faster and faster, if it would look like it would go backwards and stop at certain points. It's going extremely fast because it is rotating 10 degrees every frame. if the framerate is set to 30, then it is rotating 300 degrees every second. So you need to use a smaller value for the rotation to make it rotate slower.

    ristenkAdobe
    Participant
    August 17, 2017

    that did it.... put it at .5   Thank you!

    Inspiring
    August 16, 2017

    That will happen if the code gets repeated over and over again, which causes it stack event listeners. You could prevent that from happening by adding "this.stop();" on the frame with the rotation code.

    If you want to check if it is repeating the code, you can add "console.log("Repeat");" to the frame and then when you run in the browser you want to open the console by pressing F12.

    Legend
    August 16, 2017

    Since you've provided no details about what edits you've attempted, it's impossible to tell you exactly what you've done wrong.

    To make a continuous rotation go slower, where it says rotation+=10; just change the 10 to a smaller number.

    If the speed of the clip accelerates over time, it means you're running the rotation setup code repeatedly by looping the clip it's in. Don't do that.