DOC PREVIEW
GT LCC 6310 - Computation as an Expressive Medium

This preview shows page 1-2-24-25 out of 25 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 25 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 25 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 25 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 25 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 25 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Computation as an Expressive Computation as an Expressive MediumMediumMediumMediumLab 6: String TheoryLab 6: String TheoryJoshua CuneoJoshua CuneoAdAdAgendaAgenda More classesMore classesStrings and fontsStrings and fontsStrings and fontsStrings and fonts Assignment 3Assignment 3Pjt3Pjt3Project 3Project 3Classes (Again)Classes (Again)Classes (Again)Classes (Again)class Cookie {int numChips;fieldsCookie(int chips) {constructor(kidnumChips = chips;}void drawCookie()(one kind of method) void drawCookie() {ellipse(numChips, numChips, 10, 10);}methods}Classes (Again)Classes (Again)Classes (Again)Classes (Again)class ChocolateCookie extends Cookie{int amtChocolate;numberChipsdrawCookie() ChocolateCookie(int amt) {super(amt);amtChocolate = amt;}void drawCookie()amtChocolatedrawCookie() void drawCookie() {fill(188, 143, 143);super.drawCookie();}}supersupersupersuperclass ChocolateCookie extends Cookie class Cookie {int amtChocolate;{int numChips;ChocolateCookie(int amt) {super(amt);Cookie(int chips) {numChips = chips;amtChocolate = amt;}void drawCookie()}void drawCookie() {void drawCookie() {fill(188, 143, 143);super.drawCookie();{ellipse(numChips, numChips, 10, 10);}}}}thisthisthisthisclass ChocolateCookie extends Cookie{int amtChocolate;ChocolateCookie(int amt) {super(amt);amtChocolate = amt;this.drawCookie();}void drawCookie() {fill(188, 143, 143);super.drawCookie();}}StingsaenotmadeofTheadsStingsaenotmadeofTheadsStrings are not made of ThreadsStrings are not made of Threads???St ing detailsSt ing detailsString detailsString detailscharcharsomelettersomeletter='b';='b';char char somelettersomeletter= b;= b;StringStringsomewordssomewords"Where are my pants?";"Where are my pants?";String String somewordssomewords= "Where are my pants?";= "Where are my pants?";St ing methodsSt ing methodsString methodsString methodsString fish = "Bass"; String expletive = fish substring(1 4);String expletive = fish.substring(1,4);char letterA = fish.charAt(1);Sti biFih fihtU C ()String bigFish = fish.toUpperCase();String smallFish = fish.toLowerCase();http://processing.org/reference/String.htmlhttp://processing.org/reference/String.htmlp //p g g/ / gp //p g g/ / gSt ing concatenationSt ing concatenationString concatenationString concatenationString s1 = "I love the "; String s2 ="chupacabra";String s2 = chupacabra.;String sentence = s1 + "delicious " + s2;println(sentence); // t tIl th dlii h b// outputs: I love the delicious chupacabra.Concatenation ith n mbe sConcatenation ith n mbe sConcatenation with numbersConcatenation with numbersString anothersentence = s1 + 3 + “ rd” + s2;// "I love the 3rd chupacabra."anothersentence = s1 + nf(7,3) + " " + s2;// "I love the 007 chupacabra "// "I love the 007 chupacabra."anothersentence = s1 + nf(3.14159,3,2)+ " " + s2;aotesetece s(3. 59,3, )s;// "I love the 003.14 chupacabra."St ings and A a sSt ings and A a sStrings and ArraysStrings and ArraysString[] a = { "One", "string", "to", "rule", "them", "all…" };String tolkien = join(a, " ");// tolkien == "One string to rule them all…"gString b = "Another string to bind them…"String[] tolkien2= split(b, " ");// tolkien2 == { "Another", "string", "to", "bind", "them…" }Special cha acte sSpecial cha acte sSpecial charactersSpecial characters tab: "tab: "\\t"t" new line: "new line: "\\n"n"\\String String twolinestwolines = "I am on one line.= "I am on one line.\\nn I am I am \\tton another."on another."I am on one line.I am on one line.I am on I am on another.another. other other escape charactersescape charactersincludeinclude ""\\\\" "" "\\""""FontsFontsBasic Font DisplayBasic Font DisplayBasic Font DisplayBasic Font DisplayPFont tnr = loadFont("TimesNewRomanPSMT-48.vlw");textFont(tnr 44);textFont(tnr, 44);text("To Boldly Go", 10, 40);Basic Font DisplayBasic Font DisplayBasic Font DisplayBasic Font DisplayPFont tnr = loadFont("TimesNewRomanPSMT-48.vlw");fill(25500);fill(255, 0, 0);textFont(tnr, 44);text("To Boldly Go", 10, 40);Basic Font DisplayBasic Font DisplayBasic Font DisplayBasic Font DisplayPFont tnr = loadFont("TimesNewRomanPSMT-48.vlw");fill(25500);fill(255, 0, 0);textAlign(RIGHT);textFont(tnr, 44);text("To Boldly Go", 10, 40);Textual TransformationTextual Transformationvoid setup(){PFont tnr loadFont("TimesNewRomanPSMT48vlw");PFont tnr = loadFont("TimesNewRomanPSMT-48.vlw");fill(255, 0, 0);textAlign(RIGHT);textAlign(RIGHT);textFont(tnr, 44);}void draw(){pushMatrix();translate(3000);translate(300, 0);scale(1.1);text("To Boldly Go", 10, 40);popMatrix();p p ();}switchswitchit h (k)if(k8)switch (k) {case 8:println("Backspace");break;if(k == 8){println("Backspace");}else if(k ==127)break;case 127:println("Delete"); break;default:else if(k == 127){println("Delete");}elsedefault:println("Everything Else");break;}else{println("Everything Else");}key key ––not lettersnot lettersyyvoid keyPressed() {char k;char k;k = (char)key;switch (k) {case 8:println("Backspace"); break;;case DELETE:println("Delete"); break;default:default:println("Everything Else");break;}}}keykeylettersletterskey key --letterslettersid k P d()void keyPressed() {if (key == 'a' || key == 'A') {// do something}}}ReviewReviewReviewReview Class supplementClass supplementStringsStringsStringsStrings FontsFontsswitch and keyswitch and keyswitch and keyswitch and keyAssignment 3Assignment 3ggA3-01: Create a subclass of PImage that implements a mosaic(int blockSize) method The blockSize parameter specifies how big the mosaic block is (e gmethod. The blockSize parameter specifies how big the mosaic block is (e.g. blockSize = 4 would mean the mosaic block size is 4 pixels by 4 pixels). The mosaic method should replace each block of pixels in the image (e.g. if blockSize = 4, each block of 4 by 4 pixels) with the average color value of the pixels in that bl k L k h Pi lMifiliPh hf lfhhiblock. Look at the Pixelate->Mosaic filter in Photoshop for an example of what this image operation does. Demonstrate your new class by drawing an image with several different block sizes. Include your example images with your submission.A3-02: Write a small app that demonstrates kinetic text. Your app should allow the user to type something and the text moves around in some way while they type. For example, the user might type text on a line, but slowly the words or letters start drifting apart or perhaps the line starts bending or the words and letters flutter


View Full Document

GT LCC 6310 - Computation as an Expressive Medium

Documents in this Course
Load more
Download Computation as an Expressive Medium
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Computation as an Expressive Medium and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Computation as an Expressive Medium 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?