Name: scalajs-createjs
Owner: scalawarrior
Description: CreateJS facade types for Scala.js
Created: 2015-06-12 11:31:04.0
Updated: 2018-02-03 14:18:49.0
Pushed: 2018-01-13 18:02:06.0
Homepage: null
Size: 1066
Language: Scala
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
Static types for the CreateJS API for Scala.js programs.
Add the following to your sbt build definition:
lvers += "amateras-repo" at "http://amateras.sourceforge.jp/mvn/"
aryDependencies += "com.scalawarrior" %%% "scalajs-createjs" % "0.0.2"
and add following import statement to the head of your Scala.js program:
rt com.scalawarrior.scalajs.createjs._
then enjoy CreateJS in Scala.js!
eclare the stage
stage = new Stage("demoCanvas")
w = stage.canvas.width
h = stage.canvas.height
efine images
manifest = js.Array(
.Dictionary("src" -> "background.png", "id" -> "background"),
.Dictionary("src" -> "knight.png", "id" -> "knight")
re-load images
loader = new LoadQueue(false)
er.addEventListener("complete", (e: Object) => {
Assemble shapes on the stage
l background = new Shape()
ckground.graphics.beginBitmapFill(loader.getResult("background")).drawRect(0, 0, w, h)
r spriteSheet = new SpriteSheet(js.Dictionary(
"framerate" -> 30,
"images" -> js.Array(loader.getResult("knight")),
"frames" -> js.Dictionary("regX" -> -70, "height" -> 88, "count" -> 64, "regY" -> -60, "width" -> 74)
l knight = new Sprite(spriteSheet);
age.addChild(background, knight);
age.update();
ue
er.loadManifest(manifest)