Text

Now it’s time to add some text to this example. Of course, it’s possible to embed text into the background image files, but that requires using image editing tools and makes changing the text cumbersome. Lightwing features a better approach – powerful commands for rendering text and tickers directly from scripts, web RSS feeds or CSV files, with automatic animation and drop-shadow effects.

The shadow command enables an optional, automatic drop-shadow effect for the font named OpenSansBold_100. This command can be repeated for any number of fonts and remains in effect for the entire script. Since this command is global in nature, it should appear before the first page. The offset option defines the size of the drop-shadow in pixel units. Positive values shift the drop-shadow to the right and down, whereas negative values would shift it to the left and up.

The text command has a lot of options so only the most essential ones are shown here. The first parameter defines the file name and size of the font. An extension of .pvr is assumed and the underscore symbol in the font file names are required. 40 fonts are provided with Lightwing in sizes ranging from 10 to 200 pixel heights in increments of 10.

The time option is similar to the time option of the page command, except that the first value defines when the text first begins to appear on the page. The second value is the time duration of the text on the page.

The fade option defines the time spent animating the text when it appears and disappears on the page. The default animation for text is to fade, but other options can be added to zoom, scroll, slide, spin, bounce and delay, in almost any combination, as shown in the next example.

The position option defines where the text is placed on the page. These coordinates range from 0 to 100 (for horizontal, vertical and depth, regardless of the display resolution) with the origin point at the top left of the display. The third value (depth) is usually optional and not shown here.

The align option defines if text is centered from the defined position, or aligned for Left, Right, Top or Bottom justification. This is usually either TopLeft, TopCenter or CenterCenter.

Finally, the type option defines the actual text string to draw on the page. Use double quotes to specify a constant text string, or a variable name such as DateLong (without the double quotes) to draw variable text, such as today’s date, time or text from RSS or CSV sources. Also refer to the online Scripting Guide for more details about these commands.

// Scripting Tutorial - Text

version: 1.0
shadow: OpenSansBold_100    offset: 5

page: Mercury    time: 1, 3    image: PlanetMercuryBackground.pvr
    text: OpenSansBold_100    time: 1, 2    fade: 1, 1    position: 50, 50    align: CenterCenter        type: "Hello Mercury!"

page: Venus        time: 1, 3    image: PlanetVenusBackground.pvr
    text: OpenSansBold_100    time: 1, 2    fade: 1, 1    position: 50, 50    align: CenterCenter        type: "Hello Venus!"

page: Earth        time: 1, 3    image: PlanetEarthBackground.pvr
    text: OpenSansBold_100    time: 1, 2    fade: 1, 1    position: 50, 50    align: CenterCenter        type: "Hello Earth!"

page: Mars        time: 1, 3    image: PlanetMarsBackground.pvr
    text: OpenSansBold_100    time: 1, 2    fade: 1, 1    position: 50, 50    align: CenterCenter        type: "Hello Mars!"

page: Jupiter    time: 1, 3    image: PlanetJupiterBackground.pvr
    text: OpenSansBold_100    time: 1, 2    fade: 1, 1    position: 50, 50    align: CenterCenter        type: "Hello Jupiter!"

page: Saturn    time: 1, 3    image: PlanetSaturnBackground.pvr
    text: OpenSansBold_100    time: 1, 2    fade: 1, 1    position: 50, 50    align: CenterCenter        type: "Hello Saturn!"

page: Uranus    time: 1, 3    image: PlanetUranusBackground.pvr
    text: OpenSansBold_100    time: 1, 2    fade: 1, 1    position: 50, 50    align: CenterCenter        type: "Hello Uranus!"

page: Neptune    time: 1, 3    image: PlanetNeptuneBackground.pvr
    text: OpenSansBold_100    time: 1, 2    fade: 1, 1    position: 50, 50    align: CenterCenter        type: "Hello Neptune!"

page: Pluto        time: 1, 3    image: PlanetPlutoCharonBackground.pvr
    text: OpenSansBold_100    time: 1, 2    fade: 1, 1    position: 50, 50    align: CenterCenter        type: "Today is:"
    text: OpenSansBold_100    time: 1, 2    fade: 1, 1    position: 50, 70    align: CenterCenter        type: DateLong
    jump: Mercury

 

 

<   Page Transitions                                             Introduction                                            Text Animations   >