mirror of
https://github.com/pipipi-pikachu/PPTist.git
synced 2025-04-15 02:20:00 +08:00
feat:添加可预览全部元素动画
This commit is contained in:
parent
effd46e05e
commit
254bb0c7c3
@ -107,6 +107,9 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</Draggable>
|
</Draggable>
|
||||||
|
<Button class="animation-preview" @click="runAllAnimation" v-if="animationSequence.length >= 2">
|
||||||
|
<IconPlayOne style="margin-right:5px" />{{ animateIn ? '停止' : '预览'}}
|
||||||
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -171,7 +174,7 @@ const tabs: TabItem[] = [
|
|||||||
{ key: 'attention', label: '强调', color: '#e8b76a' },
|
{ key: 'attention', label: '强调', color: '#e8b76a' },
|
||||||
]
|
]
|
||||||
const activeTab = ref('in')
|
const activeTab = ref('in')
|
||||||
|
const animateIn = ref(false)
|
||||||
watch(() => handleElementId.value, () => {
|
watch(() => handleElementId.value, () => {
|
||||||
animationPoolVisible.value = false
|
animationPoolVisible.value = false
|
||||||
})
|
})
|
||||||
@ -247,6 +250,17 @@ const runAnimation = (elId: string, effect: string, duration: number) => {
|
|||||||
elRef.addEventListener('animationend', handleAnimationEnd, { once: true })
|
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) => {
|
const updateElementAnimationDuration = (id: string, duration: number) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user