mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-17 01:56:16 -08:00
优化背光刷新频率
This commit is contained in:
1 parent
c7a351bc55
commit
2d4da12180
3 files changed
+10
-10
No files matched your search
@@ -42,8 +42,8 @@ function creatMatrix(parent) {
|
||||
return matrixCallback((xIndex, yIndex, x, y) => {
|
||||
const $box = document.createElement('div');
|
||||
$box.style.position = 'absolute';
|
||||
$box.style.left = `${xIndex * 100 / x}%`;
|
||||
$box.style.top = `${yIndex * 100 / y}%`;
|
||||
$box.style.left = `${(xIndex * 100) / x}%`;
|
||||
$box.style.top = `${(yIndex * 100) / y}%`;
|
||||
$box.style.width = `${100 / x}%`;
|
||||
$box.style.height = `${100 / y}%`;
|
||||
$box.style.webkitBorderRadius = '50%';
|
||||
@@ -86,7 +86,7 @@ function artplayerPluginBacklight(art) {
|
||||
$player.insertBefore($backlight, $video);
|
||||
|
||||
(function loop() {
|
||||
window.requestAnimationFrame(() => {
|
||||
setTimeout(() => {
|
||||
if (player.playing) {
|
||||
const { clientWidth, clientHeight } = $video;
|
||||
const colors = getColors($canvas, $video, clientWidth, clientHeight);
|
||||
@@ -98,13 +98,13 @@ function artplayerPluginBacklight(art) {
|
||||
const y = top ? '-64px' : bottom ? '64px' : '0';
|
||||
$box.style.webkitBoxShadow = `rgb(${r}, ${g}, ${b}) ${x} ${y} 128px`;
|
||||
$box.style.boxShadow = `rgb(${r}, ${g}, ${b}) ${x} ${y} 128px`;
|
||||
});
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
if (!art.isDestroy) {
|
||||
loop();
|
||||
}
|
||||
});
|
||||
}, 200);
|
||||
})();
|
||||
|
||||
return {
|
||||
@@ -112,4 +112,4 @@ function artplayerPluginBacklight(art) {
|
||||
};
|
||||
}
|
||||
|
||||
export default artplayerPluginBacklight;
|
||||
export default artplayerPluginBacklight;
|
||||
Reference in new issue
Block a user