Name | loadShape() |
||
---|---|---|---|
Examples | PShape s; s = loadShape("bot.svg"); smooth(); shape(s, 10, 10, 80, 80); // Loading a shape when using setup() and draw() PShape s; void setup() { s = loadShape("bot.svg"); smooth(); noLoop(); } void draw() { shape(s, 10, 10, 80, 80); } |
||
Description | Loads vector shapes into a variable of type PShape. Currently, only SVG files may be loaded. To load correctly, the file must be located in the data directory of the current sketch. In most cases, loadShape() should be used inside setup() because loading shapes inside draw() will reduce the speed of a sketch. If a shape is not loaded successfully, the null value is returned and an error message will be printed to the console. The error message does not halt the program, however the null value may cause a NullPointerException if your code does not check whether the value returned from loadShape() is null. |
||
Syntax | loadShape(filename) |
||
Parameters |
|
||
Returns | PShape or null | ||
Usage | Web & Application | ||
Related | PShape shape() shapeMode() |