declare const PIXI ; const config = { "lifetime" : { "min" : 0.25 , "max" : 0.5 } , "frequency" : 0.001 , "emitterLifetime" : 0 , "maxParticles" : 1000 , "addAtBack" : false , "pos" : { "x" : 0 , "y" : 0 } , "behaviors" : [ { "type" : "alpha" , "config" : { "alpha" : { "list" : [ { "time" : 0 , "value" : 1 } , { "time" : 1 , "value" : 0.31 } ] } } } , { "type" : "moveAcceleration" , "config" : { "accel" : { "x" : 0 , "y" : 2000 } , "minStart" : 600 , "maxStart" : 600 , "rotate" : true } } , { "type" : "scale" , "config" : { "scale" : { "list" : [ { "time" : 0 , "value" : 0.5 } , { "time" : 1 , "value" : 1 } ] } , "minMult" : 1 } } , { "type" : "color" , "config" : { "color" : { "list" : [ { "time" : 0 , "value" : "ffffff" } , { "time" : 1 , "value" : "9ff3ff" } ] } } } , { "type" : "rotationStatic" , "config" : { "min" : 260 , "max" : 280 } } , { "type" : "textureRandom" , "config" : { "textures" : [ "../../docs/examples/images/Sparks.png" ] } } , { "type" : "spawnShape" , "config" : { "type" : "torus" , "data" : { "x" : 0 , "y" : 0 , "radius" : 0 , "innerRadius" : 0 , "affectRotation" : false } } } ] } ; const canvas = document . getElementById ( "stage" ) as HTMLCanvasElement ; const rendererOptions = { width : canvas . width , height : canvas . height , view : canvas , } ; const stage = new PIXI . Container ( ) , renderer = new PIXI . Renderer ( rendererOptions ) ; let emitter = null , bg = null ; let elapsed = Date . now ( ) ; let updateId ; const update = function ( ) { updateId = requestAnimationFrame ( update ) ; const now = Date . now ( ) ; if ( emitter ) emitter . update ( ( now - elapsed ) * 0.001 ) ; elapsed = now ; renderer . render ( stage ) ; } ; window . onresize = function ( ) { canvas . width = window . innerWidth ; canvas . height = window . innerHeight ; renderer . resize ( canvas . width , canvas . height ) ; if ( bg ) { bg . scale . x = canvas . width ; bg . scale . y = canvas . height ; } } ; window . onresize ( null ) ; bg = new PIXI . Sprite ( PIXI . Texture . WHITE ) ; bg . scale . x = canvas . width ; bg . scale . y = canvas . height ; bg . tint = 0x000000 ; stage . addChild ( bg ) ; const emitterContainer = new PIXI . Container ( ) ; stage . addChild ( emitterContainer ) ; ( window as any ) . emitter = emitter = new PIXI . particles . Emitter ( emitterContainer , config ) ; emitter . updateOwnerPos ( window . innerWidth / 2 , window . innerHeight / 2 ) ; canvas . addEventListener ( 'mouseup' , function ( e ) { if ( ! emitter ) return ; emitter . emit = true ; emitter . resetPositionTracking ( ) ; emitter . updateOwnerPos ( e . offsetX , e . offsetY ) ; } ) ; update ( ) ; ( window as any ) . destroyEmitter = function ( ) { emitter . destroy ( ) ; emitter = null ; ( window as any ) . destroyEmitter = null ; renderer . render ( stage ) ; } ;