Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Constants
- var CIRCLES_PER_SPLATTER = 20;
- var MIN_RADIUS = 5;
- var MAX_RADIUS = 25;
- var DELAY = 500;
- var circle;
- var radius;
- var color;
- var positionX;
- var positionY;
- /* This program creates a paint splatter.
- * IT'S ART!. */
- function start(){
- setTimer(splater, DELAY);
- }
- //creates the splater
- function splater(){
- color = Randomizer.nextColor();
- for(var i = 0; i < CIRCLES_PER_SPLATTER; i++){
- radius = Randomizer.nextInt(MIN_RADIUS, MAX_RADIUS);
- positionX = Randomizer.nextInt(0 , getWidth());
- positionY = Randomizer.nextInt(0 , getHeight());
- circle = new Circle(radius);
- circle.setColor(color);
- circle.setPosition(positionX, positionY);
- add(circle)
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement