16.3.15

Draw a Circle 6

Okay, here is the part that we need to change to make the radius of the circle bigger (It's at the bottom of the program):


    cirqx = cirqx + (Math.sin(angle) * 5) ;
    cirqy = cirqy - (Math.cos(angle) * 5) ;
    angle = angle + 3;









Basically, the Math.sin and Math.cos functions are going to produce a number between 0 and 1. We don't want to use such small numbers because nobody would see a difference, so we had to scale them by multiplying by five. The scaling amount just wasn't enough, though. We won't go too overboard with the scaling factor though.

  cirqx = cirqx + (Math.sin(angle) * 200) ;
    cirqy = cirqy - (Math.cos(angle) * 200) ;
    angle = angle + 3;

Oh, and just so you know, there's a very specific reason why we are adding to the circle's x position and taking away from the circle's y position. See in Flash, the y value extends from top to bottom, not bottom to top. So when you subtract from y you're actually going up. You can add if you want, but I would rather let up be up. Also, look at the amount added to the angle - 3. There is a very specific reason why we're using 3 and not another number. This is part of the "happy error" I was talking about in the previous post. 

No comments:

Post a Comment