eguneys Posted July 16, 2019 Share Posted July 16, 2019 I've written a virtual dom library for pixi.js. https://github.com/eguneys/snabbpixi It only supports `PIXI.Container` and `PIXI.Sprite` but you can extend it to work for custom display containers. It's used like this: import * as PIXI from 'pixi.js'; import { init } from 'snabbpixi'; import { h } from 'snabbpixi'; const app = new PIXI.Application({}); app.loader .add("") .load(() => { let patch, vnode; function redraw() { vnode = patch(vnode, view()); } patch = init([]); const blueprint = view(); vnode = patch(app.stage, blueprint); }; function view() { return h('container', [ h('sprite', { texture: PIXI.Texture.from('image.png') }), h('sprite', { texture: PIXI.Texture.from('image.png') x: 10, y: 10, height: 100, width: 100 }); ]); } Please take a look and use it, I will try to improve it as I make more games. ivan.popelyshev 1 Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted July 16, 2019 Share Posted July 16, 2019 Where is it? Oh, right, https://github.com/eguneys/snabbpixi Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.