Variables are at the center of dynamic movies. They provide an interface to supply dynamic content into the dynamic movie. Dynamic content can be text, files, or URLs to fetch content from other servers.
The following ImageProvider
will use the text supplied via the parameter mytext
and display it a 40 pixel red default font.
var text = new sdl.ImageProvider({ type: "textsimple", color: {red: 255, alpha: 255}, fontsize: 40, text: { type: "map" key: "mytext" defaultvalue: "Some text" } })
The text
property of the ImageProvider
is of type StringVariable
. A StringVariable
can get its content from various sources. The following table lists the most common sources:
Type | Description |
---|---|
constant | Constant. Use value directly |
map | Fetch value via parameter named key |
http | Fetch value via HTTP from URL specified in source |
structureddata | Get value from a structured data source, e.g. JSON object |
datasource | Get value from a datasource (CSV, Excel, etc.) |
The following ImageProvider
will render an image supplied from a HTTP server.
The URL of the image is constructed using a fixed server URL and a user-supplied parameter. The token $variable
is substituted with the value of the StringVariable:
var image = new sdl.ImageProvider({ type: "http", source: { path: "http://my.server.com/images/$variable.jpg" variable: { type: "map" key: "username" defaultvalue: "unknown-user" } } })
The source
property of the ImageProvider
is a FileLocation
. To learn more about FileLocations
, see the the SDL Reference.
Terms of Use | © 2017, Impossible Software, or its affiliates.