Skip to content

Commit

Permalink
fix(line_geometries): use opacity for spring animation
Browse files Browse the repository at this point in the history
  • Loading branch information
emmacunningham committed Mar 1, 2019
1 parent f7f8d93 commit 58f7e3d
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/components/react_canvas/line_geometries.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ interface LineGeometriesDataState {
export class LineGeometries extends React.PureComponent<
LineGeometriesDataProps,
LineGeometriesDataState
> {
> {
static defaultProps: Partial<LineGeometriesDataProps> = {
animated: false,
};
Expand All @@ -41,6 +41,7 @@ export class LineGeometries extends React.PureComponent<
overPoint: undefined,
};
}

render() {
return (
<Group ref={this.barSeriesRef} key={'bar_series'}>
Expand Down Expand Up @@ -153,11 +154,12 @@ export class LineGeometries extends React.PureComponent<
if (this.props.animated) {
return (
<Group key={i} x={transform.x}>
<Spring native from={{ line }} to={{ line }}>
{(props: { line: string }) => (
<Spring native reset from={{ opacity: 0 }} to={{ opacity: 1 }}>
{(props: { opacity: number }) => (
<animated.Path
opacity={props.opacity}
key="line"
data={props.line}
data={line}
strokeWidth={strokeWidth}
stroke={color}
listening={false}
Expand All @@ -172,7 +174,7 @@ export class LineGeometries extends React.PureComponent<
} else {
return (
<Path
key="line"
key={i}
data={line}
strokeWidth={strokeWidth}
stroke={color}
Expand Down

0 comments on commit 58f7e3d

Please sign in to comment.