VisActor / VisActor/VChart

[Documentation] example of disappear animate

Open
#4,342 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

animation docs
Dominant language
TypeScript
Stars
1.8k
Forks
221
Avg merge
1d 6h
Merged PRs (30d)
26

Description

Documentation Title or Section

Example of disappear

Issue Description or Suggestion

import { AStageAnimate } from '@visactor/vrender-animate';

class CustomDisappear extends AStageAnimate {
protected currentAnimationRatio = 0;
protected animationTime = 0;

constructor(from: null, to: null, duration: number, easing: EasingType, params: any) {
super(from, to, duration, easing, params);
}

onUpdate(end: boolean, ratio: number, out: any): void {
super.onUpdate(end, ratio, out);
console.log('onUpdate customDisappear class');
}

/**

  • 获取基于动画进度的时间
    */
    protected getAnimationTime(): number {
    if (this.currentAnimationRatio > 0) {
    return this.animationTime;
    }
    return Date.now() / 1000.0;
    }

protected afterStageRender(stage: any, canvas: HTMLCanvasElement): void {
console.log('afterStageRender customDisappear class');
}
}

const spec: IChartSpec = {
type: 'bar',
data: {
id: 'barData',
values: [
{ type: 'Nail polish', country: 'Africa', value: 4229 },
{ type: 'Nail polish', country: 'EU', value: 4376 },
{ type: 'Nail polish', country: 'China', value: 3054 },
{ type: 'Nail polish', country: 'USA', value: 12814 },
{ type: 'Eyebrow pencil', country: 'Africa', value: 3932 },
{ type: 'Eyebrow pencil', country: 'EU', value: 3987 },
{ type: 'Eyebrow pencil', country: 'China', value: 5067 },
{ type: 'Eyebrow pencil', country: 'USA', value: 13012 },
{ type: 'Rouge', country: 'Africa', value: 5221 },
{ type: 'Rouge', country: 'EU', value: 3574 },
{ type: 'Rouge', country: 'China', value: 7004 },
{ type: 'Rouge', country: 'USA', value: 11624 },
{ type: 'Lipstick', country: 'Africa', value: 9256 },
{ type: 'Lipstick', country: 'EU', value: 4376 },
{ type: 'Lipstick', country: 'China', value: 9054 },
{ type: 'Lipstick', country: 'USA', value: 8814 }
]
},
xField: 'type',
yField: 'value',
seriesField: 'country',
animationDisappear: {
/**
* use custom class
/
// callBack: CustomDisappear,
/
*
* use custom function
*/
callBack: (...params: any[]) => {
console.log('animationDisappear', ...params);
},
duration: 1500
}
};

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start from the documentation section identified as "Example of disappear" and review the supplied TypeScript example using animationDisappear. Document the custom callback and CustomDisappear class shown in the issue; done means the disappear-animation example is available in the appropriate documentation section.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.