File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -20,10 +20,12 @@ export default class SvgAnimatedLinearGradient extends Component {
20
20
constructor ( props ) {
21
21
super ( props ) ;
22
22
23
+ const initialOffsetValues = props . offset
24
+ ? [ 1 , 1 + props . offset / 2 , 1 + props . offset ]
25
+ : [ 1 , 1.5 , 2 ] ;
23
26
this . state = {
24
- offsetValues : [
25
- '-2' , '-1.5' , '-1'
26
- ] ,
27
+ initialOffsetValues,
28
+ offsetValues : [ ...initialOffsetValues ] . reverse ( ) . map ( v => String ( v * - 1 ) ) ,
27
29
offsets : [
28
30
'0.0001' , '0.0002' , '0.0003' // Avoid duplicate value cause error in Android
29
31
] ,
@@ -55,7 +57,7 @@ export default class SvgAnimatedLinearGradient extends Component {
55
57
if ( ! this . _isMounted ) return ;
56
58
// setup interpolate
57
59
let interpolator = interpolate ( this . state , {
58
- offsetValues : [ '1' , '1.5' , '2' ]
60
+ offsetValues : this . state . initialOffsetValues . map ( v => String ( v ) )
59
61
} ) ;
60
62
61
63
// start animation
@@ -156,6 +158,6 @@ SvgAnimatedLinearGradient.defaultProps = {
156
158
x1 : '0' ,
157
159
y1 : '0' ,
158
160
x2 : '100%' ,
159
- y2 : '0'
160
-
161
+ y2 : '0' ,
162
+ offset : 1 ,
161
163
}
You can’t perform that action at this time.
0 commit comments