For this recitation, I chose to participate in Leon’s workshop on media manipulation. He used the Game of Thrones intro/theme video as an example, and used different filters to change the look and feel of the video. Moreover, he transformed the overall atmosphere of the video by manipulating the speed, timing, and sound.
The reason I chose this workshop in particular is because I thought it would be useful for my final project idea – and useful it was. Leon gave us the freedom to choose what we would work on in terms of media manipulation so I decided to use one that I may end up using for my project. The program includes a looped video of a rotating planet earth, and when one clicks the mouse, trees begin to pop up on the earth and move with it. It was extremely tricky to achieve this as working with 3D spaces is way beyond the scope of this course. The program therefore does not in fact work in 3D, instead it makes the trees disappear once they reach the other end of the earth. In addition, the trees’ movement speed had to be synced as accurately as possible to the speed of the earth’s rotation in the video.
The code was split into two tabs. The first is titled “earth”:
import processing.video.*;
Movie earth;
PImage tree;
ArrayList<Tree> trees = new ArrayList<Tree>();
void setup() {
size(640,360);
earth = new Movie(this, “earth2.mp4”);
earth.loop();
tree = loadImage(“tree.png”);
}
void draw() {
if (earth.available()) {
earth.read();
}
imageMode(CORNER);
image(earth, 0, 0);
//float timeStamp = earth.time();
// println(timeStamp);
for(int i=0; i<trees.size(); i++) {
trees.get(i).display();
trees.get(i).move();
}
for(int i=0; i<trees.size(); i++) {
if(trees.get(i).offEarth == true) {
trees.remove(i);
}
}
println(mouseX, mouseY);
println(trees.size());
}
void mousePressed() {
trees.add( new Tree() );
}
//make array with set amount of trees that will appear, use i and “for” function for big number
//put array, then make array[i] = 1 with “if” statement and make the processing draw a tree with “draw” function
The second tab is titled “trees”:
class Tree {
float x, y;
float speed;
boolean offEarth = false;
Tree() {
while( dist(x, y, width/2, height/2) > 150) {
x = random(170, 470);
//x = random(170, 200);
y = random(30, 330);
}
speed = 1.2;
}
void display() {
ellipse(x, y, 10, 10);
imageMode(CENTER);
image(tree, x, y);
}
void move() {
x += speed;
if(dist(x, y, width/2, height/2) > 150) {
offEarth = true;
}
}
}