Last year saw the introduction of a new open source programming API developed specifically for use in the presentation of audio, image and other media files on the web, giving artists, designers and the like a whole new arena in which to strut their creative stuff. It can also be useful for learning fundamental concepts of programming in general.
Processing Media with Processing (Beta) - Java heritage (Page 3 of 4 )
As it is derived from Java, the structure of Processing applications must meet certain specifications. The semi-colon for example is used as a statement terminator, the comma is used to separate values and array value access is denoted within square brackets. The functions that make up your application should be defined using the void functionname() { } syntax. There are certain functions that are required in any Processing application such as the setup() function that is called when the program is started and defines the initial environment, such as the size of the window and the background color. Or the draw() function that is called directly after setup() and continually executes while the program runs.
As you would expect from a language designed in part for working with images and multimedia, it has native support for rendering both two and three dimensional shapes. You can also load and display images and work with pixels and manipulate shapes and images with the built in transformation methods that allow rotation and scaling, among other things.
Additionally you get to control effects such as the lighting and the camera angle. This allows the use of ambient lighting or spotlight effects for example and gives you a method of creating perspective or panning effects. Methods are provided that easily let you set the background color of the window and the fill and stroke colour of shapes. You can also control the color by setting RGB values and the hue and saturation.
There are a large number of data types to work with including everything you would expect such as Boolean, char, int and float, arrays, objects and strings as well as a large number of conversion data types and the standard set of string and array functions. There is also a lot of math support built in with the standard set of operators in use as well as methods for standard calculation, trigonometry and random events. PI, HALF and TWO are defined constants for working with circular shapes and objects.
While a picture may be worth 1000 words, words are still important in the expression of ideas, and with processing you can use fonts installed on your computer or create fonts to add to a projects data directory so that it can be easily exported and used. This is useful for working with non-standard fonts that may not be installed on the end user's system. You also have some control over the formatting of text used in your application, with methods to set the alignment, mode and size of text.