Skip to content

Commit 663ef86

Browse files
author
Abe Pazos
committed
Add sketch and thumbs
1 parent 8ef2a16 commit 663ef86

File tree

51 files changed

+186
-28
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+186
-28
lines changed
5.25 KB
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
PImage img;
2+
3+
void setup() {
4+
size(600, 600, P3D);
5+
img = loadImage("M51.jpg");
6+
img.loadPixels();
7+
noStroke();
8+
}
9+
10+
void draw() {
11+
background(255);
12+
lights();
13+
translate(width/2, height/2);
14+
scale(5);
15+
rotateX(mouseY * 0.01);
16+
rotateY(mouseX * 0.01);
17+
//image(img, 0, 0);
18+
for(int x=0; x<100; x++) {
19+
for(int y=0; y<100; y++) {
20+
int imgx = (int)map(x, 0, 100, 0, img.width);
21+
int imgy = (int)map(y, 0, 100, 0, img.height);
22+
float bri = brightness(img.get(imgx, imgy));
23+
if(bri > 50) {
24+
pushMatrix();
25+
translate(x, y);
26+
box(bri/100.0);
27+
popMatrix();
28+
}
29+
}
30+
}
31+
}
32+
33+
void keyPressed() {
34+
if(key =='s') { save("thumb.png"); println("saved!"); }
35+
}
7.5 KB
47 KB
3.87 KB
52.2 KB
17.5 KB
-144 KB
Binary file not shown.

processing/ideas/2013/12/textRandomizer/textRandomizer.pde

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ void keyPressed() {
6969
if(key == ' ') {
7070
selectInput("Select a small text file", "fileSelected");
7171
}
72+
if(key == 's') {
73+
save("thumb.png");
74+
}
7275
}
7376
void fileSelected(File selection) {
7477
if (selection != null) {
@@ -139,4 +142,3 @@ void shake() {
139142
float rnd(float a, float b) {
140143
return map(randomGaussian(), -1, 1, a, b);
141144
}
142-
9.26 KB
290 KB
5.21 KB
1020 Bytes
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
PImage img;
2+
void setup() {
3+
size(600, 600);
4+
colorMode(HSB, 100);
5+
img = createImage(600, 600, RGB);
6+
img.loadPixels();
7+
for(int x=0; x<img.width; x++) {
8+
for(int y=0; y<img.height; y++) {
9+
float d = 1-abs(x-300)/300.0;
10+
int c = color(0, 0, map(1-pow(d,4), 1, 0, 100, 70));
11+
img.pixels[x+y*width] = c;
12+
}
13+
}
14+
img.updatePixels();
15+
16+
tint(200, 100, 50);
17+
image(img, 0, 0);
18+
}
19+
void draw() {
20+
}
21+
void keyPressed() {
22+
if(key =='s') { save("thumb.jpg"); println("saved!"); }
23+
}
Lines changed: 8 additions & 0 deletions
9.61 KB
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
import toxi.geom.*;
2+
3+
Matrix4x4 m;
4+
ArrayList<Vec3D> points;
5+
6+
PImage img;
7+
8+
void setup() {
9+
size(900, 900, P2D);
10+
background(255);
11+
img = makeGradient();
12+
}
13+
void draw() {
14+
// Create Polygon
15+
points = new ArrayList<Vec3D>();
16+
float rad = (frameCount * 3) % (width * 0.4);
17+
float theta = frameCount * 0.6;
18+
float cx = width/2 + rad*sin(theta);
19+
float cy = height/2 + rad*cos(theta);
20+
for (float a=0; a<TWO_PI; a+=random(0.1, 2)) {
21+
points.
22+
add(Vec3D.fromXYTheta(a).
23+
scaleSelf(width/10, height/10, 0).
24+
addSelf(cx, cy, 0));
25+
}
26+
27+
// Find longest side and get length
28+
float maxDist = 0;
29+
int maxDistIndex = -1;
30+
for (int i=0; i<points.size (); i++) {
31+
Vec3D v1 = points.get(i);
32+
Vec3D v2 = points.get((i+1)%points.size());
33+
float d = v1.distanceTo(v2);
34+
if (d > maxDist) {
35+
maxDist = d;
36+
maxDistIndex = i;
37+
}
38+
}
39+
// Calculate inclination of longest side
40+
Vec3D v1 = points.get(maxDistIndex);
41+
Vec3D v2 = points.get((maxDistIndex+1)%points.size());
42+
float ang = HALF_PI - atan2(v2.y-v1.y, v2.x-v1.x);
43+
44+
m = new Matrix4x4();
45+
m.rotateZ(ang);
46+
m.scaleSelf(1 / maxDist);
47+
48+
textureMode(NORMAL);
49+
textureWrap(REPEAT);
50+
51+
tint((new int[] {#074267,#0BC1C1,#EAE47E,#F8C579,#F35330})[frameCount % 5]);
52+
53+
stroke(0, 30);
54+
beginShape();
55+
texture(img);
56+
for(Vec3D p : points) {
57+
Vec3D tp = p.sub(v1);
58+
m.applyToSelf(tp);
59+
vertex(p.x, p.y, tp.x * 0.5 + 0.5, tp.y);
60+
}
61+
endShape();
62+
63+
//noLoop();
64+
}
65+
66+
PImage makeGradient() {
67+
img = createImage(600, 600, RGB);
68+
img.loadPixels();
69+
for (int x=0; x<img.width; x++) {
70+
for (int y=0; y<img.height; y++) {
71+
float d = 1-abs(x-300)/300.0;
72+
int c = color(map(1-pow(d, 4), 1, 0, 200, 150));
73+
img.pixels[x+y*img.width] = c;
74+
}
75+
}
76+
img.updatePixels();
77+
return img;
78+
}
79+
void keyPressed() {
80+
if(key =='s') { save("thumb.jpg"); println("saved!"); }
81+
}
Lines changed: 6 additions & 0 deletions
6.76 KB

processing/ideas/2017/04/MidiViz/readme.md

Lines changed: 2 additions & 0 deletions
260 KB
8.17 KB
10.9 KB
17.1 KB

processing/ideas/2018/09/rotCubeGradient/readme.md

Lines changed: 1 addition & 1 deletion

0 commit comments

Comments
 (0)