mirror of
https://github.com/konvajs/konva.git
synced 2026-01-23 13:26:07 +08:00
Merge branch 'master' of github.com:konvajs/konva
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
import { glob } from './Global';
|
import { glob } from './Global';
|
||||||
import { Layer } from './Layer';
|
import { Layer } from './Layer';
|
||||||
|
import { IFrame, AnimationFn } from './types';
|
||||||
|
|
||||||
var now = (function() {
|
var now = (function() {
|
||||||
if (glob.performance && glob.performance.now) {
|
if (glob.performance && glob.performance.now) {
|
||||||
@@ -17,7 +18,7 @@ var now = (function() {
|
|||||||
* Animation constructor.
|
* Animation constructor.
|
||||||
* @constructor
|
* @constructor
|
||||||
* @memberof Konva
|
* @memberof Konva
|
||||||
* @param {Function} func function executed on each animation frame. The function is passed a frame object, which contains
|
* @param {AnimationFn} func function executed on each animation frame. The function is passed a frame object, which contains
|
||||||
* timeDiff, lastTime, time, and frameRate properties. The timeDiff property is the number of milliseconds that have passed
|
* timeDiff, lastTime, time, and frameRate properties. The timeDiff property is the number of milliseconds that have passed
|
||||||
* since the last animation frame. The lastTime property is time in milliseconds that elapsed from the moment the animation started
|
* since the last animation frame. The lastTime property is time in milliseconds that elapsed from the moment the animation started
|
||||||
* to the last animation frame. The time property is the time in milliseconds that elapsed from the moment the animation started
|
* to the last animation frame. The time property is the time in milliseconds that elapsed from the moment the animation started
|
||||||
@@ -37,19 +38,19 @@ var now = (function() {
|
|||||||
* anim.start();
|
* anim.start();
|
||||||
*/
|
*/
|
||||||
export class Animation {
|
export class Animation {
|
||||||
func: () => boolean;
|
func: AnimationFn;
|
||||||
id = Animation.animIdCounter++;
|
id = Animation.animIdCounter++;
|
||||||
|
|
||||||
layers: Layer[];
|
layers: Layer[];
|
||||||
|
|
||||||
frame = {
|
frame : IFrame = {
|
||||||
time: 0,
|
time: 0,
|
||||||
timeDiff: 0,
|
timeDiff: 0,
|
||||||
lastTime: now(),
|
lastTime: now(),
|
||||||
frameRate: 0
|
frameRate: 0
|
||||||
};
|
};
|
||||||
|
|
||||||
constructor(func, layers?) {
|
constructor(func: AnimationFn, layers?) {
|
||||||
this.func = func;
|
this.func = func;
|
||||||
this.setLayers(layers);
|
this.setLayers(layers);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,15 @@ export interface IRect {
|
|||||||
height: number;
|
height: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface IFrame {
|
||||||
|
time: number;
|
||||||
|
timeDiff: number;
|
||||||
|
lastTime: any;
|
||||||
|
frameRate: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type AnimationFn = (frame?: IFrame) => boolean|void;
|
||||||
|
|
||||||
export enum KonvaNodeEvent {
|
export enum KonvaNodeEvent {
|
||||||
mouseover = 'mouseover',
|
mouseover = 'mouseover',
|
||||||
mouseout = 'mouseout',
|
mouseout = 'mouseout',
|
||||||
|
|||||||
Reference in New Issue
Block a user