npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

svgaplayer

v1.2.3

Published

## Version

Downloads

3

Readme

SVGAPlayer

Version

1.2.3

首个 SVGAPlayer - React Native 官方支持版本

使用

import SVGAPlayer from 'svgaplayer';
...
render() {
    return (
        <SVGAPlayer style={{width: 200, height: 200}} source="http://yourserver/xxx.svga" />
    )
}

参数

  • source: String - SVGA 动画文件的路径,可以是 URL,或是本地 NSBundle.mainBundle / assets 文件
  • loops: Int - 默认值为 0,用于指定动画循环次数,0 = 无限循环
  • clearsAfterStop: Boolean - 默认值为 true,动画播放完成后,是否清空画布
  • currentState: String - 用于控制 SVGA 播放状态,可设定以下值 >>> 'start' = 从头开始播放; 'pause' = 从当前位置暂停播放; 'stop' = '停止播放'; 'clear' = '停止播放并清空画布';
  • toFrame:Int - 控制当前动画停靠在某帧,如果 currentState 值为 'play',则跳到该帧后继续播放动画
  • toPercentage:Float - 控制当前动画停靠在某进度,如果 currentState 值为 'play',则跳到该帧后继续播放动画
  • onFinished:Function - 动画播放完成后,回调
  • onFrame:Function(Int) - 动画播放至某帧时,回调
  • onPercentage:Function(Float) - 动画播放至某进度时,回调

方法

  • load(source: String) - 加载动画
  • startAnimation() - 开始动画
  • pauseAnimation() - 暂停动画
  • stopAnimation() - 停止动画
  • stepToFrame(toFrame: Int, andPlay: Boolean) - 跳到某帧,然后继续(暂停)播放动画
  • stepToPercentage(toPercentage, andPlay) - 跳到某进度,然后继续(暂停)播放动画

安装

npm

npm install svgaplayer --save

iOS

Link 方式集成

npm install 后你可以使用 react-native link svgaplayer 集成

CocoaPods 方式集成

使用 CocoaPods 方式安装的前提是,React-Native 也使用 CocoaPods 进行集成。

在 Podfile 文件添加以下依赖

pod 'SVGAPlayer', :podspec => 'https://raw.githubusercontent.com/yyued/SVGAPlayer-iOS/1.1.2/SVGAPlayer-React.podspec'

pod install 即可

Android

使用 Gradle 方式进行集成

在顶级 build.gradle 文件添加仓库

allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}

在目标 build.gradle 文件添加依赖

compile 'com.github.yyued.SVGAPlayer-Android:library:1.2.3-react'
compile 'com.github.yyued.SVGAPlayer-Android:react:1.2.3-react'

同步后,添加 RCTSVGAPlayerPackage 实例到 ReactInstanceManager.builder() 即可。