Ejemplo n.º 1
0
  protected void drawGraphicsSunflow(PApplet pg) {
    p.noStroke();
    DrawUtil.setDrawCenter(p);

    _jw.jr.background(JoonsWrapper.BACKGROUND_AO);
    _jw.jr.background(0, 0, 0);

    float frameRadians = P.TWO_PI / _frames;
    float percentComplete = ((float) (p.frameCount % _frames) / _frames);
    float radiansComplete = P.TWO_PI * percentComplete;
    float easedPercent = Penner.easeInOutCubic(percentComplete, 0, 1, 1);
    float easedPercentHard = Penner.easeInOutQuad(percentComplete, 0, 1, 1);

    setUpRoom();

    p.translate(0, p.height * 0.1f, -480);

    // white bg block
    //		p.pushMatrix();
    //		p.translate(0,0,-1500);
    //		DrawUtil.setDrawCenter(p);
    //		p.fill(255);
    //		_jw.jr.fill( JoonsWrapper.MATERIAL_SHINY, 255, 255, 255 );
    //		p.box(p.width*10, p.width*10, 2);
    //		p.popMatrix();

    p.rotateX(4.6f + P.sin(radiansComplete) * 0.01f);

    int numDiscs = 30;
    float spacing = p.width * 0.019f;
    p.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), 0.3f);
      p.fill(discColor);

      p.translate(0, 0, -spacing);
      _jw.jr.fill(
          JoonsWrapper.MATERIAL_SHINY,
          ColorHax.redFromColorInt(discColor),
          ColorHax.greenFromColorInt(discColor),
          ColorHax.blueFromColorInt(discColor));
      drawDisc3D(
          size,
          size * 0.9f - size * (P.sin(percentDone * P.TWO_PI) + 1) * 0.15f,
          spacing * 0.25f,
          140,
          discColor,
          discColor);
      //			drawDisc(size, size * 0.9f - size * (P.sin(percentDone * P.TWO_PI)+1) * 0.15f, 140);
    }
  }
Ejemplo n.º 2
0
  protected void drawGraphicsNative(PGraphics pg) {
    DrawUtil.setDrawCenter(pg);
    pg.beginDraw();
    pg.clear();
    DrawUtil.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, 0, 1, 1);
    float easedPercentHard = Penner.easeInOutQuad(percentComplete, 0, 1, 1);

    //		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();
  }