Book Image

Processing 2: Creative Coding Hotshot

By : Nikolaus Gradwohl
Book Image

Processing 2: Creative Coding Hotshot

By: Nikolaus Gradwohl

Overview of this book

Processing makes it convenient for developers, artists, and designers to create their own projects easily and efficiently. Processing offers you a platform for expressing your ideas and engaging audiences in new ways. This book teaches you everything you need to know to explore new frontiers in animation and interactivity with the help of Processing."Processing 2: Creative Coding Hotshot' will present you with nine exciting projects that will take you beyond the basics and show you how you can make your programs see, hear, and even feel! With these projects, you will also learn how to build your own hardware controllers and integrate devices such as a Kinect senor board in your Processing sketches.Processing is an exciting programming environment for programmers and visual artists alike that makes it easier to create interactive programs.Through nine complete projects, "Processing 2: Creative Coding Hotshot' will help you explore the exciting possibilities that this open source language provides. The topics we will cover range from creating robot - actors performing Shakespeare's "Romeo and Juliet", to generating objects for 3D printing, and you will learn how to run your processing sketches nearly anywhere from a desktop computer to a browser or a mobile device.
Table of Contents (16 chapters)
Processing 2: Creative Coding Hotshot
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Drawing your face


The first task of our current mission is to draw a face using Processing. We will use drawing primitives such as ellipses and curves and learn how to change the fill and stroke styles. We want to make three parameters changeable in the next task, so we define variables for these parameters and use their values for drawing our face.

Engage Thrusters

Let's draw a face:

  1. Open a new sketch and add a setup() and a draw() method:

    void setup() {
    }
    
    void draw() {
    }
  2. In the setup() method, we set the window size to 300 x 300 pixels and turn on line smoothing. We also change the color mode to HSB (which stands for Hue, Saturation, and Brightness) instead of RGB to make changing the color of the face easier.

    void setup() {
      size(300,300);
      smooth();
      colorMode(HSB);
    }
  3. The first thing we are going to draw is a colored circle. To make the color changeable, we will add an integer variable named col to our sketch, just abovethe setup() method.

    int col = 150;
    
    void setup() {
  4. Our control variable...