-
Notifications
You must be signed in to change notification settings - Fork 35
Open
Description
import { Component } from 'react'
import { View, Text, Canvas } from '@tarojs/components'
import { Parser, Player } from "svgaplayer-weapp";
import "taro-ui/dist/style/components/button.scss" // 按需引入
import './index.scss'
export default class Index extends Component {
componentDidMount () {
this.loadAnimation();
}
async loadAnimation() {
const parser = new Parser;
const player = new Player;
await player.setCanvas('#demoCanvas')
const videoItem = await parser.load("https://cdn.jsdelivr.net/gh/svga/SVGA-Samples@master/angel.svga");
await player.setVideoItem(videoItem);
player.startAnimation();
}
render () {
return (
<View className='index'>
<Canvas type='2d' id='demoCanvas' style={{width: "300px", height: "300px", backgroundColor: "black"}} />
</View>
)
}
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels