add themeMix

This commit is contained in:
zhw2590582 committed 2022-01-07 18:05:28 +08:00
1 parent 59400eb3bf
commit 1438ce5e82
16 files changed
+428 -410

No files matched your search

+6 -2
View File
@@ -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,
+2 -2
View File
@@ -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());
}
+1 -1
View File
@@ -19,7 +19,7 @@ export default function seekMix(art) {
},
});
def(player, 'backward', {
def(art, 'backward', {
set(time) {
art.seek = art.currentTime - time;
},
+18
View File
@@ -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);
},
});
}
+12
View File
@@ -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;
},
});
}