mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
PShape example updates
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
PShape s;
|
||||
|
||||
void setup() {
|
||||
size(640, 360, P3D);
|
||||
size(640, 360, P3D); // Not working in P2D?
|
||||
smooth();
|
||||
// Make a shape
|
||||
s = createShape();
|
||||
@@ -18,7 +18,8 @@ void setup() {
|
||||
s.vertex(-100,-100);
|
||||
s.vertex(100,-100);
|
||||
s.vertex(100,100);
|
||||
s.vertex(100,-100);
|
||||
s.vertex(-100,100);
|
||||
s.vertex(-100,-100);
|
||||
s.endContour();
|
||||
|
||||
// Interior part of shape
|
||||
@@ -26,7 +27,8 @@ void setup() {
|
||||
s.vertex(-10,-10);
|
||||
s.vertex(10,-10);
|
||||
s.vertex(10,10);
|
||||
s.vertex(10,-10);
|
||||
s.vertex(-10,10);
|
||||
s.vertex(-10,-10);
|
||||
s.endContour();
|
||||
|
||||
// Finishing off shape
|
||||
|
||||
@@ -9,14 +9,14 @@
|
||||
PShape group;
|
||||
|
||||
void setup() {
|
||||
size(640, 360, P2D);
|
||||
size(640, 360, P3D);
|
||||
smooth();
|
||||
// Create the shape as a group
|
||||
group = createShape(GROUP);
|
||||
|
||||
// Make a polygon PShape
|
||||
PShape star = createShape();
|
||||
star.fill(102);
|
||||
star.noFill();
|
||||
star.stroke(255);
|
||||
star.vertex(0, -50);
|
||||
star.vertex(14, -20);
|
||||
@@ -49,7 +49,7 @@ void setup() {
|
||||
// Add them all to the group
|
||||
group.addChild(star);
|
||||
group.addChild(path);
|
||||
group.addChild(rectangle);
|
||||
group.addChild(rectangle); // Rectangle is missing???
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ ParticleSystem ps;
|
||||
PImage sprite;
|
||||
|
||||
void setup() {
|
||||
size(640, 360, P3D);
|
||||
size(640, 360, P2D);
|
||||
// Load the image
|
||||
sprite = loadImage("sprite.png");
|
||||
// A new particle system with 10,000 particles
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
PShape path;
|
||||
|
||||
void setup() {
|
||||
size(640, 360, P3D);
|
||||
size(640, 360, P2D);
|
||||
smooth();
|
||||
// Create the shape
|
||||
path = createShape();
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
PShape star;
|
||||
|
||||
void setup() {
|
||||
size(640, 360,P3D);
|
||||
size(640, 360,P2D);
|
||||
smooth();
|
||||
// First create the shape
|
||||
star = createShape();
|
||||
|
||||
@@ -11,10 +11,10 @@
|
||||
ArrayList<Polygon> polygons;
|
||||
|
||||
void setup() {
|
||||
size(640, 360, P3D);
|
||||
size(640, 360, P2D);
|
||||
smooth();
|
||||
// Make a PShape
|
||||
PShape star = createShape(POLYGON);
|
||||
PShape star = createShape();
|
||||
star.fill(0,127);
|
||||
star.stroke(0);
|
||||
star.vertex(0, -50);
|
||||
|
||||
@@ -19,7 +19,7 @@ void setup() {
|
||||
void draw() {
|
||||
background(51);
|
||||
// We can dynamically set the stroke and fill of the shape
|
||||
circle.stroke(255);
|
||||
circle.stroke(255); // Not working in P2D??
|
||||
circle.fill(map(mouseX,0,width,0,255));
|
||||
// We can use translate to move the PShape
|
||||
translate(mouseX, mouseY);
|
||||
|
||||
@@ -47,7 +47,7 @@ class Wiggler {
|
||||
r.mult(4);
|
||||
r.add(pos);
|
||||
// Set the location of each vertex to the new one
|
||||
s.setVertex(i, r.x, r.y, r.z);
|
||||
s.setVertex(i, r.x, r.y);
|
||||
// increment perlin noise x value
|
||||
xoff+= 0.5;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user