Created
December 10, 2014 20:49
-
-
Save arun057/4dfca20c46f1ff0238e2 to your computer and use it in GitHub Desktop.
Fancy Loading screen
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://www.reddit.com/r/gifs/comments/2on8si/connecting_to_server_so_mesmerizing/cmow0sz | |
private const NUM_BALL:int = 24; | |
private var loadingBall:Vector.<Shape> = new Vector.<Shape>(NUM_BALL); | |
private var timeStep:int = 0; | |
private const BALL_HEIGHT:int = 40; | |
public function animateBalls(e:Event):void | |
{ | |
for (var i:int = 0; i < NUM_BALL; i++ ) | |
{ | |
loadingBall[i].graphics.clear(); | |
loadingBall[i].graphics.beginFill(0x0B5F95); | |
loadingBall[i].graphics.drawCircle(455+5*i,getY(i,timeStep),2); | |
} | |
timeStep++; | |
} | |
public function getY(i:int, t:int):int | |
{ | |
return 260 + BALL_HEIGHT/2 * (1 + Math.sin((timeStep * (i/500 + 0.02)) % 2*Math.PI)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment