Create lock.js

This commit is contained in:
Harvey committed 2022-04-22 13:50:41 +08:00
1 parent 0ed695a899
commit f1310a3148
1 file changed
+33
+33
View File
@@ -0,0 +1,33 @@
export default function lock(art) {
const { layers } = art;
layers.add({
name: 'miniProgressBar',
style: {
display: 'none',
position: 'absolute',
left: 0,
right: 0,
bottom: 0,
height: '2px',
backgroundColor: 'var(--theme)',
},
mounted($progressBar) {
art.on('control', (value) => {
$progressBar.style.display = value ? 'none' : 'block';
});
art.on('destroy', () => {
$progressBar.style.display = 'none';
});
art.on('video:timeupdate', () => {
$progressBar.style.width = `${art.played * 100}%`;
});
},
});
return {
name: 'lock',
};
}