Friday, April 8, 2011
Wednesday, March 2, 2011
Monday, February 14, 2011
laptop-redesign
Thursday, February 10, 2011
Learn to Code - Lesson 04 - Understanding Functions and Making a Guessing Game
http://www.youtube.com/watch?feature=player_detailpage&v=tVw1cZUk7_s
Modified clone of 'Modified clone of 'Spinner''
This is how the code looks after I made adjustments to it
int i = 50;
int step = 3;
void setup() {
background(800);
size(400, 400);
smooth();
frameRate(40);
strokeWeight(10);
noFill();
}
void draw() {
background(600);
translate(width/3, height/3);
for (n = 0; n < 130; n++) {
stroke(0, n*4, 300-n, n/2);
rotate(radians(0 + (n * 22)));
ellipse(30 + (sin(radians(i * 14))), 27 - i/4, 102, 80 + i);
}
if (i > 180) {
step *= -2;
}
if (i < -28) {
step *= -2;
}
i+=step;
}
int i = 50;
int step = 3;
void setup() {
background(800);
size(400, 400);
smooth();
frameRate(40);
strokeWeight(10);
noFill();
}
void draw() {
background(600);
translate(width/3, height/3);
for (n = 0; n < 130; n++) {
stroke(0, n*4, 300-n, n/2);
rotate(radians(0 + (n * 22)));
ellipse(30 + (sin(radians(i * 14))), 27 - i/4, 102, 80 + i);
}
if (i > 180) {
step *= -2;
}
if (i < -28) {
step *= -2;
}
i+=step;
}
Modified clone of 'Modified clone of 'Spinner''
Original code before I touched or made adjustments to
int i = 50;
int step = 3;
void setup() {
background(255);
size(400, 400);
smooth();
frameRate(30);
strokeWeight(8);
noFill();
}
void draw() {
background(255);
translate(width/2, height/2);
for (n = 0; n < 128; n++) {
stroke(0, n*2, 256-n, n/2);
rotate(radians(0 + (n * 15)));
ellipse(30 + (sin(radians(i * 12))), 25 - i/2, 100, 75 + i);
}
if (i > 160) {
step *= -1;
}
if (i < -25) {
step *= -1;
}
i+=step;
int i = 50;
int step = 3;
void setup() {
background(255);
size(400, 400);
smooth();
frameRate(30);
strokeWeight(8);
noFill();
}
void draw() {
background(255);
translate(width/2, height/2);
for (n = 0; n < 128; n++) {
stroke(0, n*2, 256-n, n/2);
rotate(radians(0 + (n * 15)));
ellipse(30 + (sin(radians(i * 12))), 25 - i/2, 100, 75 + i);
}
if (i > 160) {
step *= -1;
}
if (i < -25) {
step *= -1;
}
i+=step;
modified clone of 'jump_ball'
This is the code which i changed to make it look different
// This sketch builds on a prior work, "jump_ball", created by JohnFisher
// http://studio.sketchpad.cc/sp/pad/view/ro.9hxUTjjyJyPrA/rev.374
// This sketch builds on a prior work created by Claudio Pinho
// http://studio.sketchpad.cc/sp/pad/view/Xa5LH0mNcc/rev.1074
//Teste 1
myCircle c1 = new myCircle(width/23, 1, 11);
float vy = 0.2;
float gravity = 0.888;
void setup(){
size(300, 600);
frameRate(40);
smooth();
}
void draw() {
background(323*PI,332,102*vy);
c1.update();
}
class myCircle {
float xpos, ypos, radius, mass, lypos;
myCircle (float x, float y, float r) {
xpos = x;
ypos = y;
radius = r+64;
mass = (PI * (radius*5));
}
void update(){
//calc of velocity
vy += mass / (mass-20 * gravity/54);
//position is updated
ypos += vy;
//basic bottom collision
if(ypos > height-radius) {
ypos = height - radius;
vy *= -.9;
}
//if last y position is equivalent to the actual y position
//then the program stops
if(lypos == ypos && lvy == vy) {
ypos = height - radius;
println("stoped");
noLoop();
}
ellipse(xpos, ypos, radius*3, radius*3);
strokeWeight(3);
line(xpos, ypos-53, radius*2+33, radius*2-20);
//record the last y position and y velocity
lypos = ypos;
lvy = vy;
// This sketch builds on a prior work, "jump_ball", created by JohnFisher
// http://studio.sketchpad.cc/sp/pad/view/ro.9hxUTjjyJyPrA/rev.374
// This sketch builds on a prior work created by Claudio Pinho
// http://studio.sketchpad.cc/sp/pad/view/Xa5LH0mNcc/rev.1074
//Teste 1
myCircle c1 = new myCircle(width/23, 1, 11);
float vy = 0.2;
float gravity = 0.888;
void setup(){
size(300, 600);
frameRate(40);
smooth();
}
void draw() {
background(323*PI,332,102*vy);
c1.update();
}
class myCircle {
float xpos, ypos, radius, mass, lypos;
myCircle (float x, float y, float r) {
xpos = x;
ypos = y;
radius = r+64;
mass = (PI * (radius*5));
}
void update(){
//calc of velocity
vy += mass / (mass-20 * gravity/54);
//position is updated
ypos += vy;
//basic bottom collision
if(ypos > height-radius) {
ypos = height - radius;
vy *= -.9;
}
//if last y position is equivalent to the actual y position
//then the program stops
if(lypos == ypos && lvy == vy) {
ypos = height - radius;
println("stoped");
noLoop();
}
ellipse(xpos, ypos, radius*3, radius*3);
strokeWeight(3);
line(xpos, ypos-53, radius*2+33, radius*2-20);
//record the last y position and y velocity
lypos = ypos;
lvy = vy;
Subscribe to:
Posts (Atom)




















