Back

CreateBackground

Hello World
Content:
- Methods

Creates a background.

bck = gfx.CreateBackground( file, options ) → app object: Background

Example - Scroll

cfg.Game;

function OnLoad()
{
    sky = gfx.CreateBackground( "/Sys/Img/Sky.jpg", "stretch" );
}

function OnReady()
{
    gfx.AddBackground( sky );
    gfx.Play();
}

function OnAnimate(t,dt)
{
    sky.Scroll(-dt/1000, 0);
}
    Copy     Copy All       Run      

Methods

The following methods are available on the Background object:

Scroll( x, y )
number
string
string: comma “,” separated: “stretch”
bck.Scroll
Scrolls the background by a given value