Label Class
Extends GameObject
Module: Font
Label class creates single line text located in 3d space
Constructor
Label
(
-
scene
-
string
-
font
-
size
Parameters:
-
scene
Scenescene
-
string
Stringstring for single line text
-
font
Stringfont to use( Rememeber about loading fonts to document with @font-face )
-
size
Integerfont size
Example:
world = new Scene()
score = new Label(world, "0","Helvetica", 240)
Item Index
Methods
Methods
addAnimation
(
-
animation
Adds animation to GameObject
Parameters:
-
animation
Animationto add to animations.
loadFont
(
static
-
fontName
-
url
Javascript method of font loading
Parameters:
-
fontName
Stringfont name to be used later
-
url
Stringurl address of font
Example:
world = new Scene()
font = Label.loadFont("medHelvetica.ttf")
score = new Label(world, "0", 240)
move
(
-
x
-
y
-
z
-
r
Move the object
Parameters:
-
x
FloatMove in x axis -
y
FloatMove in y axis -
z
FloatMove in z axis -
r
BooleanMove 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
()
Removes GameObject
rotate
(
-
x
-
y
-
z
-
r
Rotate the object (degrees)
Parameters:
-
x
FloatRotate in x axis -
y
FloatRotate in y axis -
z
FloatRotate in z axis -
r
BooleanRotate 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
Scale the object
Parameters:
-
x
FloatScale in x axis -
y
FloatScale in y axis -
z
FloatScale in z axis -
r
BooleanScale 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
Scale the object uniform in all axes
Parameters:
-
f
FloatScale factor -
r
BooleanScale relative to actual scale
setModelView
()
Replace modelView in RenderNode
Properties
aex
Aex
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
Light system connected to this game object
Example:
world = new Scene()
game = new GameObject(world,{...})
game.light = new Light({})
material
Material
Material connected to this game object
Example:
world = new Scene()
game = new GameObject(world,{...})
game.material = new Material({})
mesh
Mesh
Mesh connected to this game object
Example:
world = new Scene()
game = new GameObject(world,{...})
game.mesh = Mesh.sphere()
position
Vector
Position of object
Example:
world = new Scene()
game = new GameObject(world,{})
game.position = new Vector(1.0,2.0,3.0)
rotation
Vector
Rotation of object
Example:
world = new Scene()
game = new GameObject(world,{})
game.rotation = new Vector(0.0,90.0,0.0)
rotX
Float
x Rotation of object
Example:
world = new Scene()
game = new GameObject(world,{})
game.rotX = 20.0
rotY
Float
y Rotation of object
Example:
world = new Scene()
game = new GameObject(world,{})
game.rotY = 20.0
rotZ
Float
z Rotation of object
Example:
world = new Scene()
game = new GameObject(world,{})
game.rotZ = 20.0
scaleX
Float
x scale of object
Example:
world = new Scene()
game = new GameObject(world,{})
game.scaleX = 2.0
scaleY
Float
y scale of object
Example:
world = new Scene()
game = new GameObject(world,{})
game.scaleY = 2.0
scaleZ
Float
z scale of object
Example:
world = new Scene()
game = new GameObject(world,{})
game.scaleZ = 2.0
shader
Shader
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
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
x Position of object
Example:
world = new Scene()
game = new GameObject(world,{})
game.x = 20.0
y
Float
y Position of object
Example:
world = new Scene()
game = new GameObject(world,{})
game.y = 20.0
z
Float
z Position of object
Example:
world = new Scene()
game = new GameObject(world,{})
game.z = 20.0