html5加载svga

2019-11-26    分类: 前端资源

 

<script src="https://cdn.jsdelivr.net/npm/svgaplayerweb@2.3.0/build/svga.min.js"></script>

 

html:

<div id="canvas"></div>

 

js:

<script>
var player =new SVGA.Player('#canvas');
var parser =new SVGA.Parser('#canvas');
parser.load('./images/box.svga', function(videoItem) {
  player.setVideoItem(videoItem);
  player.startAnimation();
})
</script>

 

http://svga.io/integrated.html