Skip to content

Instantly share code, notes, and snippets.

@mplacona
Created March 30, 2014 19:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mplacona/9878513 to your computer and use it in GitHub Desktop.
Save mplacona/9878513 to your computer and use it in GitHub Desktop.
void main() {
var canvas = querySelector('#stage');
ctx = canvas.getContext('2d');
// resize canvas
canvas.width = W;
canvas.height = H;
// create random flakes
for(int i = 0; i < maxFlakes; i++){
flakes.add(
new Flake(
rng.nextDouble() * W,
rng.nextDouble() * H,
rng.nextDouble() * 3,
rng.nextDouble() * maxFlakes
)
);
}
// make the magic happen every 30 milliseconds
new Timer.periodic(thirtyMills, (Timer t) => snowFall());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment