Merge branch 'master' of github.com:rewhtie/PPTist into rewhtie-master

This commit is contained in:
pipipi-pikachu 2023-12-05 20:44:53 +08:00
commit 61b1752e38

View File

@ -107,6 +107,9 @@
</div>
</template>
</Draggable>
<Button class="animation-preview" @click="runAllAnimation" v-if="animationSequence.length >= 2">
<IconPlayOne style="margin-right:5px" />{{ animateIn ? '停止' : '预览'}}
</Button>
</div>
</template>
@ -171,7 +174,7 @@ const tabs: TabItem[] = [
{ key: 'attention', label: '强调', color: '#e8b76a' },
]
const activeTab = ref('in')
const animateIn = ref(false)
watch(() => handleElementId.value, () => {
animationPoolVisible.value = false
})
@ -247,6 +250,17 @@ const runAnimation = (elId: string, effect: string, duration: number) => {
elRef.addEventListener('animationend', handleAnimationEnd, { once: true })
}
}
//
const runAllAnimation = async () => {
animateIn.value = !animateIn.value
for (let i = 0; i < animationSequence.value.length; i++) {
if (!animateIn.value) break
const item = animationSequence.value[i]
if (item.index !== 1 && item.trigger !== 'meantime') await new Promise(resolve => setTimeout(resolve, item.duration + 100))
runAnimation(item.elId, item.effect, item.duration)
if (i === animationSequence.value.length - 1) animateIn.value = false
}
}
//
const updateElementAnimationDuration = (id: string, duration: number) => {