Unable to preload and display SVG with CreateJS

前端 未结 2 1526
别跟我提以往
别跟我提以往 2021-01-14 12:01

I am trying to preload a set of SVG objects and display them using CreateJS/PreloadJS. So far I was able to display a SVG object without preloading, but as soon as I use the

2条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-14 12:33

    I found simple solution. Just force PreloadJS to use image loader, not SVGLoader.

    {src:"img/bg.svg", id:"bg", type: createjs.LoadQueue.IMAGE}
    

    Then you can convert it

    var bg = new createjs.Bitmap(loader.getResult('bg'));  
    stage.addChild(bg);
    

提交回复
热议问题