Last active
November 17, 2021 15:09
-
-
Save nasser/83fdd0ccf7c4b826b502ddcc4355302b to your computer and use it in GitHub Desktop.
a pixi.js boilerplate scene in a single 16 line self-contained html file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/reset.min.css"> | |
<script type="module"> | |
import * as PIXI from "https://cdnjs.cloudflare.com/ajax/libs/pixi.js/6.2.0/browser/pixi.min.mjs" | |
let app = new PIXI.Application() | |
document.body.appendChild(app.view) | |
window.onresize = function() { | |
app.renderer.resize(window.innerWidth, window.innerHeight) | |
app.stage.position = { x:window.innerWidth/2, y:window.innerHeight/2 } | |
} | |
window.onresize() | |
const dog = PIXI.Sprite.from('https://placedog.net/500?random') | |
dog.anchor.set(.5) | |
app.stage.addChild(dog) | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment