-
-
Notifications
You must be signed in to change notification settings - Fork 105
en Pixi
pmgl edited this page Apr 7, 2022
·
1 revision
Pixi.js is an open source JavaScript API for accelerated 2D rendering, taking benefit from the GPU through WebGL.
Website: https://pixijs.com/
Github: https://github.com/pixijs/pixijs
After creating your project, open the settings tab, click "Show advanced settings" and choose Pixi.js as "Graphics library".
The scene or "stage" is a normal Pixi Container:
stage = new PIXI.Container()
my_sprite = PIXI.Sprite.from("mysprite")
stage.addChild(my_sprite)
You can easily change the position, scale or rotation of your sprite:
my_sprite.x += 1
my_sprite.scale.y = 2
my_sprite.rotation = PI/4
To render your scene, in your implementation of draw()
, simply call screen.render
, passing the stage to render as argument:
draw = function()
screen.render(stage)
end