Maya Irvine – Project1 – TextRain

by mirvine @ 1:16 am 25 January 2011

TextRain. Not quite perfect. Hopefully better in the future. :D

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
//Project1 - Gauntlet 
//Textrain by Camille Utterback & Romy Achituv (1999)
//Maya Irvine
//Thanks goes to Justin Edmund for the helps
//Interactive Art and Computational Design Spring 2011
//Carnegie Mellon University
 
 
String string = "Singing in the Rain!";
int[] speed = new int[string.length()];
int[][] position = new int[2][string.length()];
 
 
import processing.video.*;
Capture myWebcam;
 
 
void setup() 
{
  size(400, 300);
  myWebcam = new Capture(this, width, height);
 
 
  for (int i = 0; i < string.length(); i++) {
    position[0][i] = i*20+20;
    position[1][i] = 0;
    speed[i] = (int)random(1, 4);
  }
}
 
 
 
void draw() 
{
  image(myWebcam, 0, 0);
  filter(GRAY);
   {
      myWebcam.read();
   }
 
  rain();
}
 
 
void rain()
{
 
   for (int i = 0; i < string.length(); i++) {
 
     loadPixels();
     fill(random(255),random(255),random(255));
     textSize(14);
     position[1][i] += speed[i];
     println(get(position[0][8], position[1][8]));
 
    if (position[1][i] >= 550) {
       position[1][i] = 0;
    }
 
    color location = get(position[0][i], position[1][i] -185);
    color location2 = get(position[0][i], position[1][i] -230);
 
     if(location <= -14803426){
 
     speed[i] = 0;
        if(location2 <= -14803426 )
     {
        position[1][i] += -1*speed[i];
     }
     }
 
     else if(location >= -14803426 )
     {
        speed[i] = (int)random(1, 4);
     }
 
 
 
 
 
     text(string.charAt(i), position[0][i],position[1][i]-200);
 
 
   }
 
 
 
}
 
 
void captureEvent(Capture myWebcam) 
{
  myWebcam.read();
}

1 Comment

  1. Hi Maya,
    Nice work, glad you uploaded this.
    Check the instructions for code embedding (http://golancourses.net/2011spring/instructions/code-embedding/) so that your code looks nicer when you embed it in the blog.
    In the demo video above, I don’t understand how the letters don’t get trapped in the windows above your head — they seem to be roughly the same darkness as your sweater.

    Comment by Golan Levin — 26 January 2011 @ 12:33 am

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License.
(c) 2014 Interactive Art & Computational Design / Spring 2011 | powered by WordPress with Barecity