iwmlib/pixi/application.html

34 lines
819 B
HTML
Raw Normal View History

2019-03-21 09:57:27 +01:00
<!doctype html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>PIXI.Application Doctest</title>
<script src="../3rdparty/pixi/pixi.js"></script>
</head>
<body>
<h1>PIXI.Application with nothing!</h1>
<script>
const app = new PIXI.Application({
width: 450,
height: 150
})
// Add the view to the DOM
document.body.appendChild(app.view)
// ex, add display objects
const sprite = PIXI.Sprite.fromImage('./assets/app-circle.png')
sprite.scale.set(.3, .3)
app.stage.addChild(sprite)
sprite.interactive = true
sprite.buttonMode = true
sprite.on('click', e => {
console.log('sprite clicked')
})
</script>
</body>