Java Code Examples for processing.core.PGraphics#rotateX()
The following examples show how to use
processing.core.PGraphics#rotateX() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ShaderSSAO.java From haxademic with MIT License | 6 votes |
protected void drawCubesInCircle(PGraphics pg) { // spin it pg.rotateZ(progressRads); // draw plane pg.fill(100); pg.rect(0, 0, p.width * 3, p.height * 3); float radius = pg.width * 0.2f; for (int i = 0; i < 14; i++) { pg.fill(200f + 55f * P.sin(i), 200f + 55f * P.cos(i * 2f), 200f + 55f * P.sin(i)); pg.pushMatrix(); pg.translate(radius * P.sin(i + progressRads), radius * P.cos(i + progressRads), 0); pg.rotateX(progressRads + i); pg.rotateY(progressRads + i); pg.box(pg.height * 0.2f); pg.popMatrix(); } }
Example 2
Source File: ShaderSSAO.java From haxademic with MIT License | 6 votes |
protected void drawFewCubes(PGraphics pg) { // spin it pg.rotateX(P.PI/3 + P.sin(progressRads) * 0.1f); // draw plane pg.fill(255); pg.rect(0, 0, p.width * 3, p.height * 3); float radius = pg.width * 0.2f; for (int i = 0; i < 24; i++) { pg.fill(60f + 55f * P.sin(i), 170f + 35f * P.cos(i * 2f), 150f + 75f * P.sin(i)); pg.pushMatrix(); // pg.translate(radius * P.sin(i/3f + progressRads), radius * P.cos(i/3f + progressRads), 0); pg.rotateX(P.TWO_PI * p.noise(i + 0.1f * P.cos(progressRads + i))); pg.rotateY(P.TWO_PI * p.noise(i + 0.1f * P.sin(progressRads + i))); pg.rotateZ(P.TWO_PI * p.noise(i + 0.1f * P.sin(progressRads + i * 20f))); pg.box( pg.height * P.sin(i + progressRads), pg.height * P.sin(i + progressRads) * 0.1f, pg.height * P.sin(i + progressRads) * 0.1f ); pg.popMatrix(); } }
Example 3
Source File: WashHands.java From haxademic with MIT License | 6 votes |
public void update(PGraphics pg) { pg.push(); pg.translate(pg.width * x, pg.height * y, 0); // -0.25f -0.33f if(FrameLoop.isTick()) { if(FrameLoop.curTick() == tickShow) wordWashEase.setInc(0.07f).setTarget(1); if(FrameLoop.curTick() == tickShow + 4) wordWashEase.setInc(0.04f).setTarget(0); if(tickShow == 4 && FrameLoop.curTick() % 8 == 0) wordWashEase.setInc(0.04f).setTarget(0); } wordWashEase.update(); float easedProgress = Penner.easeInOutExpo(wordWashEase.value()); pg.rotateY(rotY + FrameLoop.osc(0.125f, -0.2f, 0.2f)); // 0.4f if(tickShow != 4) pg.rotateX(rotX + FrameLoop.osc(0.225f, -0.05f, 0.05f)); // -0.1f else pg.rotateX(rotX*1.5f); pg.scale(easedProgress); pg.shape(wordWash); pg.pop(); }
Example 4
Source File: Demo_Shapes_drawDisc2.java From haxademic with MIT License | 5 votes |
protected void drawGraphicsNative( PGraphics pg ) { PG.setDrawCenter(pg); pg.beginDraw(); pg.clear(); PG.setBasicLights(pg); float frameRadians = P.TWO_PI / _frames; float percentComplete = ((float)(p.frameCount%_frames)/_frames); float radiansComplete = P.TWO_PI * percentComplete; float easedPercent = Penner.easeInOutCubic(percentComplete); float easedPercentHard = Penner.easeInOutQuad(percentComplete); // pg.background(0); pg.translate(p.width/2, p.height/2 + p.height * 0.04f); pg.blendMode(P.SCREEN); // pg.blendMode(P.MULTIPLY); // pg.rotateY(p.mouseX * 0.01f); // pg.rotateX(p.mouseY * 0.01f); pg.rotateX(4.3f + 0.01f * P.sin(percentComplete * P.TWO_PI)); // pg.rotateX(4.3f); pg.noStroke(); int numDiscs = 25; float spacing = p.width * 0.019f; pg.translate(0, 0, spacing * numDiscs * 0.3f); for (int i = 0; i < numDiscs; i++) { float percentDone = percentComplete + ((float)i/numDiscs); float size = p.width * 0.3f + p.width * 0.01f * P.sin(percentDone * P.TWO_PI); int discColor = p.color(200 + (i*5), 100 + (i*5), 170 - (i*5), 60); pg.fill(discColor); pg.translate(0,0,-spacing); // Shapes.drawDisc3D(pg, size, size * 0.9f - size * (P.sin(percentDone * P.TWO_PI)+1) * 0.15f, spacing, 40, discColor, discColor); Shapes.drawDisc(pg, size, size * 0.9f - size * (P.sin(percentDone * P.TWO_PI)+1) * 0.15f, 6); } pg.endDraw(); }
Example 5
Source File: ShaderSSAO.java From haxademic with MIT License | 5 votes |
protected void drawCubesInGrid(PGraphics pg) { // spin it pg.rotateX(-P.PI/3f - 0.1f + P.sin(progressRads) * 0.1f); pg.translate(0, 0, -pg.height * 0.5f); // draw plane pg.fill(100); pg.box(p.width * 3); // grid setup float boxSize = p.width / 10f; float numBoxes = 120f; for (int x = 0; x < numBoxes; x++) { for (int z = 0; z < numBoxes; z++) { pg.fill(255f); pg.pushMatrix(); float xx = (-numBoxes/2f * boxSize) + x * boxSize; float yy = pg.height * 1.1f; float zz = (-numBoxes/2f * boxSize) + z * boxSize; pg.translate(xx, yy, zz); float dist = MathUtil.getDistance(0, 0, xx, zz); pg.box( boxSize, pg.height * (0.4f + 0.4f * P.sin(dist/250f + progressRads)), boxSize ); pg.popMatrix(); } } }
Example 6
Source File: Particle3d.java From haxademic with MIT License | 5 votes |
public void update(PGraphics pg) { if(available()) return; // update position if(gravity.mag() > 0) speed.add(gravity); if(acceleration != 1) speed.mult(acceleration); pos.add(speed); rotation.add(rotationSpeed); // update size sizeProgress.update(); float curSize = size * Penner.easeOutSine(sizeProgress.value()); if(sizeProgress.value() == 1) sizeProgress.setTarget(0); // draw image pg.pushMatrix(); pg.translate(pos.x, pos.y, pos.z); pg.rotateX(rotation.x); pg.rotateY(rotation.y); pg.rotateZ(rotation.z); pg.fill(color); if(customShape != null) { pg.pushMatrix(); pg.scale(Penner.easeOutExpo(sizeProgress.value()) * curSize / customShape.getHeight()); pg.shape(customShape); pg.popMatrix(); } else { if(isSphere) { pg.sphere(curSize/2f); } else { pg.box(curSize, curSize, curSize); } } pg.fill(255); pg.popMatrix(); }
Example 7
Source File: OrientationUtil.java From haxademic with MIT License | 5 votes |
public static void setRotationTowards( PGraphics pg, PVector point1, PVector point2 ) { lookAt.set(point1); lookAt.sub(point2); float r = P.sqrt(lookAt.x * lookAt.x + lookAt.y * lookAt.y + lookAt.z * lookAt.z); float theta = P.atan2(lookAt.y, lookAt.x); float phi = P.acos(lookAt.z / r); pg.rotateZ(theta); pg.rotateY(phi); pg.rotateX(P.HALF_PI); }
Example 8
Source File: PG.java From haxademic with MIT License | 4 votes |
public static void basicCameraFromMouse(PGraphics pg, float amp) { pg.rotateX(P.map(Mouse.yEasedNorm, 0, 1, P.PI * amp, -P.PI * amp)); pg.rotateY(P.map(Mouse.xEasedNorm, 0, 1, -P.PI * amp, P.PI * amp)); }