使用 Processing 实现新媒体艺术作品

东岳网络工作室技术分享

TeamLab

What Is Processing

Processing is a flexible software sketchbook and a language for learning how to code within the context of the visual arts. Since 2001, Processing has promoted software literacy within the visual arts and visual literacy within technology.

A Programmer's Perspective

  • 输出是图形或者动画的编程语言
  • 语法与 Java 类似,部分复用了 Java 的 compiler

What could Processing do?

What could Processing do?

What could Processing do?

2D

Event

void setup() {
  size(480, 120);
}

void draw() {
  if (mousePressed) {
    fill(0);
  } else {
    fill(255);
  }
  ellipse(mouseX, mouseY, 80, 80);
}

3D

void setup() {
  size(640, 360, P3D);
}

void draw() {
  background(0);
  camera(mouseX, height/2, 
    (height/2) / tan(PI/6), width/2, height/2, 0, 0, 1, 0);
  translate(width/2, height/2, -100);
  stroke(255);
  noFill();
  box(200);
}

Library

多语言支持

多语言支持

settings <- function() {
    size(500, 500, P3D)
}

setup <- function() {
    colorMode(RGB, 1)
    frameRate(24)
}

draw <- function() {
    frames <- 24 * 3
    t <- frameCount/frames
    
    background(1)
    
    perspective(0.5, 1, 0.01, 100)
    
    camera(0, 0, 25 + sin(PI * 2 * t) * 3, 0, 0, 0, 0, 1, 0)
    
    rotateX(-0.5 - 0.05 * sin(PI * 4 * t))
    rotateY(-0.5 - 0.05 * cos(PI * 2 * t))
    
    columns <- 8
    for (ix in 1:columns - 1) {
        x <- ix - 0.5 * columns + 0.5
        for (iy in 1:columns - 1) {
            y <- iy - 0.5 * columns + 0.5
            for (iz in 1:columns - 1) {
                z <- iz - 0.5 * columns + 0.5
                
                d <- sqrt(x * x + y * y + z * z)
                s <- abs(sin(d - t * 4 * PI))
                
                pushMatrix()
                translate(x, z, y)
                box(s)
                popMatrix()
            }
        }
    }
}

关于我

  • 东岳 MOOC & Open Source 组组长
  • 上海交通大学 软件学院 研究生二年级
  • 研究方向为容器虚拟化与分布式
  • 业余爱好法学, 与新媒体艺术

Blog GitHub Resume Resume in Chinese SJTU Master

找到我

Thanks

Q & A

Processing

By gaocegege

Processing

Introduction to Processing

  • 431
Loading comments...

More from gaocegege