Type + Code: Processing For Designers

Page 31

Processing for Designers page >R< odd page {7}

4.0

>Basic Functions<

alpha( ) Transparency

We use transparency to create layers of hierarchy and even motion. By manipulating the alpha value, we are able to control the percentage of transparent parts that visually interact with each other. Using the alpha() function, we can create more depth and hierarchy in our work. First, the color() function is called to create two color groups a = color (200,10,20,38) and color b = color (200,10,20,58). Within the color() function the first three values define RGB, while the fourth is the percentage of transparency desired. In this case, color a has 38 and color b, 58. The fill() function then determines color for both a and b. Finally, the alpha() function is written for a alpha(a) and b alpha(b).

TYPE TYPE

PFont myFont;

//color b grouping is created

void setup() {

//inside color(r:200,g:10,b:20, transparency:58)

size(200, 200); background(255,255,255);

color b = color (200,10,20,58);

myFont = createFont("Univers",

//using fill for color b

32);

fill(b);

textFont(myFont);

//using alpha for color b

//color a grouping is created

alpha(b);

//inside color(r:200,g:10,b:20,

//position x:-90 and y:0

transparency:38)

translate(-90,0);

color a = color (200,10,20,38);

text("TYPE");

//using fill for color a

}

fill(a); //using alpha for color a alpha(a); //position x:55 and y:90 translate(55,90); text("TYPE");

http://processing.org/reference/alpha_.html

In this example, the lighter value is coded first with a transparency value of 38. The second has a deeper transparency value of 58 and is then translated -90 from its original position.


Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.