ProcessingJoy —— 翻滾的立方體

panda1234lee發表於2020-12-31

效果圖

 

主流程 RotateBlock.pde

int[][] result; ///< 用於多重取樣(求和取平均)
float t, c;

void push() {
  pushMatrix();
  pushStyle();
}

void pop() {
  popStyle();
  popMatrix();
}

void draw() {

  if (!recording) {
    t = mouseX*1.0/width;
    c = mouseY*1.0/height;
    if (mousePressed)
      println(c);
    draw_();
  } else {
    for (int i=0; i<width*height; i++)
      for (int a=0; a<3; a++)
        result[i][a] = 0;

    c = 0;
    for (int sa=0; sa<samplesPerFrame; sa++) {
      t = map(frameCount-1 + sa*shutterAngle/samplesPerFrame, 0, numFrames, 0, 1);
      draw_();
      loadPixels();
      for (int i=0; i<pixels.length; i++) {
        /// @note 注意只提取了畫素的 RGB 分量
        result[i][0] += p

相關文章