49
edits
No edit summary |
No edit summary |
||
Line 34: | Line 34: | ||
14.12.2015 First til last attempt, at the start I was too lazy | 14.12.2015 First til last attempt, at the start I was too lazy | ||
<source lang="java"> | |||
PImage img; | |||
PImage source; | |||
void setup(){ | |||
size(500,500); | |||
source = loadImage("Stones1.jpg"); | |||
image(source,0,0,500,500); | |||
} | |||
void draw(){ | |||
img = loadImage("Stones8.jpg"); | |||
img.resize(500,500); | |||
int z = 20; | |||
int width = 450; | |||
int height = 10; | |||
for (int i =40; i< 441; i = i + 20){ | |||
copy(img,z,i,width,height,z,i,width,height); | |||
}} | |||
</source> <br> | |||
---- | ---- | ||
'''Third Homework''' | '''Third Homework''' | ||
Line 56: | Line 79: | ||
[[File:ThingIDid.jpg]] | [[File:ThingIDid.jpg]] | ||
<source lang="java"> | |||
PImage pic; | |||
void setup(){ | |||
size(500,500); | |||
pic = loadImage("Outside6.jpg"); | |||
pic.resize(500,500); | |||
} | |||
void draw(){ | |||
//randomSeed(0); | |||
pic.loadPixels(); | |||
color[] pix = pic.pixels; | |||
for(int y = 0; y < height; y++){ | |||
int offset = y*width; | |||
for( int x = 0; x < width-10; x++){ | |||
int left = offset + x; | |||
int right = offset + x +1; | |||
int posx =mouseX -width/2; | |||
if(posx >0){ | |||
if(saturation(pix[left]) - saturation(pix[right])>mouseX){ | |||
color tmpleft = pix[left]; | |||
pix[left] = pix[right]; | |||
pix[right] = tmpleft; | |||
// pix[idx1] = color(random(255),random(255),random(255)); | |||
} | |||
} else{ | |||
if(saturation(pix[left]) + saturation(pix[right])>mouseX){ | |||
color tmpleft = pix[left]; | |||
pix[left] = pix[right]; | |||
pix[right] = tmpleft; | |||
// pix[idx1] = color(random(255),random(255),random(255)); | |||
}}}} | |||
pic.updatePixels(); | |||
image(pic,0,0);} | |||
</source> <br> | |||
[[File:WeekendVideoCapture1.jpg]] | [[File:WeekendVideoCapture1.jpg]] | ||
<source lang="java"> | |||
import processing.video.*; | |||
Capture video; | |||
int maxFrames; | |||
int d = 4; | |||
PImage pic; | |||
//boolean recording = false; | |||
ArrayList frames = new ArrayList(); | |||
void setup(){ | |||
//nimmt NUR diese format, KEIN anderes möglich | |||
size(640,480); | |||
maxFrames = width/d; | |||
video = new Capture(this,width,height); | |||
//wichtig!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |||
video.start(); | |||
PImage pic = createImage(width,height, RGB); | |||
frames.add(pic); | |||
} | |||
void draw(){ | |||
for (int i = 0; i < frames.size(); i++){ | |||
// x coordinate for the left side of the strip | |||
int x = i * d; | |||
PImage pic = (PImage) frames.get(i); | |||
PImage strip = pic.get(x, 0, d, height); | |||
image(strip, x,random (0)); | |||
// PImage snip = pic.get(x,10,width,height); | |||
// image(snip,random(1),random(0)); | |||
//random(2); | |||
}} | |||
void captureEvent(Capture video){ | |||
video.read(); | |||
pic = video.get(); | |||
frames.add(pic); | |||
if( frames.size() > maxFrames){ | |||
frames.remove(1); | |||
}} | |||
</source> <br> | |||
Video Thingy Thing | |||
[[File:AroundThe10thSecond.jpg]] | [[File:AroundThe10thSecond.jpg]] | ||
Line 69: | Line 184: | ||
[[File:ShreddedPaper.jpg]] | [[File:ShreddedPaper.jpg]] | ||
<source lang="java"> | |||
import processing.video.*; | |||
Movie movie; | |||
void setup(){ | |||
size(640,360); | |||
movie = new Movie(this,"Vid.mp4"); | |||
movie.loop(); | |||
background(0); | |||
} | |||
void movieEvent(Movie m){ | |||
m.read(); | |||
} | |||
void draw(){ | |||
noStroke(); | |||
for(int i = 0;i < 10000; i++){ | |||
int x = (int(random(0, width))); | |||
int y = (int(random(0, height))); | |||
color c = movie.get(x,y); | |||
fill(c,100); | |||
rect(x,y,35,5); | |||
} | |||
} | |||
</source> <br> |
edits