designing with code
TRANSCRIPT
-
8/8/2019 Designing with Code
1/11
Designing with Code
simple intro/review
of some useful
programming basics
design and information archi
-
8/8/2019 Designing with Code
2/11
Designing with Code
Object Oriented Programming
OOPs
Processing, ActionScript, Java, Javascript
use of objects, functions and methods
Frameworks
jQuery, Tweener, Hype, Papervision, a reusable set of libraries or classes for software systems
Syntax
grammar rules specific to each language
but all OOPs language have some things in common
-
8/8/2019 Designing with Code
3/11
Designing with Code
Objects
smaller building blocks - easier to work with
way to group variables with related functions
eg. PImage, PFont, PShape - Processing
specific properties and/or methods
Classes
class defines the properties and methods available
each object falls under a single class
eg. MovieClip, TextField, Video - ActionScript
individual object - instance
-
8/8/2019 Designing with Code
4/11
Designing with Code
Class rad
volume
band
powerfrequency
setVolume
setBand
setPowersetFrequency
methods
actions, beh}properties
attributes, fields {
this object is aninstance of radio clas}
-
8/8/2019 Designing with Code
5/11
-
8/8/2019 Designing with Code
6/11
Designing with Code
Variables
types of variables - int, float,
a holder for value
value can be an expression used as parameters
int myWidth = (320*2);
int myHeight = (240 + 240);
int mySquare = 60;
int myCircle = 60;
background(0);
size(myWidth, myHeight );
rect(30, 30, mySquare, mySquare);
ellipse(130, 60, myCircle,
myCircle);
int myWidth = (320
int myHeight = (24
int mySquare = 60;
int myCircle = 60;
//show the value o
println(myCircle);//sometimes you n
println("myCircle"
// formatting like th
println("myCircle"
background(0);
size(myWidth, myH
rect(30, 30, mySqua
ellipse(130, 60, my
-
8/8/2019 Designing with Code
7/11
Designing with Code
Arrays
create multiple variables without defining a new name for each code shorter, easier to read and update
-
8/8/2019 Designing with Code
8/11
Designing with Code
Arrays
To make an array, just place brackets after the data type:
The beauty of creating an array is the ability to make 2, 10, or
100,000 variable values with only one line of code. For instance, thefollowing line creates an array of 2,000 integer variables:
Arrays can also be made of other data types like images:
int[] x;
int[] x = new int[2000]
PImage[] images = new PImage[32];
-
8/8/2019 Designing with Code
9/11
Designing with Code
Arrays
create multiple variables without defining a new name for each code shorter, easier to read and update
float x1 = -10
float x2 = 10;
float x3 = 35;
float x4 = 18;
float x5 = 30;
void setup() {
size(240, 12
smooth();
noStroke();
}
void draw() {
background
x1 += 0.5;
x2 += 0.5;x3 += 0.5;
x4 += 0.5;
x5 += 0.5;
arc(x1, 20, 2
arc(x2, 40, 2
arc(x3, 60, 2
arc(x4, 80, 2
arc(x5, 100,
}
too man
-
8/8/2019 Designing with Code
10/11
Designing with Code
Arrays
this examples shows 3000 variables in an array using repetition loop to work with large arrays keeps the code concise need to know the length of the array
float[] x = ne
void setup()
size(240, 12
smooth();
noStroke();
fill(255, 200
for (int i = 0
x[i] = rand
}
}
void draw() {
background
for (int i = 0x[i] += 0.5
float y = i *
arc(x[i], y,
}
}
Let the the v
-
8/8/2019 Designing with Code
11/11
thats it for now ....
we will get into this more in the coming classes
design and information archi