PShape::scale() \ Language (API) \ Processing 1.0
Language (A-Z) \
Libraries \
Tools \
Environment
Reference for Processing version 1.2. If you have a previous version, use the reference included with your software. If you see any errors or have suggestions, please let us know.
If you prefer a more technical reference, visit the Processing Javadoc.
Class
PShape
Name
scale()
Examples
PShape s;
void setup() {
s = loadShape("bot.svg");
smooth();
}
void draw() {
background(204);
shape(s);
}
void mousePressed() {
// Shrink the shape 90% each time the mouse is pressed
s.scale(0.9);
}
Description
Increases or decreases the size of a shape by expanding and contracting vertices. Shapes always scale from the relative origin of their bounding box. Scale values are specified as decimal percentages. For example, the method call scale(2.0) increases the dimension of a shape by 200%. Subsequent calls to the method multiply the effect. For example, calling scale(2.0) and then scale(1.5) is the same as scale(3.0). This transformation is applied directly to the shape, it's not refreshed each time draw() is run.
Using this fuction with the z parameter requires passing P3D or OPENGL into the size() parameter.
Syntax
sh.scale(size);
sh.scale(x, y);
sh.scale(x, y, z);
Parameters
sh
PShape: any variable of type PShape
size
float: percentage to scale the object
x
float: percentage to scale the object in the x-axis
y
float: percentage to scale the object in the y-axis
z
float: percentage to scale the object in the z-axis
Returns
None
Usage
Web & Application
Updated on June 14, 2010 12:05:29pm EDT
Processing was initiated by Ben Fry and Casey Reas. It is developed by a small team of volunteers.
© Info \
Site hosted by Media Temple!
Wyszukiwarka
Podobne podstrony:
PShape scalescalearm scale q7?arm mat scale q31?Rheology of Nano Scale Aluminum SuspensionsHalting viruses in scale free networksarm scale q31?PShape enableStylefunction swfdisplayitem scalePShapePShape isVisiblearm scale q15? sourcePShape rotateYfunction pdf scalewięcej podobnych podstron