CreateJS,如何将SVG作为矢量而非位图加载

问题描述

我正在尝试使用CreateJS加载SVG,并将它们放置在彼此的顶部(具有x,y和旋转),同时将它们保持为矢量形式。下面是我的代码。问题是我必须使用Bitmap对象,并且该对象不断栅格化SVG。

我看过Snap(我不了解Docs),我看过ReactJS(但这似乎不是我的解决方案)。谁能推荐我如何以x,y和旋转显示SVG,同时将其保持为矢量形式?谢谢。

<html>
  <head>
  <Meta http-equiv="content-type" content="text/html; charset=utf-8">
  <Meta name="generator" content="PSPad editor,www.pspad.com">
  <title></title>
  
  <script src="https://code.createjs.com/1.0.0/createjs.min.js"></script>
  
  <script>
   function init() {

      var stage = new createjs.Stage("canvas");
      const loader = new createjs.LoadQueue(false,null,true);
      
      loader.on("complete",e =>
      {
          const bitmap = new createjs.Bitmap(e.currentTarget.getResult("test"));
          stage.addChild(bitmap);
          stage.update();
        
      });
      loader.loadManifest([{id:"test",src:"hangar_125.svg",type:"image"}]);

    }
  </script>    
  
  </head>
  <body onload="init();">
    <canvas id="canvas" width="500" height="300"></canvas>
  </body>
</html>

View a screen shot to show what I mean

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)