Skip to content

Commit

Permalink
fix: add id field to AnimationDefinition interface (#1351)
Browse files Browse the repository at this point in the history
  • Loading branch information
dangreen authored Aug 13, 2022
1 parent 8002f6a commit 4012c43
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion sandboxes/line/simple-svg-animation/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ chart.on('draw', data => {
}
});

let timerId: NodeJS.Timeout;
let timerId: any;

// For the sake of the example we update the chart every time it's created with a delay of 8 seconds
chart.on('created', () => {
Expand Down
2 changes: 1 addition & 1 deletion sandboxes/line/svg-animation/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ chart.on('draw', data => {
}
});

let timerId: NodeJS.Timeout;
let timerId: any;

// For the sake of the example we update the chart every time it's created with a delay of 8 seconds
chart.on('created', () => {
Expand Down
9 changes: 4 additions & 5 deletions sandboxes/pie/donut-animation/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'chartist/dist/index.css';
import { PieChart, easings } from 'chartist';
import { PieChart, easings, AnimationDefinition } from 'chartist';

const chart = new PieChart(
'#chart',
Expand All @@ -26,16 +26,15 @@ chart.on('draw', data => {
});

// Create animation definition while also assigning an ID to the animation for later sync usage
const animationDefinition = {
const animationDefinition: Record<string, AnimationDefinition> = {
'stroke-dashoffset': {
id: 'anim' + data.index,
dur: 1000,
from: -pathLength + 'px',
to: '0px',
easing: easings.easeOutQuint,
// We need to use `fill: 'freeze'` otherwise our animation will fall back to initial (not visible)
fill: 'freeze',
begin: ''
fill: 'freeze'
}
};

Expand All @@ -55,7 +54,7 @@ chart.on('draw', data => {
}
});

let timerId: NodeJS.Timeout;
let timerId: any;

// For the sake of the example we update the chart every time it's created with a delay of 8 seconds
chart.on('created', () => {
Expand Down
1 change: 1 addition & 0 deletions src/svg/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export interface SvgPathOptions {
export type Attributes = Record<string, number | string | undefined | null>;

export interface AnimationDefinition {
id?: string;
easing?: number[] | keyof typeof easings;
calcMode?: 'discrete' | 'linear' | 'paced' | 'spline';
restart?: 'always' | 'whenNotActive' | 'never';
Expand Down

0 comments on commit 4012c43

Please sign in to comment.