Last active
December 21, 2016 11:34
-
-
Save jeonghopark/e37835b40194ab2015d6f03e3ccdb466 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import peasy.*; | |
| PeasyCam camera; | |
| ArrayList<PVector> meshPos = new ArrayList(); | |
| float xStep = 20; | |
| float yStep = 20; | |
| int meshNUM = 20; | |
| PShape meshStrip; | |
| FloatList movingV = new FloatList(); | |
| void setup() { | |
| size(800, 500, P3D); | |
| camera = new PeasyCam(this, 400); | |
| meshStrip = createShape(); | |
| for (int i=0; i<meshNUM; i++) { | |
| meshPos.add(new PVector( i * xStep, 0, 0) ); | |
| } | |
| meshStrip.beginShape(TRIANGLE_STRIP); | |
| meshStrip.stroke(0, 40); | |
| for (int i=0; i<meshPos.size(); i++) { | |
| meshStrip.vertex(meshPos.get(i).x, meshPos.get(i).y, meshPos.get(i).z); | |
| meshStrip.vertex(meshPos.get(i).x, meshPos.get(i).y + yStep, meshPos.get(i).z); | |
| } | |
| meshStrip.endShape(CLOSE); | |
| } | |
| void draw() { | |
| background(120); | |
| for (int i=0; i<meshStrip.getVertexCount(); i+=1) { | |
| movingV.set(i, sin(radians(i * 360.0/meshStrip.getVertexCount() + frameCount * 2)) * 30); | |
| PVector _v = new PVector(meshStrip.getVertex(i).x, meshStrip.getVertex(i).y, movingV.get(i)); | |
| meshStrip.setVertex(i, _v); | |
| } | |
| translate(-xStep * meshNUM * 0.5, 0); | |
| shape(meshStrip, 0, 0); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.