UNPKG

@nativescript-community/ui-chart

Version:

A powerful chart / graph plugin, supporting line, bar, pie, radar, bubble, and candlestick charts as well as scaling, panning and animations.

52 lines 1.55 kB
import { ViewPortJob } from './ViewPortJob'; import { Tween } from '../animation/Tween'; /** * Created by Philipp Jahoda on 19/02/16. */ export class AnimatedViewPortJob extends ViewPortJob { constructor(viewPortHandler, xValue, yValue, trans, v, xOrigin, yOrigin, duration) { super(viewPortHandler, xValue, yValue, trans, v); this.duration = duration; this.xOrigin = xOrigin; this.yOrigin = yOrigin; } createAnimator(duration) { this.animator = new Tween({ onRender: (state) => { this.phase = state.value; this.onAnimationUpdate(this.animator); }, onFinish: () => this.onAnimationEnd(this.animator), onCancel: () => this.onAnimationCancel(this.animator) }); this.animator['duration'] = duration; } run() { if (!this.animator) { this.createAnimator(this.duration); } this.animator.tween({ value: 0 }, { value: 1 }, this.animator['duration']); } resetAnimator() { this.animator.cancel(); } onAnimationStart(animation) { } onAnimationEnd(animation) { try { this.recycleSelf(); } catch (e) { // don't worry about it. } } onAnimationCancel(animation) { try { this.recycleSelf(); } catch (e) { // don't worry about it. } } onAnimationUpdate(animation) { } } //# sourceMappingURL=AnimatedViewPortJob.js.map