//Aaron Koblin
//Design for Interactive Media 157A
//11/14/04
//
//Remember to Forget to Remember
//An interactive non-linear narrative, Remember to Forget
//to Remember is an application which creates clouds formed
//from the word remember. Meanwhile, Memories betray their creator
//and Predictions condemn us to a false forever are drawn
//to the screen. The user can influence color schemes and narrative
//order with the mouse, but there is no further interaction.
int stagex = 400; //stage width
int stagey = 400; //steage height
int angle, angle2, speed, speed2, radius, state = 1;
int centery, centerx, fadedelay, counter, opac=0;
float[] centersx = new float[10];
float[] centersy = new float[10];
float[] spritesx = new float[10];
float[] spritesy = new float[10];
float[] speeds = new float[10];
boolean flag1;
BImage brush1, fade, bg1, bg2, bg3, bg4;
BFont font1;
int[] bgpixels;
void setup(){
// framerate(30);
fadedelay = 0;
background(255);
size(stagex, stagey);
centerx = stagex/2-20;
centery = stagey/2;
centerverts(); //plots the centers for each sprite in a circle;
brush1 = loadImage("brush1.jpg");
fade = loadImage("fade.jpg");
tint(255,255,255,255);
image(fade, 0, 0, stagex, stagey);
speed2=0;
initverts();
bgpixels = new int[width*height];
bg1 = loadImage("bg.jpg");
bg2 = loadImage("bg2.jpg");
bg3 = loadImage("bg3.jpg");
bg4 = loadImage("bg4.jpg");
initbg();
font1 = loadFont("Bodoni.vlw.gz");
}
void loop(){
plotsprites();
drawpattern();
tint(255,255,255,1);
angle+=8;
if(angle > 360){ //prevents overflow after long run-time
angle = 1;
setspeeds();
}
radius = counter/10;
counter++;
if(fadedelay > 10){
image(fade, 0, 0, stagex, stagey); //causes fade effect
fadedelay = 0;
opac ++;
}else fadedelay++;
if(counter > 3300){
counter = 0;
opac = 20;
if (state < 5){
state ++;
}else state = 0;
initbg();
}
maintext();
if ((counter % 11)==10){
state = 1;
}else
state = (mouseX % 4)+1;
initbg();
// println(state);
}
void maintext(){
if(((counter > 200)&& (counter < 450))||((counter > 1300)&& (counter < 1550))){
textFont(font1, 25);
fill(255,255,255,8);
text("remember to forget to remember", 75 , 30);
}
if((counter > 800)&& (counter < 1000)){
textFont(font1, 25);
fill(255,255,255,8);
text("memories betray their creator", 80 , 370);
}
if((counter > 2000)&& (counter < 2300)){
textFont(font1, 25);
fill(255,255,255,8);
text("Predictions condemn us to a false forever", 27 , 198);
}
}
void initbg(){
BImage thepicture = bg1;
if(state == 1){
thepicture = bg1;
}
if(state == 2){
thepicture = bg2;
}
if(state == 3){
thepicture = bg3;
}
if(state == 4){
thepicture = bg4;
}
for(int i=0; i<width*height; i++) {
bgpixels[i] = thepicture.pixels[i];
}
}
void mousePressed()
{
counter = int(random(2500));
state = (mouseX % 4)+1;
initbg();
}
void setspeeds(){
for(int x = 0;x<10;x++){
speeds[x] = 20+int(random(70)); // setup a speed for the rotation of each vert
}
}
void initverts(){
for(int x=0;x< centersx.length ;x++){
angle = 0;
angle = 36 * x;
centersx[x] = centerx + (cos(angle*3.14/180)*radius);
centersy[x] = centery + (sin(angle*3.14/180)*radius);
}
}
void centerverts(){
for(int x=0;x< centersx.length ;x++){
angle2 = 0;
angle2 = 36 * x;
centersx[x] = centerx + (cos(angle2*3.14/180)*radius);
centersy[x] = centery + (sin(angle2*3.14/180)*radius);
}
}
void plotsprites(){
for(int x=0;x< spritesx.length ;x++){
speed = int(random(100));
spritesx[x] = centersx[x] + (sin((angle*speeds[x])*3.14/180)*radius);
spritesy[x] = centersy[x] + (cos((angle*speeds[x])*3.14/180)*radius);
}
}
void drawpattern(){
textFont(font1, 12);
for(int x=0;x< spritesx.length;x++){
if(((spritesx[x]<width)&&(spritesx[x]>0))&&((spritesy[x]<height)&&(spritesy[x]>0))){
// c1 = bgpixels[int(spritesy[x])*width+int(spritesx[x])];
color c1 = (bgpixels[int(spritesy[x])*width+int(spritesx[x])]) + color(0,0, 0,opac);
fill(c1);
text("remember", spritesx[x], spritesy[x]);
}
}
}
Assignment: Typography: Create an interactive experience based on a short piece of text (size 400 x 400 px).