Created
October 1, 2010 04:58
-
-
Save rtanglao/605765 to your computer and use it in GitHub Desktop.
vancouverAverageColourFromRolands21000cameraphonePhotos
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Function to get an Array of integers from a Google Spreadsheet | |
| int[] getNumbers() { | |
| String lines[] = loadStrings("coloursForProcessing3.txt"); | |
| println("there are " + lines.length + " lines"); | |
| int[] returnArray = new int[lines.length]; | |
| for (int i=0; i < lines.length; i++) { | |
| println("line:"+i+":"+lines[i]); | |
| returnArray[i] = int(lines[i]); | |
| }; | |
| return returnArray; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // original code by jer thorpe apri 2010 | |
| // hacked by roland tanglao september 2010 | |
| void setup() { | |
| //This code happens once, right when our sketch is launched | |
| size(800,600); | |
| background(255); | |
| smooth(); | |
| //Ask for the list of numbers | |
| int[] numbers = getNumbers(); | |
| noStroke(); | |
| for (int i = 0; i < numbers.length; i++) { | |
| println("numbers["+i+"]:"+numbers[i]); | |
| int r, g,b; | |
| b = numbers[i] % 256; | |
| g = (numbers[i] >> 8) % 256; | |
| r = (numbers[i] >> 16) % 256; | |
| fill(r,g,b); | |
| ellipse(((i % 200) * 4)+2, i / 200 + (i / 200 * 4)+2, 4,4); | |
| }; | |
| }; | |
| void draw() { | |
| //This code happens once every frame. | |
| }; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment