caryn- project 0

by caudenri @ 5:38 pm 12 January 2010

Part A
Not sure if the iframes are working for me, if not the links should still work.

GDE Error: Unable to load profile settings

caryn_project0.0

float angle = 90.0;
float padding = 0.015;
float count=0.0;
int start=50;
 
for(int i=0; i<90; i++) {
  count=0.0;
  angle=90.0;
  beginShape();
  for (float x=5.0; x<=width; x+=1) {
    float y = start+(cos(angle)*40.0);
    x += count*padding;
    vertex(x, y);
    angle+=PI/35.0;
    count++;
  }
  endShape();
  start += 5;
}

Part B
caryn-project-0

float ballX;
float ballY;
float ballXv;
float ballYv;
 
void setup() {
  size(300,300);
  smooth();
  noStroke();
  reset();
}
 
void draw() {
  background(24,201,234);
  ballX +=ballXv;
  ballY += ballYv;
 
  ellipseMode(CENTER);
  ellipse(ballX, ballY, 10, 10);
 
  //paddle
  rectMode(CENTER);
  int px=290;
  int ph=30;
  int ppos= constrain(mouseY, 0 , height);
  rect(px, ppos, 5, ph);
 
  //test for boundaries
  if (ballX < 0) {
    ballXv*=-1;
  }
  if ((ballY  height)) {
    ballYv*=-1;
  }
  if (((ballX>285) && (ballYmouseY-(ph/2))) {
    ballXv*=-1;
  }
}
 
void mousePressed() {
  reset();
}
 
void reset() {
  ballX= 1;
  ballY= height/2;
  ballXv= random(2.5, 3.5);
  ballYv= random(-1, 1);
}

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License.
(c) 2016 Special Topics in Interactive Art & Computational Design | powered by WordPress with Barecity