mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
Examples updates to 640 x 360 pixels
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user