// todo: // mouse based input/output // joint based animals ArrayList animals; float bH = 0; float bS = 50; float bV = 50; float myMaxX = 1000; float myMinX = -200; float myMaxY = 1000; float myMinY = -200; float currentOrientation=57; int currentSize=4; int currentHue = 50; int currentSpeed = 3; float currentWindRate = 5; float currentWindDirection = 1; int currentType = 0; int nChosenOne = 0; int renderRate = 3; int renderIteration = 0; float tightness = 10; int numTweetsShown = 100; boolean stop = false; String jointDescription = ""; int numConnections = 0; int nAnimalType = 0; boolean toggle = false; // 0 FSM // 1 Monkey // 2 Snake // 3 Parrot // 4 Pig void setup() { size(800,800); colorMode(HSB,360,100,100); textSize(12); animals = new ArrayList(); numTweetsShown = cannedTweet.length; //numTweetsShown = 1; //println(numTweetsShown + " is the length"); float ka = 1; float kmod = 0; for (int i = 0; i < cannedTweet.length; i++) { currentOrientation+=23; if(currentOrientation>360) currentOrientation-=360; currentSize+=2; if(currentSize>10) currentSize=2; currentHue+=47; if(currentHue>360) currentHue-=360; currentSpeed=(12-currentSize); currentType=4; //if (currentType>1) currentType = 1; currentWindRate += currentWindDirection*-.5; if (currentWindRate>7 || currentWindRate<3) { currentWindDirection=(-1)*currentWindDirection; } // for each tweet, create a new animal kmod+= .2; if (kmod>6.28) kmod = 0; ka *= 2; if(ka >16) ka =1; Animal myAnimal = new Animal( currentSpeed, // speed in pixels per frame currentSize, // /pixel size currentOrientation, // orientation in degrees currentHue, // hue mouseX, // xPos mouseY, // yPos currentWindRate, // wind Rate currentType, // animation type (e.g. animal) ka, // angle divisor kmod // angle constant ); //println("got here"); jointDescription=""; String msg = cannedTweet[i]; //Date d = t.getCreatedAt(); //println("Tweet by " + user + ": " + msg); //println("\"" + msg + "\","); //Break the tweet into words String[] input = msg.split(" "); for (int j = 0; j < input.length; j++) { String jointChar = "="; if(wordIsPreposition(input[j])==true) { myAnimal.AddJoint(j); jointChar = "P"; } if(wordIsConjunction(input[j])==true) { myAnimal.AddJoint(j); jointChar = "C"; } if(wordIsAbbreviation(input[j])==true) { myAnimal.AddJoint(j); jointChar = "A"; } if(wordIsAuthor(input[j])==true) { numConnections++; } else { myAnimal.AddWord(input[j]); jointDescription = jointDescription + jointChar; } } myAnimal.AddJoint(input.length-1); animals.add(myAnimal); println("joints " + jointDescription + "----->>> " + msg); //println("number of joints " + numJoints + "and number of authors " + numConnections + "current wind rate " + currentWindRate); } } void draw() { if (mousePressed && (mouseButton == LEFT)) { highlightSelection(); } if (mousePressed && (mouseButton == RIGHT)) { toggle = !toggle; animals.get(nChosenOne).bRenderText = true; } if(toggle == true) { background(0); } // noStroke(); color(0); //ellipse(displayWidth/4,displayHeight/4, displayWidth/8,displayWidth/8); //triangle(0,displayHeight, displayWidth/2,displayHeight/4, displayWidth,displayHeight); ellipse(400,400,750,750); int nMill1 = millis(); renderIteration++; if(renderIteration>=renderRate) { renderIteration = 0; //fill(255); for(int i=0; ianimals.size()) numTweetsShown=animals.size(); println("num tweets shown" + numTweetsShown); } if(key == '2') { numTweetsShown--; if(numTweetsShown<1) numTweetsShown=1; } if(key == '9') { numTweetsShown+=10; if(numTweetsShown>animals.size()) numTweetsShown=animals.size(); println("numtweets is " + numTweetsShown); } if(key == '3') { numTweetsShown-=10; if(numTweetsShown<1) numTweetsShown=1; } if(key == '7') { tightness*=1.618; //if(tightness<1) tightness=1; } if(key == '1') { tightness/=1.618; if(tightness<1) tightness=1; } if(key == ' ') { stop = !stop; } } boolean wordIsConjunction(String wordTest) { boolean retVal = false; for(int j=0; j=4) { if(wordTest.substring(0,4).equals("http")) { retVal = true; } } return retVal; } boolean wordIsAuthor(String wordTest) { boolean retVal = false; if(wordTest.length() > 0) { if(wordTest.substring(0, 1) == "@") { retVal = true; } } return retVal; } class Animal { float speed; int size; float orientation; int hue; int xPos; int yPos; float windRate; float currWindRate; float currWindDirection = 1; int type = 1; int frame; int jointFrame; int jointdir=1; float kangle; float angleMod; boolean iAmTheChosenOne = false; float xDisp = 0; float yDisp = 0; ArrayList words = new ArrayList(); ArrayList joints = new ArrayList(); int numAnimations = 125; // add size later boolean bChangeDirection; public boolean stopped = false; public boolean bRenderText = false; Animal(float $speed, int $size, float $orientation, int $hue,int $xPos, int $yPos, float $windRate, int $type, float $kangle, float $angleMod) { // initialize attributes speed = $speed; size = $size; orientation = $orientation; hue = $hue; xPos = $xPos; yPos = $yPos; frame = 0; windRate = $windRate; currWindRate = windRate; type = $type; kangle = $kangle; angleMod = $angleMod; float degRad = orientation*PI/180; xDisp = speed*cos(degRad); yDisp = speed*sin(degRad); } void AddWord(String nextword) { words.add(nextword); } void AddJoint(int nextjoint) { Joint myJoint= new Joint(nextjoint); joints.add(myJoint); } boolean IsJoint(int position) { for(Joint j: joints) { if (j.position == position) { return true; } } return false; } int nPolygonSize = 100; void render() { bChangeDirection = false; if(stopped == false) { xPos += xDisp; yPos += yDisp; if(xPos>myMaxX || xPos < myMinX) { xDisp = -xDisp; } if(yPos>myMaxY || yPos=numAnimations) frame=0; currWindRate += currWindDirection*-.1; if (currWindRate>(windRate*5) || currWindRate<(windRate-5)) { currWindDirection=(-1)*currWindDirection; } } switch(type) { case 1: { float currJointXpos = 0; float currJointYpos = 0; float angle = 0; float cumulativeX = xPos; float cumulativeY = yPos; float cumulativeAngle = angleMod+(float)frame/20; float cumulativeDirection = 1; int jointIndex = 0; int spiralIndex = 0; int dimmer = 0; for(Joint j: joints) { while(jointIndex=numAnimations) jointFrame=0; if(jointFrame <0) jointFrame=numAnimations; } float angle = i+(float)jointFrame/20; currJointXpos = xPos+(i+currWindRate)*7*cos(angle); currJointYpos = yPos+(i+currWindRate+3)*7 *sin(angle); if (bRenderText==true) { text(word, currJointXpos, currJointYpos); } else { float x1=xPos+(i+currWindRate)*7*cos(angle); float y1=yPos+(i+currWindRate+3)*7 *sin(angle); float x2=x1-nPolygonSize/2; float y2=y1+nPolygonSize; float y3=y2; float x3=x1+nPolygonSize/2; triangle(x1, y1, x2, y2, x3, y3); color(0,0,0); text(word, xPos+(i+currWindRate)*7*cos(angle), yPos+(i+currWindRate+3)*7 *sin(angle)); } } */ break; } case 2: { for(int i=0;i=numAnimations) jointFrame=0; if(jointFrame <0) jointFrame=numAnimations; } float angle = i+(float)jointFrame/20; currJointXpos = xPos+(i+currWindRate)*7*cos(angle); currJointYpos = yPos+(i+currWindRate+3)*7 *sin(angle); if (bRenderText==true) { text(word, currJointXpos, currJointYpos); } else { float x1=xPos+(i+currWindRate)*7*cos(angle); float y1=yPos+(i+currWindRate+3)*7 *sin(angle); float x2=x1-nPolygonSize/2; float y2=y1+nPolygonSize; float y3=y2; float x3=x1+nPolygonSize/2; triangle(x1, y1, x2, y2, x3, y3); color(0,0,0); text(word, xPos+(i+currWindRate)*7*cos(angle), yPos+(i+currWindRate+3)*7 *sin(angle)); } } */ break; } default: { println("out of bounds"); break; } } } } class Joint { int position; float jointAngle; Joint(int $position) { // initialize attributes position = $position; } } // @ is the head // if multiple @, then used a s ajoint // prepositions and conjunctions are joints String[] cannedTweet = { "Endowed with talmudic wisdom, his prophetic, foresight and pragmatic sense of urgency deemed him an invaluable seer.", "He had derelict possessions, he lived like a vagrant, he stooped like a leper, and groveled like a broken beggar.", "But there was a sense of inexplicable and nearly esoteric knowledge within him.", "Of all the grand rebbes of eastern Europe whose souls were sucked dry by German built chimneys, whose charred remains were shoveled out like dusted dough into ovens.", "His was, resounding, and true.", "And there was something maudlin about hearing him and other Hasidic Jews rock back in forth and chant in tandem, filling large banquet halls in Brooklyn to capacity.", "He was part of a subset, a counterculture of sorts, on the periphery of everything Secular and American.", "But he was deeply, deeply, deeply disgusted by those who did not understand him or know him.", "It been circulating for a number of years that prolific pedophilia and sexual violence has been occurring in Hasidic communities in New York.", "Ritual baths or mikvahs have become hotspots of molestation and rape by rabbis and other distinguished members of the community.", "Young boys and young girls are fondled and fingered in schools.", "Its the mark of a dark underbelly, with no accountability, and no real legal mechanisms within the community to advocate for the victims within a patriarchal sordid society.", "But this man wasn’t evil, this man wasn’t a sexual deviant, this man wasn’t a pervert.", "He wasn’t a violator or an aggressor.", "He was kind.", "He had soft, knowing, hazel eyes.", "His skin once tan as a young boy and man, had become yellowed and wrinkled with age.", "At 86 he resembled a little vulture, with a twinkle.", "His wife had died and his children all twelve of them had moved to Kiryas Joel, 20 some odd miles northwest of New York City.", "They abandoned him because his scriptural revelations did not mesh well with the evermore stringent Satmar tradition.", "They left him there, in Williamsburg alone.", "So here he was a lonely hasid in the middle of Brooklyn.", "Living in a damp apartment, next door to slightly less observant Bukharan Jews from Georgia and Southern Russia.", "He was just a new fixture in his building and in the neighborhood.", "Shuffling down the street with a limp, but with as much purpose as a marching zealot.", "Carrying plastic “C-Town” bags filled with onions.", "He carried onions to remind him of the shtetl where he worked and lived as a boy in Poland before the Nazis came.", "He had a vivid recollection of chopping onions with his uncles on a spring day.", "And he developed this new habit.", "His visits to grocery stores and bodegas became ritualized, in order to pick up more onions.", "And for the first time in his life he was set free from the community, he was banished, considered a phantom.", "So he would smile at Puerto Rican kids walking by, or black kids walking by, or blue eyes gentiles walking by.", "He ironically became a Jewish Santa Claus on his block.", "Handing out candy around Christmastime.", "He was a withered man, but a vibrant soul.", "A somber reflection of years and years and years of religious study and practice.", "But also a living example of those ideals.", "Moishe is living by his own accord and he is heroic because of it." }; String[] prepositions = { "a", "abaft", "aboard", "about", "above", "absent", "across", "afore", "after", "against", "along", "alongside", "amid", "amidst", "among", "amongst", "an", "anenst", "apropos", "apud", "around", "as", "aside", "astride", "at", "athwart", "atop", "barring", "before", "behind", "below", "beneath", "beside", "besides", "between", "beyond", "but", "by", "circa", "c.", "ca.", "concerning", "despite", "down", "during", "except", "excluding", "failing", "following", "for", "forenenst", "from", "given", "in", "including", "inside", "into", "lest", "like", "mid", "midst", "minus", "modulo", "near", "nigh", "next", "notwithstanding", "o'", "of", "off", "on", "onto", "opposite", "out", "outside", "over", "pace", "past", "per", "plus", "pro", "qua", "regarding", "round", "sans", "save", "since", "than", "through", "thru", "throughout", "thruout", "till", "times", "to", "toward", "towards", "under", "underneath", "unlike", "until", "unto", "up", "upon", "versus", "vs", "v.", "via", "vice", "vis-à-vis", "with", "w/", "within", "w/in", "w/i", "without", "w/o", "worth" }; String[] conjunctions = { "And", "Or", "But", "Nor", "So", "For", "Yet", "After", "Although", "As", "As If", "As Long As", "Because", "Before", "Even If", "Even Though", "If", "Once", "Provided", "Since", "So That", "That", "Though", "Till", "Unless", "Until", "What", "When", "Whenever", "Wherever", "Whether", "While" }; String[] interjections = { "aah", "ack", "agreed", "ah", "aha", "ahem", "alas", "all right", "amen", "argh", "as if", "aw", "ay", "aye", "bah", "blast", "boo hoo", "bother", "boy", "brr", "by golly", "bye", "cheerio", "cheers", "chin up", "come on", "crikey", "curses", "dear me", "doggone", "drat", "duh", "easy does it", "eek", "egads", "er", "exactly", "fair enough", "fiddle-dee-dee", "fiddlesticks", "fie", "foo", "fooey", "gadzooks", "gah", "gangway", "g'day", "gee", "gee whiz", "geez", "gesundheit", "get lost", "get outta here", "go on", "good", "good golly", "good job", "gosh", "gracious", "great", "grr", "gulp", "ha", "ha-ha", "hah", "hallelujah", "harrumph", "haw", "hee", "here", "hey", "hmm", "ho hum", "hoo", "hooray", "hot dog", "how", "huh", "hum", "humbug", "hurray", "huzza", "I say", "ick", "is it", "ixnay", "jeez", "just kidding", "just a sec", "just wondering", "kapish", "la", "la-di-dah", "lo", "look", "look here", "long time", "lordy", "man", "meh", "mmm", "most certainly", "my", "my my", "my word", "nah", "naw", "never", "no", "no can do", "nooo", "not", "no thanks", "no way", "nuts", "oh", "oho", "oh-oh", "oh no", "okay", "okey-dokey", "om", "oof", "ooh", "oopsey", "over", "oy", "oyez", "peace", "pff", "pew", "phew", "pish posh", "psst", "ptui", "quite", "rah", "rats", "ready", "right", "right on", "roger", "roger that", "rumble", "say", "see ya", "shame", "shh", "shoo", "shucks", "sigh", "sleep tight", "snap", "sorry", "sssh", "sup", "ta", "ta-da", "ta ta", "take that", "tally ho", "tch", "thanks", "there", "there there", "time out", "toodles", "touche", "tsk", "tsk-tsk", "tut", "tut-tut", "ugh", "uh", "uh-oh", "um", "ur", "urgh", "very nice", "very well", "voila", "vroom", "wah", "well", "well done", "well, well", "what", "whatever", "whee", "when", "whoa", "whoo", "whoopee", "whoops", "whoopsey", "whew", "why", "word", "wow", "wuzzup", "ya", "yea", "yeah", "yech", "yikes", "yippee", "yo", "yoo-hoo", "you bet", "you don't say", "you know", "yow", "yum", "yummy", "zap", "zounds", "zowie", "zzz" }; String[] abbreviations = { "<3", "404", "A3", "ADN", "AFAIK", "AFK", "ARE", "ASAP", "A/S/L?", "B4N", "BAK", "BAS", "BBIAB", "BBL", "BBN", "BBS", "BEG", "BF", "BFD", "BFN", "BG", "BIBO", "BIOYIOP", "BL", "BMGWL", "BOTEC", "BRB", "BTA", "BTDT", "BTW", "BWL", "BWTHDIK", "CICO", "C&G", "CNP", "CFUU", "CHUA", "CJWB", "CMIU", "CNDL", "COCR", "CRB", "CRBT", "CRS", "CU", "CUL", "CUL8ER", "CYA", "CYA", "CYO", "DBA", "DFLA", "DL", "DLTBBB", "DIKU", "DITYID", "DOM", "DOS", "DQMOT", "DTRT", "DWB", "E2E", "E2E", "E2E", "E2E", "EEGF", "EEMD", "EG", "EIOE", "EMFBI", "EMSG", "EOM", "EOT", "ESAD", "ESTO", "ETLA", "EWG", "F2F", "FAQ", "FC", "FISH", "FLA", "FMTYEWTK", "FOMCL", "FTBOMH", "FUBAR", "FUD", "FWIW", "FYI", "G", "GA", "GAL", "GIGO", "GD&R", "GF", "GFN", "GGP", "GIWIST", "GL", "GMAB", "GMTA", "GOL", "GTRM", "GTSY", "H&K", "HAGN", "HAND", "HEMD", "HHIS", "HIG", "HT", "HTH", "HUB", "IAC", "IAE", "IANAL", "IAW", "IC", "IGP", "IHA", "IHU", "IIRC", "ILU or ILY", "IM", "IMCO", "IMHO", "IMing", "IMNSHO", "IMO", "IMS", "IOW", "IPN", "IRL", "ITA", "ITIGBS", "IWALU", "IYSWIM", "J4G", "JBOD", "JIC", "JK or j/k", "JMO", "JTLYK", "k", "KISS", "KIT", "KOTC", "KOTL", "KWIM?", "L8R", "L8R G8R", "LD", "LDR", "LHO", "LLTA", "LMFAO", "LMAO", "LMSO", "LOL", "LRF", "LSHMBH", "LTM", "LTNS", "LTR", "LULAB", "LULAS", "LUWAMH", "LY", "LY4E", "MorF", "MOSS", "MOTOS", "MTF", "MUSM", "NADT", "NFG", "NFW", "NIFOC", "NP or N/P", "NPI", "NRN", "OIC", "OLL", "OMG", "OTF", "OTOH", "OTTOMH", "PANS", "PAW", "PCMCIA", "PDA", "PEBCAK", "PIBKAC", "PI", "PITA", "PM", "PMFJIB", "POAHF", "::POOF::", "POTS", "PU", "QT", "RL", "ROR", "ROTFL", "ROTFLMAO", "ROTFLMAOWPIMP", "ROTFLMBO", "RPG", "RSN", "RT", "RTFM", "RYO", "S^", "S4L", "SHCOON", "SEG", "SETE", "SF", "SHID", "SNAFU", "SO", "SOL", "SOMY", "SOT", "SOTMG", "STFU", "STFW", "STW", "SU", "SUAKM", "SUP", "SWAG", "SWAK", "SWL", "SYS", "TA", "TAFN", "TANSTAAFL", "TCOY", "TD2O", "TFH", "TGIF", "THX", "TIA", "TILII", "TLA", "TLK2UL8R", "TB4U", "TMI", "TNT", "TOPCA", "TOY", "TPTB", "TTFN", "TTT", "TTYL", "TU", "TY", "TYVM", "UAPITA", "UAF", "UW", "UWFS", "VBG", "VBSEG", "WAG", "WAYD", "WB", "WBS", "WDALYIC", "WEG", "WFM", "WIBNI", "WOMT", "WT?", "WTF", "WTFO", "WTG", "WTGP?", "WU?", "WYSITWIRL", "WUF?", "WYSIWYG", "YBS", "YGBSM", "YMMV", "YW" };