forked from greghe/react-native-particle-system
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathParticleView.js
72 lines (60 loc) · 2.28 KB
/
ParticleView.js
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/*
@providesModule ParticleView
*/
'use strict';
var React = require('react');
var ReactNative = require('react-native');
var {
View
} = ReactNative;
class ParticleView extends React.Component {
static propTypes = {
emitterPosition: React.PropTypes.shape({x:React.PropTypes.number, y:React.PropTypes.number}),
emitterZPosition: React.PropTypes.number,
emitterShape: React.PropTypes.oneOf(['point', 'line', 'rectangle', 'circle', 'cuboid', 'sphere']),
emitterSize: React.PropTypes.shape({width:React.PropTypes.number, height:React.PropTypes.number}),
emitterMode: React.PropTypes.oneOf(["points", 'outline', 'surface', 'volume']),
// specifies the order the particles are rendered on the screen
renderMode: React.PropTypes.oneOf(["unordered", "oldestFirst", "oldestLast", "backToFront", "additive"]),
emitterDepth: React.PropTypes.number,
preservesDepth: React.PropTypes.bool,
// specifies the begin time of the particle emitter - specified in milliseconds
beginTimeOffset: React.PropTypes.number,
// specifies whether the begin time should use the current media time
useCurrentMediaTime: React.PropTypes.bool,
// the next five properties are multipliers of the ParticleCell's property with the same name
// so a scale property of "2" would double the scale of all the enclosed ParticleCells
birthRate: React.PropTypes.number,
lifetime: React.PropTypes.number,
velocity: React.PropTypes.number,
scale: React.PropTypes.number,
spin: React.PropTypes.number,
seed: React.PropTypes.number,
...View.propTypes
};
constructor(props) {
super(props);
}
render() {
return (
<GPHParticleView {...this.props}></GPHParticleView>);
}
}
ParticleView.defaultProps = {
birthRate: 1,
lifetime: 1,
emitterPosition: {x:0, y:0},
emitterZPosition: 0,
emitterShape: 'point',
emitterSize: {width:0, height:0},
emitterMode: 'volume',
renderMode: 'unordered',
emitterDepth: 0,
preservesDepth: false,
velocity: 1,
scale: 1,
spin: 1,
seed: 0
};
var GPHParticleView = ReactNative.requireNativeComponent('GPHParticleView', null);
module.exports = ParticleView;