mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-28 02:01:20 -08:00
add themeMix
This commit is contained in:
1 parent
59400eb3bf
commit
1438ce5e82
16 files changed
+428
-410
No files matched your search
@@ -23,10 +23,12 @@ import autoSizeMix from './autoSizeMix';
|
||||
import rectMix from './rectMix';
|
||||
import flipMix from './flipMix';
|
||||
import miniMix from './miniMix';
|
||||
import loopMin from './loopMin';
|
||||
import loopMix from './loopMix';
|
||||
import rotateMix from './rotateMix';
|
||||
import posterMix from './posterMix';
|
||||
import autoHeightMix from './autoHeightMix';
|
||||
import themeMix from './themeMix';
|
||||
import titleMix from './titleMix';
|
||||
|
||||
export default class Player {
|
||||
constructor(art) {
|
||||
@@ -55,9 +57,11 @@ export default class Player {
|
||||
rectMix(art);
|
||||
flipMix(art);
|
||||
miniMix(art);
|
||||
loopMin(art);
|
||||
loopMix(art);
|
||||
rotateMix(art);
|
||||
posterMix(art);
|
||||
autoHeightMix(art);
|
||||
themeMix(art);
|
||||
titleMix(art);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
import { def, clamp } from '../utils';
|
||||
|
||||
export default function loopMin(art) {
|
||||
export default function loopMix(art) {
|
||||
let interval = [];
|
||||
def(art, 'loop', {
|
||||
get: () => interval,
|
||||
@@ -4,8 +4,8 @@ export default function playMix(art) {
|
||||
const {
|
||||
i18n,
|
||||
notice,
|
||||
option,
|
||||
constructor: { instances },
|
||||
option: { mutex },
|
||||
template: { $video },
|
||||
} = art;
|
||||
|
||||
@@ -20,7 +20,7 @@ export default function playMix(art) {
|
||||
});
|
||||
}
|
||||
|
||||
if (mutex) {
|
||||
if (option.mutex) {
|
||||
instances.filter((item) => item !== art).forEach((item) => item.pause());
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ export default function seekMix(art) {
|
||||
},
|
||||
});
|
||||
|
||||
def(player, 'backward', {
|
||||
def(art, 'backward', {
|
||||
set(time) {
|
||||
art.seek = art.currentTime - time;
|
||||
},
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
import { def } from '../utils';
|
||||
|
||||
export default function themeMix(art) {
|
||||
const {
|
||||
option,
|
||||
template: { $player },
|
||||
} = art;
|
||||
|
||||
def(art, 'theme', {
|
||||
get() {
|
||||
return $player.style.getProperty('--theme');
|
||||
},
|
||||
set(theme) {
|
||||
option.theme = theme;
|
||||
$player.style.setProperty('--theme', theme);
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import { def } from '../utils';
|
||||
|
||||
export default function titleMix(art) {
|
||||
def(art, 'title', {
|
||||
get() {
|
||||
return art.option.title;
|
||||
},
|
||||
set(title) {
|
||||
art.option.title = title;
|
||||
},
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user