Examples updates to 640 x 360 pixels

This commit is contained in:
Casey Reas
2011-08-05 18:26:51 +00:00
parent f1c7aabf14
commit 9b7de8d6b7
52 changed files with 295 additions and 302 deletions
+13 -8
View File
@@ -6,13 +6,18 @@
* the last point. The middle parameters set the control points
* that define the shape of the curve.
*/
size(640, 360);
background(0);
stroke(255);
noFill();
smooth();
for(int i = 0; i < 200; i += 20) {
bezier(180-(i/2.0), 40+i, 410, 20, 440, 300, 240-(i/16.0), 300+(i/8.0));
void setup() {
size(640, 360);
stroke(255);
noFill();
smooth();
}
void draw() {
background(0);
for (int i = 0; i < 200; i += 20) {
bezier(mouseX-(i/2.0), 40+i, 410, 20, 440, 300, 240-(i/16.0), 300+(i/8.0));
}
}
@@ -13,11 +13,6 @@ int x;
int y;
float outerRad;
float innerRad;
float px = 0;
float py = 0;
float angle = 0;
float pts = 36;
float rot = 360.0/pts;
void setup() {
size(640, 360);
@@ -30,10 +25,16 @@ void setup() {
}
void draw() {
background(204);
int pts = int(map(mouseX, 0, width, 6, 60));
float rot = 180.0/pts;
float angle = 0;
beginShape(TRIANGLE_STRIP);
for (int i = 0; i < pts; i++) {
px = x + cos(radians(angle)) * outerRad;
py = y + sin(radians(angle)) * outerRad;
for (int i = 0; i <= pts; i++) {
float px = x + cos(radians(angle)) * outerRad;
float py = y + sin(radians(angle)) * outerRad;
angle += rot;
vertex(px, py);
px = x + cos(radians(angle)) * innerRad;