Transition (过渡动画)
集合常用动画特效,使页面之间的切换更加流畅和自然。它可以实现多种动画效果,例如淡入淡出、滑动、缩放等。增强用户体验,使页面之间的切换更加有趣和吸引力。
支持平台
安卓 | ios | 鸿蒙 | web | 微信小程序 |
---|---|---|---|---|
√ | √ | √ | √ | √ |
示例代码
html
<template>
<t-page title='动画'>
<t-card main-class="m-30" title="Transtion 过渡动画"
sub-title="集合常用动画特效,使页面之间的切换更加流畅和自然。它可以实现多种动画效果,例如淡入淡出、滑动、缩放等。增强用户体验,使页面之间的切换更加有趣和吸引力。"></t-card>
<t-transition :mode="mode" main-class="fc mt-30 z-999" :animationIterationCount="1" :auto-play="false"
ref="transitionins">
<t-row main-class="twh-150 r-10 bg-#4cd964;"></t-row>
</t-transition>
<t-col main-class='fc p-30'>
<t-transition mode="heartbeat" :animation-iteration-count="0">
<t-icon name="heart-fill" main-class="c-red s-180"></t-icon>
</t-transition>
</t-col>
<t-col main-class="p-30">
<t-button main-class="mb-20" @click="onButtonClick('fade')" type="primary">渐隐渐显</t-button>
<t-button main-class="mb-20" @click="onButtonClick('fade-up')" type="primary">上方进出</t-button>
<t-button main-class="mb-20" @click="onButtonClick('fade-down')" type="primary">下方进出</t-button>
<t-button main-class="mb-20" @click="onButtonClick('fade-left')" type="primary">左方进出</t-button>
<t-button main-class="mb-20" @click="onButtonClick('fade-right')" type="primary">右方进出</t-button>
<t-button main-class="mb-20" @click="onButtonClick('zoom')" type="primary">缩放</t-button>
<t-button main-class="mb-20" @click="onButtonClick('heartbeat')" type="primary">心跳</t-button>
</t-col>
</t-page>
</template>
<script>
export default {
data() {
return {
mode: 'fade'
};
},
methods: {
onButtonClick(type : string) {
this.mode = type;
(this.$refs['transitionins'] as ComponentPublicInstance).$callMethod('play')
}
}
}
</script>
属性
名称 | 类型 | 默认值 | 说明 | 可选值 |
---|---|---|---|---|
size | String | mini | 组件尺寸 | large(大尺寸), medium(中尺寸), small(小尺寸), mini(迷你) |
type | String | "" | 组件类型 | info(信息), primary(正常), error(错误), warning(警告), success(成功) |
disabled | Boolean | false | 组件是否禁用 | false, true |
stop | Boolean | false | 是否阻止事件冒泡(Tui统一写法处理事件冒泡) | false, true |
hover | Boolean | true | 是否有点击效果 | false, true |
path | String | "" | 点击组件后跳转的页面路径,如果为空则响应点击事件,如果不为空则跳转页面不会响应单击事件。 | - |
mainClass | String | "" | 组件根节点的样式 | - |
nativeClass | String | "" | 组件根节点原生样式 | - |
effect | String | "normal" | 组件显示主题 | normal(正常), dark(深色), light(浅色), plain(镂空) |
animationIterationCount | Number | 1 | 动画播放次数 | |
duration | Number | 500 | 动画播放时间 | |
timingFunction | String | ease-in-out | 动画播放缓动函数 | |
transformOrigin | String | 50% 50% | 动画播放变换原点 | |
mode | String | `` | 使用的动画模式 | fade : 渐隐渐显fade-up : 上方进出fade-down : 下方进出fade-left : 左方进出fade-right : 右方进出zoom : 缩放heartbeat : 心跳 |
autoPlay | Boolean | true | 是否自动播放 |
事件
名称 | 返回参数 | 说明 |
---|---|---|
transitionend | - | 动画结束时触发 |
click | (e : UniPointerEvent) | - |
方法
名称 | 参数 | 返回值 | 说明 |
---|---|---|---|
play | - | - | 播放动画 |
插槽
名称 | 返回值 | 说明 |
---|---|---|
default | - |