User Tools

Site Tools


part_9-_a_few_functions_for_creating_and_manipulating_basic_shapes

Processing Tutorial

Part 9: A Few Functions for Creating and Manipulating Basic Shapes

arc(x, y, width, height, start, stop)

-Draws an arc that starts at (x,y), has given height and width, starts at angle “start” and ends at angle “end”.

background(Gray)

-The background will be of the given shade of gray. Same as background(Gray, Gray, Gray)

background(R, G, B)

-The background will be of the given color.

color(r,g,b)

-Constructor for a color object, with given red, green and blue (RGB) values.

ellipse(x, y, width, height)

-Draws an ellipse centered at (x,y) with given height and width

fill(Gray)

-Everything after this command will be filled with the given shade of gray (unless noFill() is called). Same as fill(Gray, Gray, Gray).

fill(R, G, B)

-Everything after this command will be filled with the given color (unless noFill() is called).

line(x1, y1, x2, y2)

-Draws a line with endpoints (x1,y1) and (x2,y2)

noFill()

-Everything after this command will have no filling (transparent). This does not affect the borders of the object.

noStroke()

-Everything after this command will have no borders.

point(x,y)

-Draws a point at the given coordinates.

quad(x1, y1, x2, y2, x3, y3, x4, y4)

-Draws a quadrilateral with the given vertices.

rect(x, y, width, height)

-Draws a rectangle with the upper-left corner at (x,y), with given height and width. (See rectMode(MODE) for more details).

rectMode(MODE)

-Every rectangle after this command is drawn using the given mode, which can have one of four possible values:

  • CORNER- the first two parameters of rect() are the upper left corner, the second two are the width and height.
  • CORNERS - the first two parameters are the upper left corner, the second two are the bottom right corner.
  • CENTER - the first two parameters are the center of the rectangle, the second two are the width and height.
  • RADIUS - the first two parameters are the center of the rectangle, the second two are half the width and half the height.

rotate(angle)

-Rotate everything after this command by “angle” (clockwise).

stroke(Gray)

-Everything after this command will have borders with the given shade of gray (unless noFill() is called). Same as stroke(Gray, Gray, Gray).

stroke(R, G, B)

-Everything after this command will have borders with the given color (unless noFill() is called).

strokeWeight(n)

-All points, lines and shape borders drawn after this command will be n pixels wide.

translate(x, y)

-Shifts everything after this command away from the upper-left corner by x and y.

triangle(x1, y1, x2, y2, x3, y3)

-Draws a triangle with vertices (x1,y1), (x2,y2) and (x3,y3)


Next: Part 10- Images

Last: Part 8- Editing the pixels[] array

part_9-_a_few_functions_for_creating_and_manipulating_basic_shapes.txt · Last modified: 2007/08/30 13:53 (external edit)