View Single Post
pixelbath pixelbath is offline 2009-05-29 #2 Old  
Code:
function weightMiddle(input:Number, strength:int = 2):Number {
	if (input < 0.5) return 1 - Math.pow(1 - input, strength) / 2;
	return 0.5 + Math.pow((input - 0.5) * 2, strength) / 2;
}
You may (or not) recognize this as the exploded version of the easeOutIn function from Flash's own easing equations. I only marginally tested it, but it seems to work.

Use the "strength" parameter to force it closer to middle distribution. Default value is 2, which still preserves some randomness.

You would use this function like this:

Code:
star.y = weightMiddle(Math.random()) * _mc.stage.stageHeight;
Reply With Quote