本文整理汇总了TypeScript中gifken.GifPresenter.writeToBlob方法的典型用法代码示例。如果您正苦于以下问题:TypeScript GifPresenter.writeToBlob方法的具体用法?TypeScript GifPresenter.writeToBlob怎么用?TypeScript GifPresenter.writeToBlob使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gifken.GifPresenter
的用法示例。
在下文中一共展示了GifPresenter.writeToBlob方法的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));
});