Monday, October 03, 2011

Jittery ball

// not mine, but anonymous sketches are eventually cleaned up, so saving under my name

float x=100;
float y=100;
float dx=4+random(4.0);
float dy=4+random(4.0);
float ballsize=100;

void setup() {
  size(200, 200);
  frameRate(15);
  smooth();
}

void draw() {
  background(204, 102, 0);
  fill(245,212,212);
  ellipse(x,y,30 ,30);
  x=x+dx;
  y=y+dy;
  if (x<0 || x>200)
      dx=-1*dx;
  if (y<0 || y>20)
      dy=-1*dy;
}

info info

submitted by: DARYL_Gamma
views: 50
not mine, but anonymous sketches are eventually cleaned up, so saving under my name

treeThis sketch has a parent
Tags:

comments comment

loading loading...

 

Add a comment: