mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-29 02:51:20 -08:00
优化gif demo
This commit is contained in:
1 parent
c3bc0f5270
commit
0eaf9b9b3b
4 files changed
+8
-8
No files matched your search
@@ -35,7 +35,7 @@ body,
|
|||||||
|
|
||||||
.part-left .artplayer {
|
.part-left .artplayer {
|
||||||
width: 500px;
|
width: 500px;
|
||||||
height: 500px;
|
height: 300px;
|
||||||
background: #fff;
|
background: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,9 +32,11 @@
|
|||||||
plugins: [artplayerPluginGif]
|
plugins: [artplayerPluginGif]
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var $preview = document.querySelector('.preview');
|
||||||
art.on('artplayerPluginGif', image => {
|
art.on('artplayerPluginGif', image => {
|
||||||
var animatedImage = document.createElement('img');
|
var animatedImage = document.createElement('img');
|
||||||
animatedImage.src = image;
|
animatedImage.src = image;
|
||||||
document.querySelector('.preview').appendChild(animatedImage);
|
$preview.innerHTML = '';
|
||||||
|
$preview.appendChild(animatedImage);
|
||||||
});
|
});
|
||||||
})();
|
})();
|
||||||
@@ -2844,13 +2844,12 @@
|
|||||||
});
|
});
|
||||||
return {
|
return {
|
||||||
name: 'artplayerPluginGif',
|
name: 'artplayerPluginGif',
|
||||||
isProcessing: isProcessing,
|
|
||||||
create: function create() {
|
create: function create() {
|
||||||
var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
||||||
var callback = arguments.length > 1 ? arguments[1] : undefined;
|
var callback = arguments.length > 1 ? arguments[1] : undefined;
|
||||||
isProcessing = true;
|
isProcessing = true;
|
||||||
loading.show();
|
loading.show();
|
||||||
art.emit('artplayerPluginGif:create:start');
|
art.emit('artplayerPluginGif:start');
|
||||||
notice.show(i18n.get('Start creating gif...'), false);
|
notice.show(i18n.get('Start creating gif...'), false);
|
||||||
console.log("Start time: ".concat(config.offset || 0, " s, Duration: ").concat(config.numFrames / 10 || 1));
|
console.log("Start time: ".concat(config.offset || 0, " s, Duration: ").concat(config.numFrames / 10 || 1));
|
||||||
gifshot.createGIF(objectSpread({}, config, {
|
gifshot.createGIF(objectSpread({}, config, {
|
||||||
@@ -2868,7 +2867,7 @@
|
|||||||
|
|
||||||
isProcessing = false;
|
isProcessing = false;
|
||||||
loading.hide();
|
loading.hide();
|
||||||
art.emit('artplayerPluginGif:create:end');
|
art.emit('artplayerPluginGif:end');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -125,11 +125,10 @@ function artplayerPluginGif(art) {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
name: 'artplayerPluginGif',
|
name: 'artplayerPluginGif',
|
||||||
isProcessing,
|
|
||||||
create(config = {}, callback) {
|
create(config = {}, callback) {
|
||||||
isProcessing = true;
|
isProcessing = true;
|
||||||
loading.show();
|
loading.show();
|
||||||
art.emit('artplayerPluginGif:create:start');
|
art.emit('artplayerPluginGif:start');
|
||||||
notice.show(i18n.get('Start creating gif...'), false);
|
notice.show(i18n.get('Start creating gif...'), false);
|
||||||
console.log(`Start time: ${config.offset || 0} s, Duration: ${config.numFrames / 10 || 1}`);
|
console.log(`Start time: ${config.offset || 0} s, Duration: ${config.numFrames / 10 || 1}`);
|
||||||
gifshot.createGIF(
|
gifshot.createGIF(
|
||||||
@@ -150,7 +149,7 @@ function artplayerPluginGif(art) {
|
|||||||
|
|
||||||
isProcessing = false;
|
isProcessing = false;
|
||||||
loading.hide();
|
loading.hide();
|
||||||
art.emit('artplayerPluginGif:create:end');
|
art.emit('artplayerPluginGif:end');
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in new issue
Block a user