-
Notifications
You must be signed in to change notification settings - Fork 2
/
Bodymovin.jsx
34 lines (33 loc) · 1.05 KB
/
Bodymovin.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import React from 'react'
import Bodymovin from 'bodymovin'
import { SetStaticContext } from 'Components'
import './style.less'
export default class BodymovinContainer extends React.Component {
componentDidMount () {
const animationData = require('Assets/bodymovin/react_logo.json')
const animationProperties = {
container: this.refs.cycle,
renderer: 'svg',
loop: true,
autoplay: true,
animationData
}
// 渲染svg
Bodymovin.loadAnimation(animationProperties)
}
render() {
const seoInfo = {
title: '(react 服务端渲染 bodymovin 示例) react server side render bodymovin demo',
keywords: 'react server side render demo 服务端渲染示例 bodymovin',
description: 'react server side render demo 服务端渲染示例 bodymovin'
}
return (
<SetStaticContext code={200} seoInfo={seoInfo}>
<div className='container-bodymovin'>
<h3>Bodymovin demo</h3>
<div className='cycle' ref='cycle'></div>
</div>
</SetStaticContext>
)
}
}