iwmlib/lib/pixi/application.html

41 lines
1.2 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>PIXI.Application Doctest</title>
<link rel="stylesheet" href=".././3rdparty/highlight/styles/default.css" />
<link rel="stylesheet" href="../../css/doctest.css" />
<script src="../../dist/iwmlib.3rdparty.js"></script>
<script src="../../dist/iwmlib.js"></script>
<script src="../../dist/iwmlib.pixi.js"></script>
</head>
<body>
<h1><a href="../index.html">lib.</a><a href="index.html">pixi.</a>Vanilla PIXI.Application</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.from('./assets/app-circle.png')
sprite.scale.set(0.3, 0.3)
app.stage.addChild(sprite)
sprite.interactive = true
sprite.buttonMode = true
sprite.on('click', (e) => {
console.log('sprite clicked')
})
</script>
</body>
</html>