39 lines
974 B
TypeScript
39 lines
974 B
TypeScript
import { Application } from "pixi.js";
|
|
import { Hand } from "./Hand";
|
|
|
|
(async () => {
|
|
// Create a new application
|
|
const app = new Application();
|
|
|
|
// Initialize the application
|
|
await app.init({ background: "#1099bb", resizeTo: window });
|
|
|
|
// Append the application canvas to the document body
|
|
document.getElementById("pixi-container")!.appendChild(app.canvas);
|
|
|
|
try {
|
|
const hand = new Hand(1000, [
|
|
"fourOfDiamonds",
|
|
"eightOfDiamonds",
|
|
"threeOfClubs",
|
|
"kingOfSpades",
|
|
"unknown",
|
|
]);
|
|
|
|
app.stage.addChild(hand.cards);
|
|
|
|
hand.cards.position.set(app.screen.width / 2, 0);
|
|
hand.cards.pivot.set(hand.cards.width / 2, 0);
|
|
|
|
// Listen for animate update
|
|
// app.ticker.add((time) => {
|
|
// // Just for fun, let's rotate mr rabbit a little.
|
|
// // * Delta is 1 if running at 100% performance *
|
|
// // * Creates frame-independent transformation *
|
|
// bunny.rotation += 0.1 * time.deltaTime;
|
|
// });
|
|
} catch (err) {
|
|
console.log(err);
|
|
}
|
|
})();
|