Don't think I need Flade to pull this off. Although its nice.
What I whipped up so far:
import Timer;
function randomize( min:Number, max:Number ):Number {
var generator = Math.random()*(max-min);
generator = Math.round(min+generator);
return generator;
}
function spin():Void {
// Spinning time between 10 and 20 seconds
var nTime = randomize( 10000, 20000 );
var newTimer = new Timer();
var friction = nTime/200;
wheel.onEnterFrame = function(){
this._rotation += friction;
friction -= friction/30;
if (!newTimer.end){
newTimer.wait( nTime );
} else {
//trace( nTime/1000 + " secs passed!");
trace(this._rotation);
delete this.onEnterFrame;
}
}
}
spin();
Now, the divisions are merely magic numbers - they seem to work
fairly well... but I don't think this is the right way to do it.
Also, if I pick random points on the circle surface, how do I know
which is closest to the top (say the little pointer as centered top
above the wheel)?
edolecki
On Nov 23, 2005, at 8:01 PM, Alias wrote:
Check out Flade:
http://www.cove.org/flade/default.aspx
HTH
Alias
On 11/23/05, Eric E. Dolecki <[EMAIL PROTECTED]> wrote:
before i code one up myself - does anyone have the basic math for a
wheel of fortune type of spinning wheel? if it had a "flapper" that
would be a bonus. otherwise i can just randomize the total time of
spin, and let er rip, slowing the rotation down over time. random
number of possible "hits" on the wheel.
edolecki
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders