react-native-svg-animated-linear-gradient
Advanced tools
Comparing version 0.3.3 to 0.3.4
{ | ||
"name": "react-native-svg-animated-linear-gradient", | ||
"version": "0.3.3", | ||
"version": "0.3.4", | ||
"description": "Animated linear gradient for React Native Svg", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -80,2 +80,3 @@ ## SVG Animated Linear Gradient [iOS + Android] | ||
| secondaryColor | String | '#dddddd' | Secondary color | | ||
| duration | Number | 2000 | Animation duration in milliseconds | | ||
| width | Number | 300 | Width of SVG | | ||
@@ -82,0 +83,0 @@ | height | Number | 200 | Height of SVG | |
@@ -23,6 +23,8 @@ import React, {Component} from 'react'; | ||
const initialOffsetValues = props.offset | ||
? [1, 1 + props.offset / 2, 1 + props.offset] | ||
: [1, 1.5, 2]; | ||
this.state = { | ||
offsetValues: [ | ||
'-2', '-1.5', '-1' | ||
], | ||
initialOffsetValues, | ||
offsetValues: [...initialOffsetValues].reverse().map(v => String(v * -1)), | ||
offsets: [ | ||
@@ -59,3 +61,3 @@ '0.0001', '0.0002', '0.0003' // Avoid duplicate value cause error in Android | ||
let interpolator = interpolate(this.state, { | ||
offsetValues: ['1', '1.5', '2'] | ||
offsetValues: this.state.initialOffsetValues.map(v => String(v)) | ||
}); | ||
@@ -161,4 +163,4 @@ | ||
x2: '100%', | ||
y2: '0' | ||
y2: '0', | ||
offset: 1, | ||
} |
3905429
153
103