代码拉取完成,页面将自动刷新
<template>
<view>
<gal-animate-bg>
<view class="banner-title-main">
<view style="padding:150rpx 0;">
<gal-css-animate
:animateName="animateName"
:duration="animateDuration"
timingFunction="ease-in"
@onMounted="onMounted"
:autoPlay="false"
fillMode="forwards"
ref="galcssanimate">
<text class="gal-h3 gal-block-text gal-text-center gal-color-white">{{animateContent}}</text>
</gal-css-animate>
</view>
</view>
</gal-animate-bg>
<view class="gal-body gal-margin-top">
<view style="height:50rpx;"></view>
<view
class="gal-flex gal-rows gal-nowrap gal-justify-content-center gal-align-items-center"
hover-class="gal-tap">
<text class="gal-color-gray gal-text gal-icons"
@tap="replay"> 重新播放动画</text>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
animateName : 'bounce',
animateContent : 'www.GraceUI.com',
animateDuration : '1s',
// 进行连贯播放的动画数组
animations : [
{name:'bounceInRight', duration:'2s', timer:3000, content:'www.GraceUI.com'},
{name:'fadeIn', duration:'2s', timer:3000, content:'基于 uni-app 的优秀前端框架'},
{name:'flipInY', duration:'2s', timer:3000, content:'Grace Animation Library'},
{name:'wobble', duration:'2s', timer:3000, content:'基于 uni-app 的动画框架'}
],
// 动画是否正在播放
playing : false
}
},
methods: {
onMounted : function () {
console.log('动画组件已经准备好...');
this.play(0);
},
play : function (index) {
if(index >= this.animations.length){
this.playing = false;
return ;
}
this.playing = true;
this.animateContent = '';
this.animateName = this.animations[index].name;
this.animateContent = this.animations[index].content;
this.animateDuration = this.animations[index].duration;
this.$refs.galcssanimate.play();
setTimeout(()=>{
this.play(index+1);
}, this.animations[index].timer)
},
replay : function () {
if(this.playing){
uni.showToast({
title:'动画正在播放',
icon:"none"
});
return ;
}
this.play(0);
}
}
}
</script>
<style>
</style>
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。