enchant.js | S example
Mithat Konar
March 23, 2014
Labels
Download starter project
The basics
Color
Style
- Use CSS font syntax with
the Label's
font
property.
- The order of the properties is important.
- If you don't want one, leave it out.
The opacity
property
- All visual entities in enchant.js have an
opacity
property.
- When the
opacity
is 1 (the default), the entity is completely
opaque.
- When the
opacity
is 0, the entity is completely transparent
(i.e., invisible).
- The example below uses the
opacity
property to fade a lable
out.
- And again with some scrolling action.
The age
property
- All visual entities in enchant.js have an
age
property.
- The
age
starts at zero and counts up every frame.
- The example below uses the
age
property to make a label disappear
after it has been on screen for a certain time.
The textAlign
property
- You can use a Label's
textAlign
property to set the horizontal
alignment.
- Use CSS text-align syntax.
- This is most useful with multiline text.