http://shanear.com/artworks/typoportrait
Typo Portraits
pointillism portraits
cubist portrait
Question:
How to generate "typo portraits"?
self portrait in particles
Self Portrait Demo:
12/29, 2017
Example 1:
PImage img;
int smallPoint, largePoint;
PFont f;
float threshold = 80;
void setup() {
size(736, 736);
img = loadImage("portrait.jpg");
smallPoint = 2;
largePoint = 30;
imageMode(CENTER);
noStroke();
background(255);
// Create the font
printArray(PFont.list());
f = createFont("Georgia", 9);
textFont(f);
textAlign(CENTER, CENTER);
}
void draw() {
float value;
color pix;
// if (mousePressed == true) {
background(80);
int counter = 0;
char letter;
float pointillize = map(mouseX, 0, width, smallPoint, largePoint);
float threshold = map(mouseY, 0, height, 0, 255);
for (int x = 0; x < img.width; x+=pointillize) {
for (int y = 0; y < img.height; y+=pointillize){
pix = img.get(x, y);
value = brightness(pix);
if (value > threshold)
fill(0, 255, 0);
else fill(0);
//ellipse(x, y, 5, 5);
counter = int(random(66, 123));
letter = char (counter);
text(letter, x, y);
}
}
// }
}
Example 2:
/**
* Pointillism
* by Daniel Shiffman.
*
* Mouse horizontal location controls size of dots.
* Creates a simple pointillist effect using ellipses colored
* according to pixels in an image.
*/
// The next line is needed if running in JavaScript Mode with Processing.js
/* @pjs preload="moonwalk.jpg"; */
PImage img;
int smallPoint, largePoint;
void setup() {
size(736, 736);
img = loadImage("portrait.jpg");
smallPoint = 4;
largePoint = 40;
imageMode(CENTER);
noStroke();
background(255);
}
void draw() {
float pointillize = map(mouseX, 0, width, smallPoint, largePoint);
int x = int(random(img.width));
int y = int(random(img.height));
int xWidth = int(random(10, 200));
int yHeight = int(random(10, 200));
int xShift = int(random(-20, +20));
int yShift = int(random(-20, +20));
for (int i = 0; i< xWidth; i++) {
for (int j = 0; j< yHeight; j++) {
color pix = img.get(x+i, y+j);
stroke(pix);
//ellipse(xShift+x+i, yShift+y+j, pointillize, pointillize);
point(xShift+x+i, yShift+y+j);
}
}
}
Example 3:
float resolution;
float radius = 100;
float circleX;
float circleY;
float circles;
float circleW;
float circleH;
float offset;
PImage img;
void setup() {
size(736, 736);
circleX = 0;
circleY = 0;
background(0);
img = loadImage("portrait.jpg");
}
void draw() {
float value;
color pix;
fill(0,0,0,25);
// rect(0,0,width,height);
translate(width/2, height/2);
fill(255);
noStroke();
offset++;
resolution = map(sin(offset*0.00025), -1, 1, 5, 50);
//resolution = 50;
circles = 200;
circleW = map(sin(offset*0.05), -1, 1, 1, 10);
circleH = map(sin(offset*0.05), -1, 1, 1, 10);
for (int i = 0; i < resolution; i++) {
float scale = 200;
float waveAngle = map(i, 0, resolution, 0, TWO_PI * circles);
float waveOffset = sin(waveAngle) * scale*1.2; //scale the -1 to 1 up
float angle = map(i, 0, resolution, 0, TWO_PI * 331); //multiply for weirdness
float circleOffsetX = cos(angle) * (radius + waveOffset); //xposition
float circleOffsetY = sin(angle) * (radius + waveOffset); //yposition
float x = circleX + circleOffsetX;
float y = circleY + circleOffsetY;
pix = img.get(int(x+width/2), int(y+height/2));
value = brightness(pix);
fill(0, green(pix), blue(pix));
ellipse(x, y, circleW, circleH);
}
}
2017年12月14日 星期四
2017年12月8日 星期五
2017年11月30日 星期四
week 12. Project 2 demo & Object-Oriented Programming
1. Mandala Project Demo
Project reference:
http://sciencefictioninterfaces.tumblr.com/
2. object oriented programming:
https://processing.org/tutorials/objects/
https://www.youtube.com/watch?v=YcbcfkLzgvs
EXercise:
draw 'array-like' object with OOP
Project reference:
http://sciencefictioninterfaces.tumblr.com/
2. object oriented programming:
https://processing.org/tutorials/objects/
https://www.youtube.com/watch?v=YcbcfkLzgvs
EXercise:
draw 'array-like' object with OOP
2017年11月16日 星期四
week 10. drawing Mandala
Basic sample 1:
float resolution;
float radius = 100;
float circleX;
float circleY;
float offset;
void setup() {
size(700, 700);
circleX = 0;
circleY = 0;
}
void draw() {
fill(0,0,0,25);
rect(0,0,width,height);
translate(width/2, height/2);
fill(255);
noStroke();
offset++;
resolution = map(sin(offset*0.005), -1, 1, 2, 20);
// resolution = 20;
for (int i = 0; i < resolution; i++) {
float angle = map(i, 0, resolution, 0, TWO_PI);
// float waveOffset = sin(angle*circles) * 200;
float circleOffsetX = cos(angle) * (radius); //xposition
float circleOffsetY = sin(angle) * (radius); //yposition
// float circleOffsetX = cos(angle) * (radius + waveOffset); //xposition
// float circleOffsetY = sin(angle) * (radius + waveOffset); //yposition
float x = circleX + circleOffsetX;
float y = circleY + circleOffsetY;
ellipse(x, y, 10, 10);
}
}
Sample 2:
float resolution;
float radius = 100;
float circleX;
float circleY;
float circles;
float circleW;
float circleH;
float offset;
void setup() {
size(700, 700);
circleX = 0;
circleY = 0;
}
void draw() {
fill(0,0,0,25);
rect(0,0,width,height);
translate(width/2, height/2);
fill(255);
noStroke();
offset++;
resolution = map(sin(offset*0.00025), -1, 1, 11, 13);
//resolution = 50;
circles = 400;
circleW = map(sin(offset*0.05), -1, 1, 1, 8);
circleH = map(sin(offset*0.05), -1, 1, 1, 8);
for (int i = 0; i < resolution; i++) {
float scale = 200;
float waveAngle = map(i, 0, resolution, 0, TWO_PI * circles);
float waveOffset = sin(waveAngle) * scale; //scale the -1 to 1 up
float angle = map(i, 0, resolution, 0, TWO_PI * 156); //multiply for weirdness
float circleOffsetX = cos(angle) * (radius + waveOffset); //xposition
float circleOffsetY = sin(angle) * (radius + waveOffset); //yposition
float x = circleX + circleOffsetX;
float y = circleY + circleOffsetY;
ellipse(x, y, circleW, circleH);
}
}
example 3:
float resolution;
float radius = 100;
float circleX;
float circleY;
float circles;
float offset;
void setup() {
size(700, 700);
circleX = 0;
circleY = 0;
}
void draw() {
fill(0,0,0,25);
rect(0,0,width,height);
translate(width/2, height/2);
fill(255, 255, 0);
noStroke();
offset++;
resolution = map(cos(offset*0.0002), -1, 1, 2, 200);
circles = 100;
beginShape();
noFill();
for (int i = 0; i < resolution; i++) {
float scale = 400;
float waveAngle = map(i, 0, resolution, 0, TWO_PI * circles);
float waveOffset = sin(waveAngle) * scale; //scale the -1 to 1 up
float angle = map(i, 0, resolution, 0, TWO_PI * 156); //multiply for weirdness
float circleOffsetX = cos(angle) * (radius + waveOffset); //xposition
float circleOffsetY = sin(angle) * (radius + waveOffset); //yposition
float x = circleX + circleOffsetX;
float y = circleY + circleOffsetY;
stroke(255);
//line(x, y, 0, 0);
vertex(x,y);
}
endShape(CLOSE);
}
reference:
search "mandala" on
https://www.openprocessing.org/
float resolution;
float radius = 100;
float circleX;
float circleY;
float offset;
void setup() {
size(700, 700);
circleX = 0;
circleY = 0;
}
void draw() {
fill(0,0,0,25);
rect(0,0,width,height);
translate(width/2, height/2);
fill(255);
noStroke();
offset++;
resolution = map(sin(offset*0.005), -1, 1, 2, 20);
// resolution = 20;
for (int i = 0; i < resolution; i++) {
float angle = map(i, 0, resolution, 0, TWO_PI);
// float waveOffset = sin(angle*circles) * 200;
float circleOffsetX = cos(angle) * (radius); //xposition
float circleOffsetY = sin(angle) * (radius); //yposition
// float circleOffsetX = cos(angle) * (radius + waveOffset); //xposition
// float circleOffsetY = sin(angle) * (radius + waveOffset); //yposition
float x = circleX + circleOffsetX;
float y = circleY + circleOffsetY;
ellipse(x, y, 10, 10);
}
}
Sample 2:
float resolution;
float radius = 100;
float circleX;
float circleY;
float circles;
float circleW;
float circleH;
float offset;
void setup() {
size(700, 700);
circleX = 0;
circleY = 0;
}
void draw() {
fill(0,0,0,25);
rect(0,0,width,height);
translate(width/2, height/2);
fill(255);
noStroke();
offset++;
resolution = map(sin(offset*0.00025), -1, 1, 11, 13);
//resolution = 50;
circles = 400;
circleW = map(sin(offset*0.05), -1, 1, 1, 8);
circleH = map(sin(offset*0.05), -1, 1, 1, 8);
for (int i = 0; i < resolution; i++) {
float scale = 200;
float waveAngle = map(i, 0, resolution, 0, TWO_PI * circles);
float waveOffset = sin(waveAngle) * scale; //scale the -1 to 1 up
float angle = map(i, 0, resolution, 0, TWO_PI * 156); //multiply for weirdness
float circleOffsetX = cos(angle) * (radius + waveOffset); //xposition
float circleOffsetY = sin(angle) * (radius + waveOffset); //yposition
float x = circleX + circleOffsetX;
float y = circleY + circleOffsetY;
ellipse(x, y, circleW, circleH);
}
}
example 3:
float resolution;
float radius = 100;
float circleX;
float circleY;
float circles;
float offset;
void setup() {
size(700, 700);
circleX = 0;
circleY = 0;
}
void draw() {
fill(0,0,0,25);
rect(0,0,width,height);
translate(width/2, height/2);
fill(255, 255, 0);
noStroke();
offset++;
resolution = map(cos(offset*0.0002), -1, 1, 2, 200);
circles = 100;
beginShape();
noFill();
for (int i = 0; i < resolution; i++) {
float scale = 400;
float waveAngle = map(i, 0, resolution, 0, TWO_PI * circles);
float waveOffset = sin(waveAngle) * scale; //scale the -1 to 1 up
float angle = map(i, 0, resolution, 0, TWO_PI * 156); //multiply for weirdness
float circleOffsetX = cos(angle) * (radius + waveOffset); //xposition
float circleOffsetY = sin(angle) * (radius + waveOffset); //yposition
float x = circleX + circleOffsetX;
float y = circleY + circleOffsetY;
stroke(255);
//line(x, y, 0, 0);
vertex(x,y);
}
endShape(CLOSE);
}
reference:
search "mandala" on
https://www.openprocessing.org/
2017年11月9日 星期四
week 9. using Recursion
float radius;
int segment = 6;
float centerX;
float centerY;
int recursionLevel = 3;
void setup(){
size(600,600);
background(0);
stroke(255);
centerX = height/2;
centerY = width/2;
}
void draw(){
background(0);
radius = dist(centerX, centerY, mouseX, mouseY);
spiral(centerX,centerY,radius,segment, recursionLevel);
}
void spiral(float x_c,float y_c, float r, int seg,int level){
level -= 1;
noFill();
ellipse(x_c,y_c,2*r,2*r);
for(int i =0;i < seg; i++){
float x = x_c+cos(i*2*PI/seg)*r;
float y = y_c+sin(i*2*PI/seg)*r;
point(x,y);
ellipse(x,y,2*r,2*r);
if(level > 0){
spiral(x,y,r,seg, level);
}
}
}
References:
https://www.youtube.com/watch?v=zoqTNpok6zw
int segment = 6;
float centerX;
float centerY;
int recursionLevel = 3;
void setup(){
size(600,600);
background(0);
stroke(255);
centerX = height/2;
centerY = width/2;
}
void draw(){
background(0);
radius = dist(centerX, centerY, mouseX, mouseY);
spiral(centerX,centerY,radius,segment, recursionLevel);
}
void spiral(float x_c,float y_c, float r, int seg,int level){
level -= 1;
noFill();
ellipse(x_c,y_c,2*r,2*r);
for(int i =0;i < seg; i++){
float x = x_c+cos(i*2*PI/seg)*r;
float y = y_c+sin(i*2*PI/seg)*r;
point(x,y);
ellipse(x,y,2*r,2*r);
if(level > 0){
spiral(x,y,r,seg, level);
}
}
}
The Illusions of Reality & The Basics of Sacred Geometry (The Patterns of Consciousness)
2017年10月26日 星期四
week 7. Project 1 demo & using sin(x)
sample codes:
float radius;
int segment = 10;
float centerX;
float centerY;
void setup(){
size(600,600);
background(0);
stroke(255);
centerX = height/2;
centerY = width/2;
}
void draw(){
background(0);
radius = dist(centerX, centerY, mouseX, mouseY);
spiral(centerX,centerY,radius,segment);
}
void spiral(float x_c,float y_c, float r, int seg){
for(int i =0;i<=seg;i++){
float x = x_c+cos(i*2*PI/seg)*r; //算出x的位置
float y = y_c+sin(i*2*PI/seg)*r; //算出y的位置
point(x,y); // 畫出點,也能用其他形狀
}
}
EX:
1. 每次點擊滑鼠,劃一個隨機半徑大小的圓。
2. draw flower of life (生命之花)
reference:
https://processing.org/examples/sine.html
https://processing.org/examples/sinecosine.html
John Whitney
https://www.youtube.com/watch?v=BzB31mD4NmA
https://www.youtube.com/watch?v=s_KIrIJkLoE
float radius;
int segment = 10;
float centerX;
float centerY;
void setup(){
size(600,600);
background(0);
stroke(255);
centerX = height/2;
centerY = width/2;
}
void draw(){
background(0);
radius = dist(centerX, centerY, mouseX, mouseY);
spiral(centerX,centerY,radius,segment);
}
void spiral(float x_c,float y_c, float r, int seg){
for(int i =0;i<=seg;i++){
float x = x_c+cos(i*2*PI/seg)*r; //算出x的位置
float y = y_c+sin(i*2*PI/seg)*r; //算出y的位置
point(x,y); // 畫出點,也能用其他形狀
}
}
EX:
1. 每次點擊滑鼠,劃一個隨機半徑大小的圓。
2. draw flower of life (生命之花)
reference:
https://processing.org/examples/sine.html
https://processing.org/examples/sinecosine.html
John Whitney
https://www.youtube.com/watch?v=BzB31mD4NmA
https://www.youtube.com/watch?v=s_KIrIJkLoE
2017年10月12日 星期四
week 5. 2D Arrays
review:
draw a rotating shape in the center of screen.
also use 'scale()' to change the size of the object.
參考:
https://processing.org/examples/array2d.html
用 2D array 設定每個元素的顏色,旋轉速度,屬性。
float[][] distances;
float[][] rotateAngles;
float[][] rotateRates;
float maxDistance;
int spacer;
void setup() {
size(640, 360);
maxDistance = dist(width/2, height/2, width, height);
distances = new float[width][height];
rotateAngles = new float[width][height];
rotateRates = new float[width][height];
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
float distance = dist(width/2, height/2, x, y);
distances[x][y] = distance/maxDistance * 255;
rotateAngles[x][y] = random(5.0);
rotateRates[x][y] = random(5.0, 40.0);
}
}
spacer = 30;
strokeWeight(3);
//noLoop(); // Run once and stop
}
void draw() {
background(0);
// This embedded loop skips over values in the arrays based on
// the spacer variable, so there are more values in the array
// than are drawn here. Change the value of the spacer variable
// to change the density of the points
for (int y = 0; y < height; y += spacer) {
for (int x = 0; x < width; x += spacer) {
pushMatrix();
translate(x, y);
rotate(frameCount/rotateRates[x][y]+rotateAngles[x][y]);
rect(-spacer/2, -spacer/2, spacer, spacer);
stroke(distances[x][y]);
popMatrix();
}
}
}
Project 1:
2D 陣列作品系列五連作,參考 CODE+FORM
Deadline Oct. 27, 2017
draw a rotating shape in the center of screen.
also use 'scale()' to change the size of the object.
參考:
https://processing.org/examples/array2d.html
用 2D array 設定每個元素的顏色,旋轉速度,屬性。
float[][] distances;
float[][] rotateAngles;
float[][] rotateRates;
float maxDistance;
int spacer;
void setup() {
size(640, 360);
maxDistance = dist(width/2, height/2, width, height);
distances = new float[width][height];
rotateAngles = new float[width][height];
rotateRates = new float[width][height];
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
float distance = dist(width/2, height/2, x, y);
distances[x][y] = distance/maxDistance * 255;
rotateAngles[x][y] = random(5.0);
rotateRates[x][y] = random(5.0, 40.0);
}
}
spacer = 30;
strokeWeight(3);
//noLoop(); // Run once and stop
}
void draw() {
background(0);
// This embedded loop skips over values in the arrays based on
// the spacer variable, so there are more values in the array
// than are drawn here. Change the value of the spacer variable
// to change the density of the points
for (int y = 0; y < height; y += spacer) {
for (int x = 0; x < width; x += spacer) {
pushMatrix();
translate(x, y);
rotate(frameCount/rotateRates[x][y]+rotateAngles[x][y]);
rect(-spacer/2, -spacer/2, spacer, spacer);
stroke(distances[x][y]);
popMatrix();
}
}
}
Project 1:
2D 陣列作品系列五連作,參考 CODE+FORM
Deadline Oct. 27, 2017
2017年10月5日 星期四
week 4. 2D rotation
download processing on ios (android) and try
void setup(){
size(640, 360);
background(0);
}
int gridSize = 40;
void draw() {
background(0);
stroke(200);
noFill();
for (int x = gridSize; x <= width - gridSize; x += gridSize) {
for (int y = gridSize; y <= height - gridSize; y += gridSize) {
rotateShape(x, y);
}
}
}
void rotateShape(int xloc, int yloc) {
pushMatrix();
translate(xloc, yloc);
// rotate((frameCount / 8.0)+xloc+yloc+mouseX);
rotate((mouseX/100)*frameCount / 8.0+xloc+yloc);
rect(-10, -10, 20, 20);
line(-10, -10, 10, 10);
popMatrix();
}
References:
https://processing.org/examples/star.html
example #2:
void setup(){
size(640, 360);
background(0);
}
int gridSize = 40;
void draw() {
background(0);
stroke(200);
noFill();
for (int x = gridSize; x <= width - gridSize; x += gridSize) {
for (int y = gridSize; y <= height - gridSize; y += gridSize) {
rotateShape(x, y);
}
}
}
void rotateShape(int xloc, int yloc) {
pushMatrix();
translate(xloc, yloc);
rotate((frameCount / 8.0)+xloc+yloc);
//rotate((mouseX/100)*frameCount / 8.0+xloc+yloc);
beginShape();
vertex(-10, -10);
vertex(0, -10);
vertex(0, 0);
vertex(10, 0);
vertex(10, 10);
vertex(-10, 10);
endShape(CLOSE);
//rect(-10, -10, 20, 20);
// line(-10, -10, 10, 10);
popMatrix();
}
2017年9月28日 星期四
week 3. structural programming
Global variables v.s. local variables
subroutine calls
EX:
use subroutine call to perform 10 x 10 element-drawing.
subroutine calls
EX:
use subroutine call to perform 10 x 10 element-drawing.
2017年9月21日 星期四
week 2. statement and structure
1. ACG at MIT Media Lab.
Aesthetic and computation Concept video
2. for-loop
if
FORM+CODE examples
Ex: Draw 10x10 basic elements with some repetition
Aesthetic and computation Concept video
2. for-loop
if
FORM+CODE examples
Ex: Draw 10x10 basic elements with some repetition
2017年9月14日 星期四
week 1. introduction
Aesthetic Computing: A Brief Tutorial
An Introduction to Aesthetic Computing by Paul Fishwick
booklist
conceptual art
computational aesthetics ?
FORM + CODE
Wassily Kandinsky
Victor Vasarely
Sol Lewitt
code artists:
Ben Laposky, 1914-2000
John Whitney Sr., 1918-1995
Herbert W. Franke, 1927-
Lillian Schwartz, 1927-
Harold Cohen, 1928-
Roman Verostko, 1929-
George Legrady, 1950-
Mark Napier, 1961-
John F. Simon Jr., 1963-
John Maeda, 1966-
Mary Flanagan, 1969-
Casey Reas, 1970-
Jared Tarbell, 1973-
Ben Fry, 1975-
EX1:
Take photos of Computational Aesthetics in everyday life.
An Introduction to Aesthetic Computing by Paul Fishwick
booklist
conceptual art
computational aesthetics ?
FORM + CODE
Wassily Kandinsky
Victor Vasarely
Sol Lewitt
code artists:
Ben Laposky, 1914-2000
John Whitney Sr., 1918-1995
Herbert W. Franke, 1927-
Lillian Schwartz, 1927-
Harold Cohen, 1928-
Roman Verostko, 1929-
George Legrady, 1950-
Mark Napier, 1961-
John F. Simon Jr., 1963-
John Maeda, 1966-
Mary Flanagan, 1969-
Casey Reas, 1970-
Jared Tarbell, 1973-
Ben Fry, 1975-
EX1:
Take photos of Computational Aesthetics in everyday life.
訂閱:
文章 (Atom)