DOC PREVIEW
GT LCC 6310 - LCC 6310 Lecture Notes

This preview shows page 1-2-22-23 out of 23 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 23 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 23 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 23 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 23 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 23 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

LCC 6310The Computer as an Expressive MediumLecture 2AdministriviaAdministriviaBook(s)?Processing installed?Lab timesFriday 9:05 - 10:55, DM LabTA: Joshua Cuneo, [email protected] office hoursMy office hoursTuesday 1-3, Skiles 019 or by appt.Josh’s lab hours?, DM LabOverviewOverviewDiscuss variables & if-thenDiscuss readingsLook at assignment 1Readings for next weekDrawing primitives revisitedDrawing primitives revisitedWhat are the different parts of a drawing primitive?method nameline(0, 0, 50, 50);argumentsparentheses contain argumentsThe drawing commands aremethodsThe drawing commands are methodsMethods are reusable commands Like a little machine that does work for youLet you reuse code without typing it over and overThe arguments tell the method precisely what to doe g Bake(350 degrees 45 minutes)e.g. Bake(350 degrees, 45 minutes)Multiply(2, 7)Walk(Forwards 50 ft )Walk(Forwards, 50 ft.)We’ll see later that you can define your own methods!yyIntroduction to variablesIntroduction to variablesA variable is a named box for storing valuesYou can put values in a variable by using the assignment operator (in Java the assignment operator is"=")Java, the assignment operator is = )e.g. x = 1;To use the value stored in a variable, just use the variable’s namee.g. line(x, 0, 50, 50);gBut how does Java know what kind of value can go in a variable?Variables have atypeVariables have a typeYou must tell Processing (i.e. Java) what kinds of values can go in th bthe boxYou do this by giving a variable atypeYou do this by giving a variable a typeint x; // variable x can hold integers (int)inty; // variable y can hold integers (int)inty; // variable y can hold integers (int)x = 20; // store 20 in xy = 30; // store 30 in y//Let's try it in Processingpoint(x, y); // use the values of x and y to draw a pointEffect of creating an int variableEffect of creating an int variableCodeEffect// Single intint anInt;CodeEffectName: anInt, Type: intta t;Name:anIntType:int// Put a value in the intanInt = 3;3Name: anInt, Type: int// Type error!anInt "hello";Name: anInt, Type: int"hello"anInt = "hello";Can’t shove "hello" into an intAssigned values must match the typeAssigned values must match the typeint x; // variable x can hold integers (int)int y; // variable y can hold integers (int)x = 1 5; // store 1 5 in xcauses an error!!!x = 1.5; // store 1.5 in xcauses an error!!!y = 30; // store 30 in ypoint(x, y); // use the values of x and y to draw a pointLet's see this in ProcessingCan combine declaring and assigningCan combine declaring and assigningDeclaring a variable means telling Processing its typeint x; // variable called 'x' is an integerAssigninga value to a variable means putting a value in the named boxAssigninga value to a variable means putting a value in the named boxx = 1; // variable called 'x' stores value 1You can declare and assign at the same timeint x = 1; But only declare a variable once, otherwise you get an error!The "primitive" typesThe "primitive" typesint – integers between -2,147,483,648 and 2,147,483,647 That's pretty big! (32 bits or 4 bytes long to be precise)float – floating point numbers (e.g. 3.1415927, -2.14)hblllThese are 32 bits long as wellchar – a single character (e.g. 'c')byteintegers between128 and 127 (i e 8 bits)byte –integers between -128 and 127 (i.e. 8 bits)boolean – holds the values 'true' or 'false'color–holds a color (red green blue alpha)color holds a color (red, green, blue, alpha)color c1 = color(255,0,0, 0); // pure red color, transparentcolor c2 = color(255,0,0,255); // pure red color, opaqueLt' t th iPidfi dth i thfLet's try these in Processing and find them in the reference.Print and printlnPrint and printlnWhen working with variables, it is often useful to look at their valuesprint() and println() print to the bottom processing paneThey do the same thing, except println starts a new line after printingLt' t thi tiPiLet's try this out in Processing…Control flowControl flowBy default Java executes the lines of a method one after the otherSequential control flowUnconditional– doesn’t matter what happens in the worldOften we want to control which steps are executed depending on what else has happenedThat is, we want conditionalcontrol flowThis is necessary in order to make anything that is interactiveififif statements introduce conditional branchesif (<boolean expression>){// do this code}Boolean expressions have one of two values: true or falsee g if(my alarm clock is going off){e.g. if(my alarm clock is going off){hit snooze!}}ifelse variationif-else variationif (<boolean expression>){// do this code} else {// do this other code}f( ){e.g. if(time == 11:55am){Say “See you next class!”}}else{keep teachingkeep teaching…}ifelseif variationif-elseif variationif (<boolean expression>){// do this code} else if (<another boolean expression>) {// do this other code}Some boolean expressionsSome boolean expressionsanInt == 1 true if the value of variable anInt is equal to 1x > 20 true if the value of variable x is greater than 201 == 2 true if 1 is equal to 2 (it’s not so this is false)! is the not operator – reverses true and false so, it !! (1 == 2)is true!This is not a boolean expressionThis is not a boolean expressionint anInteger = 1;Remember,'='is the assignment operator, while'=='is used to check ifRemember, is the assignment operator, while is used to check if the two sides of the expression are equal to one anotherExamplestrokeWeight(2); // draw with heavier linestroke(200, 0, 0); // draw with reddish lineboolean drawRect = true; boolean drawAnX = true;if (drawRect) {fill(0, 200, 0); // fill with greenrect(30, 30, 40, 40);}if (drawAnX) {line(0, 0, 100, 100);line(100, 0, 0, 100);}Try changing the values of drawRect and drawAnXReadingsReadingsSummary presentations & questions for discussionFrom Software: Exhibition at the Jewish Museum(NMR p.247)Four Selections by Experiments in Art and Technology(NMR p.210)Concepts Notations Software Art(Linked from course website)Concepts, Notations, Software, Art(Linked from course website)What do you think of this?What do you think of this?”h i i hi dh”…those computer scientists who invented these technologies … are the important artists of our time, maybe the only artists who are truly important and who yy ypwill be remembered from this historical period."Lev ManovichWhy program?Why program?Relationship between art and CSShould new media artists program? Why?What


View Full Document

GT LCC 6310 - LCC 6310 Lecture Notes

Documents in this Course
Load more
Download LCC 6310 Lecture Notes
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 LCC 6310 Lecture Notes 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 LCC 6310 Lecture Notes 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?