132
edits
No edit summary |
No edit summary |
||
Line 24: | Line 24: | ||
===Clocks=== | ===Clocks=== | ||
I'd like to do | I'd like to do a clock which could control the clips which have happened. And is related to two different videos and interactive between users. | ||
The first idea is to use a real clock to install with the arduino and potentiemeter, but a touch screen could be better for interface. When audiences touch and move the figure of clock, the video will jumo to the corresponding time of the clock and play automatically. | |||
[[File:wedding5.jpg|400px|]] | |||
===Code=== | ===Code=== | ||
Line 34: | Line 37: | ||
Proccessing (figure moved by | Proccessing 1 (figure moved by potentiemeter) | ||
import processing.serial.*; | |||
Serial myPort; | |||
int incomingVal; | |||
//int hours=0; | |||
void setup() { | void setup() { | ||
size(1000, 700); | size(1000, 700); | ||
strokeWeight( | strokeWeight(5); | ||
smooth(); | smooth(); | ||
println(Serial.list()); | |||
myPort = new Serial(this,"/dev/tty.usbmodem411",9600); | |||
} | } | ||
void draw() { | void draw() { | ||
background(0); | background(0); | ||
fill(174, 221, 60); | |||
ellipse( | while(myPort.available() > 0){ | ||
ellipse( | incomingVal = myPort.read(); | ||
ellipse( | println(incomingVal); | ||
ellipse( | } | ||
ellipse( | |||
ellipse( | fill(174,221,60); | ||
ellipse(500,350,250,250); | |||
float hourAngle = map( | ellipse(385,350,2,2); | ||
ellipse(615,350,2,2); | |||
ellipse(500,465,2,2); | |||
ellipse(500,235,2,2); | |||
ellipse(500,350,5,5); | |||
float hourAngle = map(incomingVal/12, 0, 255, 0, 360); | |||
pushMatrix(); | pushMatrix(); | ||
translate( | translate(500, 350); | ||
rotate(radians(hourAngle*12) - radians(90)); | rotate(radians(hourAngle*12) - radians(90)); | ||
line(0, 0, | line(0, 0, 100, 0); | ||
float speed = dist(mouseX, mouseY, pmouseX, pmouseY); | float speed = dist(mouseX, mouseY, pmouseX, pmouseY); | ||
float diameter = speed * 2.0; | float diameter = speed * 2.0; | ||
fill(204, 221, 80); | fill(204, 221, 80); | ||
ellipse( | ellipse(250, 250, diameter/2, diameter/2); | ||
popMatrix(); | popMatrix(); | ||
translate( | translate(500, 350); | ||
rotate(radians(hourAngle) - radians(90)); | rotate(radians(hourAngle) - radians(90)); | ||
line(0, 0, | line(0, 0, 50, 0); | ||
} | |||
Processing 2(video play and jump by data) | |||
import processing.video.*; | |||
Movie myMovie; | |||
import processing.serial.*; | |||
Serial myPort; | |||
int incomingVal; | |||
void setup() { | |||
size(640,480,P2D); | |||
frameRate(30); | |||
myMovie = new Movie(this, "video.mov"); | |||
myMovie.loop(); | |||
println(Serial.list()); | |||
myPort = new Serial(this,"/dev/tty.usbmodem411",9600); | |||
} | |||
void movieEvent(Movie myMovie) { | |||
myMovie.read(); | |||
} | |||
void draw() { | |||
while(myPort.available() > 0){ | |||
incomingVal = myPort.read(); | |||
println(incomingVal); | |||
} | |||
if(myMovie.available()){ | |||
} | |||
image(myMovie, 0, 0); | |||
} | |||
void mousePressed(){ | |||
myMovie.jump(incomingVal); | |||
} | } | ||
=== Sketch up=== | === Sketch up=== | ||
Using arduino to collect the data outside and transform into the computer. I connected the touch screen with arduino so that collect the moving movement and touch point. After computer received the data, processing will read data and give order to the video. | |||
[[File:wedding7.jpg|400px|]] | |||
[[File:wedding4.jpg|400px|]] | [[File:wedding4.jpg|400px|]] | ||
edits