Docs for Version: 1.0a
Show:
Extends GameObject
Module: Font

Label class creates single line text located in 3d space

Constructor

Label

(
  • scene
  • string
  • font
  • size
)

Parameters:

  • scene Scene

    scene

  • string String

    string for single line text

  • font String

    font to use( Rememeber about loading fonts to document with @font-face )

  • size Integer

    font size

Example:

world = new Scene()
                                score = new Label(world, "0","Helvetica", 240)

Methods

addAnimation

(
  • animation
)

Inherited from GameObject:

Adds animation to GameObject

Parameters:

loadFont

(
  • fontName
  • url
)
static

Javascript method of font loading

Parameters:

  • fontName String

    font name to be used later

  • url String

    url address of font

Example:

world = new Scene()
                                            font = Label.loadFont("medHelvetica.ttf")
                                            score = new Label(world, "0", 240)

move

(
  • x
  • y
  • z
  • r
)

Inherited from GameObject:

Move the object

Parameters:

  • x Float
    Move in x axis
  • y Float
    Move in y axis
  • z Float
    Move in z axis
  • r Boolean
    Move relative to actual position

Example:

world = new Scene()
                                            game = new GameObject(world,{})
                                            //absolute move
                                            game.move(0,1,0)
                                            //relative move
                                            game.move(0,1,0,1)

remove

()

Inherited from GameObject:

Removes GameObject

rotate

(
  • x
  • y
  • z
  • r
)

Inherited from GameObject:

Rotate the object (degrees)

Parameters:

  • x Float
    Rotate in x axis
  • y Float
    Rotate in y axis
  • z Float
    Rotate in z axis
  • r Boolean
    Rotate relative to actual rotation

Example:

world = new Scene()
                                            game = new GameObject(world,{})
                                            //absolute rotate
                                            game.rotate(0,1,0)
                                            //relative rotate
                                            game.rotate(0,1,0,1)

scale

(
  • x
  • y
  • z
  • r
)

Inherited from GameObject:

Scale the object

Parameters:

  • x Float
    Scale in x axis
  • y Float
    Scale in y axis
  • z Float
    Scale in z axis
  • r Boolean
    Scale relative to actual scale

Example:

world = new Scene()
                                            game = new GameObject(world,{})
                                            //absolute scale
                                            game.scale(1.2,1.2,1.3)
                                            //relative scale
                                            game.scale(0,1,0,1)

scaleUniform

(
  • f
  • r
)

Inherited from GameObject:

Scale the object uniform in all axes

Parameters:

  • f Float
    Scale factor
  • r Boolean
    Scale relative to actual scale

setModelView

()

Inherited from GameObject:

Replace modelView in RenderNode

Properties

aex

Aex

Inherited from GameObject:

Aex connected to this game object

Example:

world = new Scene()
                                            game = new GameObject(world,{...})
                                            game.aex = new Aex()

color

String

Example:

world = new Scene()
                                            score = new Label(world, "0","monospace", 240)
                                            //change text color to red
                                            score.color = "rgb(255,0,0)"

font

String

Example:

world = new Scene()
                                            score = new Label(world, "0","monospace", 240)
                                            //change text string
                                            score.font = "Helvetica"

light

Light

Inherited from GameObject:

Light system connected to this game object

Example:

world = new Scene()
                                            game = new GameObject(world,{...})
                                            game.light = new Light({})

material

Material

Inherited from GameObject:

Material connected to this game object

Example:

world = new Scene()
                                            game = new GameObject(world,{...})
                                            game.material = new Material({})

mesh

Mesh

Inherited from GameObject:

Mesh connected to this game object

Example:

world = new Scene()
                                            game = new GameObject(world,{...})
                                            game.mesh = Mesh.sphere()

position

Vector

Inherited from GameObject:

Position of object

Example:

world = new Scene()
                                            game = new GameObject(world,{})
                                            game.position = new Vector(1.0,2.0,3.0)

rotation

Vector

Inherited from GameObject:

Rotation of object

Example:

world = new Scene()
                                            game = new GameObject(world,{})
                                            game.rotation = new Vector(0.0,90.0,0.0)

rotX

Float

Inherited from GameObject:

x Rotation of object

Example:

world = new Scene()
                                            game = new GameObject(world,{})
                                            game.rotX = 20.0

rotY

Float

Inherited from GameObject:

y Rotation of object

Example:

world = new Scene()
                                            game = new GameObject(world,{})
                                            game.rotY = 20.0

rotZ

Float

Inherited from GameObject:

z Rotation of object

Example:

world = new Scene()
                                            game = new GameObject(world,{})
                                            game.rotZ = 20.0

scaleX

Float

Inherited from GameObject:

x scale of object

Example:

world = new Scene()
                                            game = new GameObject(world,{})
                                            game.scaleX = 2.0

scaleY

Float

Inherited from GameObject:

y scale of object

Example:

world = new Scene()
                                            game = new GameObject(world,{})
                                            game.scaleY = 2.0

scaleZ

Float

Inherited from GameObject:

z scale of object

Example:

world = new Scene()
                                            game = new GameObject(world,{})
                                            game.scaleZ = 2.0

shader

Shader

Inherited from GameObject:

Shader connected to this game object

Example:

world = new Scene()
                                            game = new GameObject(world,{...})
                                            game.shader = new Shader({})

size

Integer

Example:

world = new Scene()
                                            score = new Label(world, "0","monospace", 240)
                                            //change font size
                                            score.size = 42

text

String

Example:

world = new Scene()
                                            score = new Label(world, "0","monospace", 240)
                                            //change text string
                                            score.text = "Hello worlds!"

uniforms

Dict

Inherited from GameObject:

Uniforms of object

Example:

world = new Scene()
                                            game = new GameObject(world,{...})
                                            game.uniforms["tiling"] = [1.0,10.0]
                                            

You can also set uniforms of the material easily

world = new Scene()
                                            game = new GameObject(world,{...})
                                            game.uniforms["color"] = [1.0,0.0,0.0]
                                            game.uniforms["alpha"] = 0.2

x

Float

Inherited from GameObject:

x Position of object

Example:

world = new Scene()
                                            game = new GameObject(world,{})
                                            game.x = 20.0

y

Float

Inherited from GameObject:

y Position of object

Example:

world = new Scene()
                                            game = new GameObject(world,{})
                                            game.y = 20.0

z

Float

Inherited from GameObject:

z Position of object

Example:

world = new Scene()
                                            game = new GameObject(world,{})
                                            game.z = 20.0