Drawing 3D primitives

Making my way through the Drawing 3D primitives recipe from the Processing 2 Creative programming cookbook source code on GitHub. In this recipe I learned how:

  • the box function can be used with one or three parameters to set different values for depth, width and height of the box.
  • the sphereDetail function can be used to define a resolution higher or lower than the default sphere function
  • to create a variable (angleY) that can rotate each 3D object around its Y-axis.
  • the frameCount system variable can be used to rotate each 3D object by one degree per frame as the value of the variable is increased by one in each frame. This value is converted to radians, cause that’s the unit of measurement Processing uses. Might be easier to work with radians rather than convert to degrees all of the time. Maybe.

Screen-Shot-2014-03-31-at-8.28.44-PM

Understanding 3D space

Making my way through the Understanding 3D space recipe from the Processing 2 Creative programming cookbook source code on GitHub.

In this recipe I learned how set a variable for depth and zSpeed and also how to change the variable inside the draw function for animation. I also learned that if you want to use the rect or ellipse functions draw shapes in a 3D environment you need to use the translate function to change the coordinate system. Normally, the translate function uses x, y and z coordinates in a 3D environment, but in this Sketch the z coordinate has been replaced by the depth variable. Using the depth variable for the z coordinate with the for loop and the if test animates the four coloured squares. Also, the squares are always drawn at 0, 0. It’s just the point of origin in z-space being moved.

Screen-Shot-2014-03-21-at-9.28.51-PM

Screen-Shot-2014-03-21-at-9.28.35-PM

Talky Tina’s swipe card has arrived

Just arrived at work to find that HR had delivered Talky Tina’s swipe access by internal mail. That’s great news. That means Talky Tina is now officially employed as the health and safety officer at the DS106 Workplace and has open-access to all premises. Let’s look forward to an incident-free seven weeks.

The other story at Skidmore

Stories can be found in the most unexpected places, even in the chat window of a live video stream. This Storify aggregates my experience of watching Alan Levine’s Making/Telling stories that matter keynote at Skidmore College via the Skidmore College Livestream.

Offscreen drawing

Making my way through the Offscreen drawing recipe from the Processing 2 Creative programming cookbook source code on GitHub. In this recipe I learned how to:

  • declare a PGraphics object and then initialise it with the createGraphics function inside the setup function.
  • use the createGraphics function to create a new transparent image to be drawn on and the beginDraw and endDraw functions to start and stop drawing on the image. For this Sketch, strokes and lines are drawn on the PGraphics object. To do this, they needed to be prefixed with a variable (pg).

ch02_r09_002
The display window is cleared every time the mouse is pressed. The if test inside the mousePressed function specifies there’s a 50 percent chance the new background will be black or white.
ch02_r09_001

ch02_r09_005

Manipulating SVG files

Making my way through the Manipulating SVG files recipe from the Processing 2 Creative programming cookbook source code on GitHub. In this recipe I learned:

  • more about using the shape function to draw shapes in the display window
  • how to declare the PShape object and create custom variables (snowFlake, small1 to small6 and big1) and the disableStyle, enableStyle, fill and stroke functions to manipulate discrete parts of the SVG loaded into the Sketch.
  • how to use getChild to get text (small1 to small6) from the id attribute of each shape in the SVG file.

Screen-Shot-2014-03-16-at-5.19.24-PM