Click
package basics
import kotlin.browser.document
import kotlin.js.json
fun main(args: Array<String>) {
val app = PIXI.Application(800, 600, json(
"backgroundColor" to 0x1099bb
))
document.body!!.appendChild(app.view)
PIXI.settings.SCALE_MODE = PIXI.SCALE_MODES.NEAREST
val sprite = PIXI.Sprite.fromImage("../assets/basics/bunny.png")
sprite.anchor.set(0.5)
sprite.x = app.screen.width.toDouble() / 2
sprite.y = app.screen.height.toDouble() / 2
sprite.interactive = true
sprite.buttonMode = true
fun onClick() {
sprite.scale.x = sprite.scale.x.toDouble() * 1.25
sprite.scale.y = sprite.scale.y.toDouble() * 1.25
}
sprite.on("pointerdown", { onClick() })
app.stage.addChild(sprite)
}