iwmlib/lib/pixi/application.html

37 lines
923 B
HTML
Raw Permalink 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>
2019-05-22 16:03:19 +02:00
<script src="../../dist/iwmlib.3rdparty.js"></script>
<script src="../../dist/iwmlib.js"></script>
<script src="../../dist/iwmlib.pixi.js"></script>
2019-03-21 09:57:27 +01:00
</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
2019-09-10 16:34:59 +02:00
const sprite = PIXI.Sprite.from('./assets/app-circle.png')
2019-03-21 09:57:27 +01:00
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>