基础过渡动画
<template> <view> <uni-section title="基础过渡动画" type="line"></uni-section> <view class="example-body"> <button @click="open(['slide-top'])">slide-top</button> <button @click="open(['slide-left'])">slide-left</button> <button @click="open(['slide-right'])">slide-right</button> <button @click="open(['slide-bottom'])">slide-bottom</button> <button @click="open(['fade'])">fade</button> <button @click="open(['zoom-in', 'fade'])">zoom-in</button> <button @click="open(['zoom-out', 'fade'])">zoom-out</button> </view> <uni-transition :duration="500" :mode-class="modeClass" :styles="transfromClass" :show="transShow" @click="onTap"> <text style="color: #fff;padding: 40px;background-color: #4CD964;">Test</text> </uni-transition> </view> </template> <script> export default { components: {}, data() { return { transShow: false, modeClass: ['fade'], maskClass: { position: 'fixed', bottom: 0, top: 0, left: 0, right: 0, 'background-color': 'rgba(0, 0, 0, 0.4)' }, transfromClass: { position: 'fixed', bottom: 0, top: 0, left: 0, right: 0, display: 'flex', 'justify-content':'center', 'align-items': 'center' } }; }, onLoad() {}, methods: { open(mode) { this.modeClass = mode; this.transShow = !this.transShow; }, onTap() { this.transShow = false; } } }; </script>
组合过渡动画
<template> <view> <view class="example-body"> <button @click="open(['fade','zoom-out','slide-top'])">组合动画示例一</button> <button @click="open(['zoom-in','slide-bottom','fade'])">组合动画示例二</button> <button @click="open(['slide-left','slide-top','fade'])">组合动画示例三</button> </view> <uni-transition :mode-class="modeClass" :styles="transfromClass" :show="transShow" @click="onTap" :duration="500"> <text style="color: #fff;padding: 40px;background-color: #4CD964;">Test</text> </uni-transition> </view> </template> <script> export default { components: {}, data() { return { transShow: false, modeClass: ['fade'], maskClass: { 'position': 'fixed', 'bottom': 0, 'top': 0, 'left': 0, 'right': 0, 'background-color': 'rgba(0, 0, 0, 0.4)', }, transfromClass: { 'position': 'fixed', 'bottom': 0, 'top': 0, 'left': 0, 'right': 0, 'display': 'flex', 'justify-content': 'center', 'align-items': 'center' } } }, onLoad() {}, methods: { open(mode) { this.modeClass = mode this.transShow = !this.transShow }, onTap() { this.transShow = this.show = false } } } </script>
网友回复
为啥所有的照片分辨率提升工具都会修改照片上的图案细节?
js如何在浏览器中将webm视频的声音分离为单独音频?
微信小程序如何播放第三方域名url的mp4视频?
ai多模态大模型能实时识别视频中的手语为文字吗?
如何远程调试别人的chrome浏览器获取调试信息?
为啥js打开新网页window.open设置窗口宽高无效?
浏览器中js的navigator.mediaDevices.getDisplayMedia屏幕录像无法录制SpeechSynthesisUtterance产生的说话声音?
js中mediaRecorder如何录制window.speechSynthesis声音音频并下载?
python如何直接获取抖音短视频的音频文件url?
js在浏览器中如何使用MediaStream与MediaRecorder实现声音音频多轨道混流?