Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- float x = 500;
- float y = 500;
- float speedX = 2;
- float speedY = 0.5f;
- float circleSize = 5;
- public void setup(){
- background(0xff80D7EA);
- }
- public void draw(){
- // Behavior
- fill(random(255), random(255), random(253, 150),75);
- stroke(random(255));
- x = x+speedX;
- y = y+speedY;
- circleSize = random(10, 45)/10;
- // Drawing the ellipse
- ellipse(x, y, 35, 35);
- //Reset the position
- x += speedX;
- if(x > width || x < 0){
- speedX *= -1;
- }
- y += speedY;
- if(y > height || y < 0){
- speedY *= -1;
- }
- }
- public void settings() { size(500, 500); }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement