我是面料和打字稿的新手。現在我試圖使用這個庫,我遇到了一個奇怪的錯誤。在我的代碼中,我試圖做到這一點:是fabricjs.d.ts真的缺少動畫功能?
var rect = new fabric.Rect();
rect.animate('angle', '-=5', {
onChange: this.canvas.renderAll.bind(this.canvas)
});
但它告訴我,'Property animate does not exist on type IObject'
。當我檢查定義文件時,我發現在fabric.util中只有一個稱爲animate的函數。
var util: {
addClass(element: HTMLElement, className: string);
addListener(element, eventName: string, handler);
animate(options: {
onChange?: (value: number) => void;
onComplete?:() => void;
startValue?: number;
endValue?: number;
byValue?: number;
easing?: (currentTime, startValue, byValue, duration) => number;
duration?: number;
});
createClass(parent, properties);
... }
我從 https://github.com/borisyankov/DefinitelyTyped/blob/master/fabricjs/fabricjs.d.ts
難道真的不完整的還是我失去了一些重要的定義是什麼?
定義文件缺少邊緣功能並不罕見。然而,圖書館作者錯過文檔 – basarat 2015-03-13 12:23:24