SvgsModule
The
SvgsModule
module enables working with SVGs.//==============================================================================
// The following example demonstrates how to bind an SVG image to a vector
// object.
//
// Project setup:
// - Insert a vector object
//==============================================================================
// Load in the required modules
const Scene = require('Scene');
const Svgs = require('Svgs');
// Locate the SVG file in the Assets
const mySvg = Svgs.get('mySvg');
// Locate the vector object in the Scene
const vectorObject = Scene.root.find('vectorObject0');
// Bind the Svg to the vector object
vectorObject.svg = mySvg;
This module exposes no properties.
Method | Description |
findFirst | findFirst(name: string): Promise<Svg> Returns a promise that is resolved with the svg of a requested name or null if none was found. See Also: Svgs.findUsingPattern , Svgs.getAll . |
findUsingPattern | findUsingPattern(namePattern: string): Promise<Array<Svg>> findUsingPattern(namePattern: string, config: {limit: number}): Promise<Array<Svg>> Returns a promise that is resolved with the all of the svgs matching the name pattern or empty array if none was found. Pattern format: * matches any characters sequence. \ can be used to include in pattern any of the control characters (including '\' itself)Examples: findUsingPattern("*") will retrive all of the svgs. findUsingPattern("*A") will retrieve all of the svgs suffixed with 'A'. findUsingPattern("A*") will retrieve all of the svgs prefixed with 'A'. findUsingPattern("*A*", {limit: 10}) will retrieve at most 10 of the svgs containing 'A',limit parameter describes if findUsingPattern should finish the search if it finds specified number of results (default is no limit). Non-positive values for limit are treated as unlimited.See Also: Svgs.getAll , Svgs.findFirst . |
get | get(svgName: string): Svg Returns a svg object identified by the svgName argument.Throws an exception if there is no such identifier in the project. |
getAll | getAll(): Promise<Array<Svg>> Returns a promise that is resolved with all of the svgs. See Also: Svgs.findUsingPattern , Svgs.findFirst . |
Class | Description |
The Svg class describes an SVG in an effect. |
Last modified 3yr ago