Saturday, August 16, 2008

July 30 Processing notes

Processing class July 30 2008

Rigorous drawing stuff

do this:
BREAK DOWN COMPLICATED PROBLEMS INTO SIMPLE PROBLEMS.


How processing drawslings:
It takes a pen width and draws and then can take a different one and makes the next. Just like you might change a pen when drawing on paper.


TYPE CONSTANTS IN ALL CAPS, LIKE
strokeCap (SQUARE);




string is a collection of things

String dog = "Fido";
String dog2 = "Woofy";
String dog3 = "Charlie";
String dog4 = "Blue";
String dog5 = "Killer";
println(dog + "," + dog2 + "," + dog3 + "," + dog4);

or can do this

String[] dogs = {"Fido", " Woofy ", " Charlie ", " Blue " " Killer "}

Array = list, collection
To call it use []
So all [] is an array.

groceryItems[] = list (collection) of grocery items
groceryItems[ stuffToBuyAtGroceryToday =

1. milk
2. eggs
3. apples

{milk, eggs, apples} or, stuff between curly brackets are items on the list.

Now need a way to refer to these items in the list
Can refer to them by number
Look at #3 on the grocery items list
Or
stuffToBuyAtGroceryToday[2]         //in this case code counts from 0



Now use a short name


buyStuff.length //dot



colors

#201E12
#7382AD
#7C595F
#D66753
#CDDD74
#26738F
#978988
#86B742



Can use noise to generate random information. Is maybe more useful than random. Why????
Tron has use of noise to make data visual. Random is boring to look at. noise used to make octaves of randomness. Randomizes in an organic way. Perlin noise makes continuous slopes within the screen example shown. Semi continuous random information. Bands. Is a set of pre-calculated vectors. Good for generating clouds and smoke.

Using Translate

//can use translate to make something happen relative to another point
//subtle randomization can go a long way
//can make it look organic
//non-subtle randomization can look synthetic

pushMatrix and popMatrix are beginning and ending a translation. All the rest you don’t need to know.

Translate moves the 0,0 point from top left corner. All coordinates are relative to 0,0. translate allows you to move the 0,0 origin point to somewhere on the screen, or where ever you want it to be.

On 7a example, it looks like the square is rotating but actually the whole thing is rotating.


To rotate from the center of the square, instead of starting at 0,0; the corner of the square, make the start point -1/2width, -1/2height.

pushMatrix and popMatrix starts a new set of translations for each thing. pushMatrix starts the translation and popMatrix ends the rotation. There is a matrix behind the scenes that runs the whole thing.

0, 0 coordinate is top left. Is also how each shape is translated. Will rotate around top left corner. How to make it rotate around its center? Make with and height half of width and height. To use variables, see example 7b.


Size(200,200); //defaults to java 2d
Size(20,200,P3D); //is jave 3-d. is real 3-d that runs on the graphics card. Can be flakey
or
Size(20,200,OPENGL); //. GOGL. Will run in a browser but not well, otherwise is really true 3-d. can do things that run fast and look really good. Can copy and paste code to get good glow effects. Uses graphics card to make the effects.

Open GL library can be loaded into the sketch> import library menu button.

No comments: