Loading

Pscale


processing
Since v1.0.0
Available on all platforms
See also

Increases or decreases the size of a shape by expanding and contracting vertices. Objects always scale from their relative origin to the coordinate system. Scale values are specified as decimal percentages. For example, the function call 2.0 Pscale increases the dimension of a shape by 200%.

Transformations apply to everything that happens after and subsequent calls to the function multiply the effect. For example, calling 2.0 Pscale and then 1.5 Pscale is the same as 3.0 Pscale. This function can be further controlled with PpushMatrix and PpopMatrix.

Link to original Processing doc

Signature

Examples

// @preview image <% //draw smiley macro 'centerY' STORE 'centerX' STORE 'CENTER' PellipseMode $centerX $centerY 30 30 Pellipse 0 Pfill $centerX 7 - $centerY 5 - 5 8 Pellipse $centerX 7 + $centerY 5 - 5 8 Pellipse PnoFill $centerX $centerY 22 22 0.5 1.5 Parc %> 'drawsmiley' STORE 200 200 '2D3' PGraphics 255 Pbackground 0 0 @drawsmiley //top left corner 40 0 @drawsmiley 100 100 Ptranslate 1.5 Pscale //+50% size 0 0 @drawsmiley 40 0 @drawsmiley 0 30 Ptranslate //try to invert this line with the next one pi 4 / Protate 1 1.5 / Pscale //restore original size 1 1.5 Pscale //scale up Y only 0 0 @drawsmiley 40 0 @drawsmiley PresetMatrix 200 200 @drawsmiley //bottom right corner Pencode