Intro to Processing Flashcards

1
Q

What is the command to draw a rectangle?

A

rect(x of top left, y of top left, width, height);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the command to draw a line?

A

line(x of start, y of start, x of stop, y of stop);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the command to draw an ellipse?

A

ellipse(x of center, y of center, width, height);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

In order, what are the primary colours of light?

A

Red, Green, Blue

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What are the 3 different colours you can change in processing?

A

Background, Stroke, Fill

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

In greyscale, what value represents black? White?

A

0, 255

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the fourth parameter of a colour command?

A

Transparency

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What value would you use to make something transparent? Opaque?

A

0, 255

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is the command to change the thickness of a line?

A

strokeWeight(width in pixels);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What are parameters?

A

The information needed for a function to do its job. (inside the method call)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is a compile time error?

A

A syntax error: the program won’t run until you fix it

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is an execution time error?

A

The program will compile, but will stop running when it comes across the error

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is a logic error?

A

The program will run, but not as you expect/want it to

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What happens in a static program?

A

Begins with the first line in the file, and runs each line at a time

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What happens in an active program?

A

The program starts, and keeps running. Global constants and variables are declared once at the top, the setup() function runs once, and the draw() function runs over and over until you stop it

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is the default frame rate?

A

60 frames per second

17
Q

What is a block?

A

Grouped sets of commands. Any code inside a pair of { } forms a block.

18
Q

What are the predefined variables in processing for the position of the mouse at the start of the current frame?

A

mouseX and mouseY

19
Q

What are the predefined variables in processing for the position of the mouse at the end of the previous frame?

A

pmouseX and pmouseY

20
Q

What is the command to find the minimum of two numbers?

A

min(int, int); or min(float, float);

21
Q

What is the command to find the maximum of two numbers?

A

max(int, int); or max(float, float);

22
Q

What is the command to find the square root of a number?

A

sqrt(float);

23
Q

What is the command to find the square of a number?

A

sq(float);

24
Q

What is the command to find the absolute value of a number?

A

abs(float); or abs(int);

25
Q

What is the command to find a random value between two numbers?

A

random(float, float); or random(float);

26
Q

What set of numbers could be the result of
(int)random(1, 3);

A

{1, 2}

27
Q

What should you write to keep a value x within the bounds of the canvas?

A

min(width, max(0, x));

28
Q

What is the result of
x = 5;
println(x++);
println(++x);

A

5
7

29
Q

What is the formula for scaling problems?

A

destinationMin + (destinationMax - destinationMin)*(current-sourceMin)/(sourceMax - sourceMin);

30
Q

What is the command to get an angle in processing?

A

atan2(opp, adj);

31
Q

What should you write to get the distance between two points?

A

sqrt(sq(x1-x2) + sq(y1-y2));

32
Q

Write code to calculate the x and y values of a point moving clockwise in a circle

A

float x = CENTRE_X + RADIUScos(angle);
float y = CENTRE_Y + RADIUS
sin(angle);