本文整理匯總了TypeScript中gifken.GifPresenter類的典型用法代碼示例。如果您正苦於以下問題:TypeScript GifPresenter類的具體用法?TypeScript GifPresenter怎麽用?TypeScript GifPresenter使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了GifPresenter類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: if
onmessage = evt => {
var message: any = {};
var gif = Gif.parse(evt.data.buffer);
if (evt.data.action === "reverse") {
message["src"] = URL.createObjectURL(
GifPresenter.writeToBlob(gif.playback(true).writeToArrayBuffer())
);
} else if (evt.data.action === "split") {
message["src_list"] = [];
gif.split(true).forEach(frame => {
var blob = GifPresenter.writeToBlob(frame.writeToArrayBuffer());
message["src_list"].push(URL.createObjectURL(blob));
});
}
(self as any).postMessage(message);
};
示例2: Worker
xhr.onload = e => {
if (!e.target || !(e.target as any).response) {
return;
}
const arrayBuffer = (e.target as any).response as ArrayBuffer;
if (Worker) {
// enable web workers
const worker = new Worker("./task.ts");
worker.onmessage = evt => {
img.src = evt.data.src;
};
worker.postMessage({ buffer: arrayBuffer, action: "reverse" });
} else {
// disable web workers
const gif = Gif.parse(arrayBuffer);
img.src = URL.createObjectURL(
GifPresenter.writeToBlob(gif.playback(true).writeToArrayBuffer())
);
}
};
示例3: Image
gif.split(true).forEach(i => {
const img = new Image(),
blob = GifPresenter.writeToBlob(i.writeToArrayBuffer());
img.src = URL.createObjectURL(blob);
content.appendChild(img);
});
示例4:
gif.split(true).forEach(frame => {
var blob = GifPresenter.writeToBlob(frame.writeToArrayBuffer());
message["src_list"].push(URL.createObjectURL(blob));
});