Skip to content

Commit 8da8934

Browse files
knowlton sketch
1 parent 4c4fe46 commit 8da8934

17 files changed

+290
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
2+
void draw() {
3+
4+
currentVideo = getVideo([[videoNum]]).draw();
5+
6+
for (int i = 0; i < [[iterations]]; i++) {
7+
8+
if (random() < [[mixRatio]]) {
9+
targetImage = currentVideo;
10+
} else {
11+
targetImage = originalImage;
12+
}
13+
14+
for (int i = 0; i < imageWidth; i++) {
15+
for (int j = 0; j < imageHeight; j++) {
16+
17+
int randX = random(0, imageWidth);
18+
int randY = random(0, imageHeight);
19+
20+
// randomly swap a pixel
21+
sourceImageAfterSwap = sourceImage.swapPixels(i,j, randX, randY);
22+
23+
if (distanceToOriginal(sourceImageAfterSwap) <
24+
distanceToOriginal(sourceImage)) {
25+
sourceImage = sourceImageAfterSwap;
26+
}
27+
}
28+
}
29+
30+
31+
}
32+
sourceImage.draw();
33+
}
601 KB
Loading
206 KB
Binary file not shown.
484 KB
Binary file not shown.
113 KB
Binary file not shown.
106 KB
Binary file not shown.
192 KB
Binary file not shown.
198 KB
Binary file not shown.
328 KB
Binary file not shown.
119 KB
Binary file not shown.

0 commit comments

Comments
 (0)