Flasher Archive

[Previous] [Next] - [Index] [Thread Index] - [Previous in Thread] [Next in Thread]


Subject: Re: FLASH: starfield using arctangent available!
From: Kurt Dommermuth
Date: Tue, 4 Jul 2000 22:17:18 +0100


>Without looking at the FLA (not at a computer with Flash :( can I ask what
>you are using the arctan() for?
>Perspective effects are a simple z divide. Or am I missing something?
>
>Barry
>gerbilattheburrow [dot] co [dot] uk


Hi Barry,

I don't know what z divide means. If you could explain I would appreciate
very much. Frankly, I know very little math and am trying to learn as much
as I can.

I'd be glad to know there was a simpler solution than arctan to solve my
problem. I wrote to the list last week asking about this and no one
offered a better way! As convoluted as this became, I know there must be
and all you math jocks were just holdin out on me dammit.

Anyway, I started to go into the long explanation of what I was doing and
thought maybe it would be clearer to just include the code....

Set Variable: "count" = count + 1
Set Variable: "j" = 0
Loop While (j < 10)
Set Variable: "p" = count &j
Duplicate Movie Clip ("/star", "star" &p, p)
Set Variable: "locationX" = Random (100) + 350
Set Variable: "locationY" = Random (100) + 150
Set Variable: "scale" = Random (30) + 30
Set Property ("/star" &p, X Position) = locationX
Set Property ("/star" &p, Y Position) = locationY
Set Property ("/star" &p, X Scale) = scale
Set Property ("/star" &p, Y Scale) = scale
Comment: Determine Center of Screen
Set Variable: "x" = (locationY - 200) / (locationX - 400)
Comment: **************************
Comment: Begin Arctan Function
If (x > -1.0 and x < 1.0)
Set Variable: "arctan" = x-(x*x*x/3)+(x*x*x*x*x/5)-(x*x*x*x*x*x*x/7)
Set Variable: "output" = (arctan * 180) / 3.1416
Else If (x >= 1)
Set Variable: "arctan" = (3.1416 / 2) - (1 / x) + (1 / ( 3 * (x*x*x))) - (1
/ (5 * (x*x*x*x*x))) + (1 / (7 * (x*x*x*x*x*x*x)))
Set Variable: "output" = (arctan * 180) / 3.1416
Else If (x <= -1)
Set Variable: "arctan" = - (3.1416 / 2) - (1 / x) + (1 / ( 3 * (x*x*x))) -
(1 / (5 * (x*x*x*x*x))) + (1 / (7 * (x*x*x*x*x*x*x)))
Set Variable: "output" = (arctan * 180) / 3.1416
End If
Comment: End Arctan Function
Comment: *************************
Comment: Output is between -90 and 90 degrees. The following compensates
for this. Anything left of center we add 180 degrees.
If (locationX < 400)
Set Property ("/star" &p, Rotation) = output +180
Else
Set Property ("/star" &p, Rotation) = output
End If
Set Variable: "j" = j + 1
End Loop

Basically just telling a randomly placed MC to find the center of the
screen and rotate directly away from it. I tried turning it inwards which
was cool and also used the mouse coordinates as the center and that was
pretty cool too.

Again, if you know a better way I would be grateful as I really would love
to use this in a clients animation I'm currently working on and as it
stands now it is probably too processor intensive.

Muchos Gracias,
Kurt
http://www.dommermuth-1.com


flasher is generously supported by...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
flashforward2000 and the Flash(tm) Film Festival
July 24-26, 2000, NEW YORK CITY, Hammerstein Ballroom
www.flashforward2000.com
Produced by United Digital Artists and lynda.com
Sponsored by Macromedia, Adobe Systems, Fusion, Inc, AtomFilms,
shockwave.com and Electric Rain.
1.877.4.FLASH.4 or (1.805.640.6679 outside the US and Canada)
Register before June 30 and save $200!!-- www.flashforward2000.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To unsubscribe or change your list settings go to
http://www.chinwag.com/flasher or email helpatchinwag [dot] com


Replies
  Re: FLASH: starfield using arctangent av, Barry Swan

[Previous] [Next] - [Index] [Thread Index] - [Next in Thread] [Previous in Thread]