Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8253293
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T00:49:57+00:00 2026-06-08T00:49:57+00:00

This is in part an EaselJS problem and in part a Physics/animation programming question.

  • 0

This is in part an EaselJS problem and in part a Physics/animation programming question.

I’m trying to learn EaselJS by studying the examples included in the EaselJS zip file. Right now, I’m looking at the SimpleTransform example,(http://bit.ly/LebvtV) where the robot rotates and fades into the background and expands towards the foreground. I find this effect really cool, and would like to learn how to achieve it. However, when I came to this set of code, I’m lost:

function tick() {
angle += 0.025;
var value = (Math.sin(angle) * 360);
bmp.setTransform (bmp.x , bmp.y , bmp.scaleX , bmp.scaleY , value/2 , bmp.skewX, bmp.skewY , bmp.regX , bmp.regY );
bmp.scaleX = bmp.scaleY = ((value)/360) + 0.25;
stage.update();
}

(For those unfamiliar with EaselJS, tick() is a function that dictates the actions on each tick, whose interval is set with setFPS. So if I’ve set FPS to be 20, then tick() will execute its statements 20 times in a second. I believe. And bmp here is a Bitmap object that points to the robot image.)

I’ve never been a wizard in Math, but I do understand the basics. I can see that angle += 0.025; is used to increased the angle variable so that the value passed into setTransform can change with time. However, I can’t understand why a) 0.025 is used. b) what (Math.sin(angle) * 360) and ((value)/360) + 0.25 means, and c) why value is not just passed into setTransform, but divided by 2 (value/2).

I know it might be a challenge to explain this here, but any help is appreciated. In fact, if anyone thinks I’m a noob and needs to go study some Physics first, I’ll most appreciate if someone can point me to a resource (book/url) for me to turn to.

Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T00:49:58+00:00Added an answer on June 8, 2026 at 12:49 am

    I can understand why you are confused. The code isn’t efficient and that makes it harder to figure out what is going on. But here is the gist of it:

    a) 0.025 is used because it is approximately π/125. With a Ticker speed of 25FPS, this means that the angle value will start at 0 and get to π at just about 5 seconds. π is used because Math.sin uses radians, not degrees (π radians == 180 degrees)

    b) Math.sin(angle) will essentially start at 0, increase until it hits 1, decrease until it hits -1, then increase back to 0 — all over a period of 10 seconds with sinusoidal rhythm.

    (Math.sin(angle) * 360) has the same behavior as Math.sin(angle), just with a range of -360 to 360.

    ((value)/360) + 0.25) has the same behavior as Math.sin(angle), just with a range of -0.75 to 1.25.

    c) value/2 is there so the robot only rotates 180 degrees instead of 360 degrees. I know what you are thinking — why multiply by 360 only to divide by 2 one line later? Well, there is no reason for it really.

    Here’s a slightly clearer version of tick:

        function tick() {
            angle += Math.PI/125;
            var sineValue = Math.sin(angle);
    
            bmp.rotation = sineValue * 180;
            bmp.scaleX = bmp.scaleY = sineValue + 0.25;
    
            stage.update();
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm stuck at this part... I'm trying to get the ID to be included
This question is a combination of regex practice and unit testing practice. Regex part
This part of my code was creating xls file successfuly FileOutputStream fileOut = new
I'm trying to explode this part of a json string from Google's currency calc:
This page allows users to add questions dynamically (this part works), within each question
still have problem with this part of code: @interface MYAccessMp3Tags: NSObject { NSTimeInterval duration;
I'm trying this part of my script and it work perfectly if win32gui.GetCursorInfo()[1] ==
I'm stuck at this part.. Trying to get a simple AjaxPost to post some
I am having a problem adjusting this part of my SQL statement: HAVING dbo.BOOKINGS.BOOKED
This part of the question provides background information and can be ignored I am

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.