SVGAPlayer入门

下载:


https://github.com/yyued/SVGAPlayer-iOS

https://github.com/yyued/SVGAPlayer-Android

https://github.com/yyued/SVGAPlayer-Web

WEB本地运行:

SVGAPlayer-Web-master>http-server

目标:本地动画运行,背景透明

本地html代码:

<html>

<body style="text-align: center">
    <div>
        <div id="testCanvas" style="background-color: transparent; width:800px; height: 500px; margin: auto"></div>
        <!-- <canvas id="testCanvas" width="500" height="500" style="background-color: #000000; "></canvas> -->
    </div>
    <script src="https://cdn.jsdelivr.net/npm/howler@2.0.15/dist/howler.core.min.js"></script>
    <!--[if lt IE 10]> 
        <script src="../build/svga.ie.min.js"></script>
    <![endif]-->
    <!--[if gte IE 10]><!-->
        <script src="http://assets.dwstatic.com/common/lib/??jszip/3.1.3/jszip.min.js,jszip/3.1.3/jszip-utils.min.js" charset="utf-8"></script>
        <script src="../build/svga.min.js"></script>
    <!--<![endif]-->
    <script>
        var parser = new SVGA.Parser('#testCanvas')
        var player = new SVGA.Player('#testCanvas')
        parser.load("./samples/rose1.svga", function (videoItem) {
            player.setImage('./samples/avatar.png', '99')
            player.setVideoItem(videoItem);
            player.setText({ 
                text: 'Hello, World!', 
                size: "48px", 
                color: "#ffffff",
                offset:{x: 10.0, y: 0.0}
            });
            player.startAnimation();


            
            // player.startAnimationWithRange({location: 20, length: 1}, false); 
        }, function(error) {
            alert(error.message);
        })

    </script>
</body>

</html>

展示效果:

 

相关参考:

直播App中Android酷炫礼物动画实现方案:SVGA由来与Lottie对比
https://www.aliyun.com/jiaocheng/1767918.html
SVGAPlayer学习总结
https://www.jianshu.com/p/31169385a39d

SVGA  框架    ImageKey  在flash软件中定义的办
https://blog.csdn.net/ripe_boy/article/details/80729164

全部评论

相关推荐

05-29 20:34
门头沟学院 C++
KarlAllen:得做好直接春招的准备。学历差的话,一是面试要求会比学历好的严格不少,二是就算面试通过了也会被排序。总之暑期和秋招对于学历差的就是及其不友好
无实习如何秋招上岸
点赞 评论 收藏
分享
05-07 17:58
门头沟学院 Java
wuwuwuoow:1.简历字体有些怪怪的,用啥写的? 2.Redis 一主二从为什么能解决双写一致性? 3.乐观锁指的是 SQL 层面的库存判断?比如 stock > 0。个人认为这种不算乐观锁,更像是乐观锁的思想,写 SQL 避免不了悲观锁的 4.奖项证书如果不是 ACM,说实话没什么必要写 5.逻辑过期时间为什么能解决缓存击穿问题?逻辑过期指的是什么 其实也没什么多大要改的。海投吧
简历中的项目经历要怎么写
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务