From a3b556dfd2a4c5bbd2693b3e58499fadbdc8f820 Mon Sep 17 00:00:00 2001 From: shiffman Date: Thu, 19 Jul 2012 16:27:02 +0000 Subject: [PATCH] some fixes in PShape examples --- .../Create Shapes/BeginEndContour/BeginEndContour.pde | 1 + .../Topics/Create Shapes/GroupPShape/GroupPShape.pde | 1 - .../examples/Topics/Create Shapes/PathPShape/PathPShape.pde | 6 +++--- .../Topics/Create Shapes/PolygonPShape/PolygonPShape.pde | 1 + .../examples/Topics/Create Shapes/PolygonPShapeOOP/Star.pde | 5 +++-- .../Create Shapes/PrimitivePShape/PrimitivePShape.pde | 4 ++-- .../Topics/Create Shapes/WigglePShape/WigglePShape.pde | 2 +- java/examples/Topics/Create Shapes/WigglePShape/Wiggler.pde | 1 + 8 files changed, 12 insertions(+), 9 deletions(-) diff --git a/java/examples/Topics/Create Shapes/BeginEndContour/BeginEndContour.pde b/java/examples/Topics/Create Shapes/BeginEndContour/BeginEndContour.pde index e4239f47a..0412ab524 100644 --- a/java/examples/Topics/Create Shapes/BeginEndContour/BeginEndContour.pde +++ b/java/examples/Topics/Create Shapes/BeginEndContour/BeginEndContour.pde @@ -13,6 +13,7 @@ void setup() { s = createShape(); s.noFill(); s.stroke(255); + s.strokeWeight(2); // Exterior part of shape s.beginContour(); s.vertex(-100,-100); diff --git a/java/examples/Topics/Create Shapes/GroupPShape/GroupPShape.pde b/java/examples/Topics/Create Shapes/GroupPShape/GroupPShape.pde index 0fc05e2d9..0efef722a 100644 --- a/java/examples/Topics/Create Shapes/GroupPShape/GroupPShape.pde +++ b/java/examples/Topics/Create Shapes/GroupPShape/GroupPShape.pde @@ -64,6 +64,5 @@ void draw() { // Display the group PShape translate(mouseX, mouseY); shape(group); - } diff --git a/java/examples/Topics/Create Shapes/PathPShape/PathPShape.pde b/java/examples/Topics/Create Shapes/PathPShape/PathPShape.pde index dd76c39e5..09a148036 100644 --- a/java/examples/Topics/Create Shapes/PathPShape/PathPShape.pde +++ b/java/examples/Topics/Create Shapes/PathPShape/PathPShape.pde @@ -8,13 +8,13 @@ PShape path; void setup() { - size(640, 360, P2D); + size(640, 360, P3D); smooth(); // Create the shape path = createShape(); // Set fill and stroke path.noFill(); - path.stroke(0); + path.stroke(255); path.strokeWeight(2); float x = 0; @@ -29,7 +29,7 @@ void setup() { } void draw() { - background(255); + background(51); // Draw the path at the mouse location translate(mouseX, mouseY); shape(path); diff --git a/java/examples/Topics/Create Shapes/PolygonPShape/PolygonPShape.pde b/java/examples/Topics/Create Shapes/PolygonPShape/PolygonPShape.pde index 55a093595..b4a88a477 100644 --- a/java/examples/Topics/Create Shapes/PolygonPShape/PolygonPShape.pde +++ b/java/examples/Topics/Create Shapes/PolygonPShape/PolygonPShape.pde @@ -16,6 +16,7 @@ void setup() { // You can set fill and stroke star.fill(102); star.stroke(255); + star.strokeWeight(2); // Here, we are hardcoding a series of vertices star.vertex(0, -50); star.vertex(14, -20); diff --git a/java/examples/Topics/Create Shapes/PolygonPShapeOOP/Star.pde b/java/examples/Topics/Create Shapes/PolygonPShapeOOP/Star.pde index 7e829fc80..9899910d1 100644 --- a/java/examples/Topics/Create Shapes/PolygonPShapeOOP/Star.pde +++ b/java/examples/Topics/Create Shapes/PolygonPShapeOOP/Star.pde @@ -15,6 +15,7 @@ class Star { // You can set fill and stroke s.fill(102); s.stroke(255); + s.strokeWeight(2); // Here, we are hardcoding a series of vertices s.vertex(0, -50); s.vertex(14, -20); @@ -33,8 +34,8 @@ class Star { void move() { // Demonstrating some simple motion x++; - if (x > width) { - x = 0; + if (x > width+100) { + x = -100; } } diff --git a/java/examples/Topics/Create Shapes/PrimitivePShape/PrimitivePShape.pde b/java/examples/Topics/Create Shapes/PrimitivePShape/PrimitivePShape.pde index 995fc70b3..ab45101a2 100644 --- a/java/examples/Topics/Create Shapes/PrimitivePShape/PrimitivePShape.pde +++ b/java/examples/Topics/Create Shapes/PrimitivePShape/PrimitivePShape.pde @@ -13,7 +13,7 @@ void setup() { smooth(); // Creating the PShape as an ellipse // The corner is -50,-50 so that the center is at 0,0 - circle = createShape(ELLIPSE,-50,-50,100,100); + circle = createShape(RECT,-50,-25,100,50); } void draw() { @@ -21,7 +21,7 @@ void draw() { // We can dynamically set the stroke and fill of the shape circle.stroke(255); circle.strokeWeight(4); - circle.fill(map(mouseX,0,width,0,255)); // Not working in P2D?? + circle.fill(map(mouseX,0,width,0,255)); // We can use translate to move the PShape translate(mouseX, mouseY); // Drawing the PShape diff --git a/java/examples/Topics/Create Shapes/WigglePShape/WigglePShape.pde b/java/examples/Topics/Create Shapes/WigglePShape/WigglePShape.pde index 800d86b48..972c11bc5 100644 --- a/java/examples/Topics/Create Shapes/WigglePShape/WigglePShape.pde +++ b/java/examples/Topics/Create Shapes/WigglePShape/WigglePShape.pde @@ -9,7 +9,7 @@ Wiggler w; void setup() { - size(640, 360, P3D); + size(640, 360, P2D); smooth(); w = new Wiggler(); } diff --git a/java/examples/Topics/Create Shapes/WigglePShape/Wiggler.pde b/java/examples/Topics/Create Shapes/WigglePShape/Wiggler.pde index d8971aca1..bb601dccd 100644 --- a/java/examples/Topics/Create Shapes/WigglePShape/Wiggler.pde +++ b/java/examples/Topics/Create Shapes/WigglePShape/Wiggler.pde @@ -30,6 +30,7 @@ class Wiggler { s = createShape(); s.fill(127); s.stroke(0); + s.strokeWeight(2); for (PVector v : original) { s.vertex(v.x, v.y); }