当前位置:网站首页>Build a short video platform, fade in and fade out, and support left sliding and right pulley to broadcast pictures
Build a short video platform, fade in and fade out, and support left sliding and right pulley to broadcast pictures
2022-06-29 22:19:00 【Yunbao network technology】
Construction of short video platform , Fade in and out Support left sliding and right pulley to broadcast pictures
<template>
<view class="grapSwiper">
<view class="banner" @touchstart="touchStart" @touchend="touchEnd">
<image v-for="(value,index) in swiperList" :key="index" class="pic" :src="value.imagePath" :animation="num==index?showpic:hidepic"/>
<view class="snipper">
<view class="sniItem" v-for="(item,ind) in swiperList" :key="ind" :class="num==ind?'activeItem':''"></view>
</view>
</view>
</view>
</template>
<script>
export default {
name: 'grapSwiper',
data () {
return {
touchStartX: 0, // Touch screen start point x
touchStartY: 0, // Touch screen start point y
swiperList:[
{
imagePath:'https://pla.o-banks.cn/attach/mgrImg/20220110/1641806731686.png'
},
{
imagePath:'https://pla.o-banks.cn/attach/mgrImg/20210923/1632361307137.png'
},
{
imagePath:'https://pla.o-banks.cn/attach/mgrImg/20210916/1631775560384.png'
}
],
setTime:null,
num:0,
timeCount:5000,
showpic:null,
hidepic:null
}
},
created () {
},
mounted(){
this.initSwiper();
},
methods:{
initSwiper(){
const animation = uni.createAnimation({
}) // Create an animation instance
this.setTime = setInterval(() => {
this.num++
if(this.num >this.swiperList.length-1){
this.num = 0
}
// Fade in
animation.opacity(1).step({
duration:300}) // Describe the animation
this.showpic = animation.export()
// Fade out
animation.opacity(0).step({
duration:300})
this.hidepic=animation.export()
}, this.timeCount);
},
touchStart(e) {
this.touchStartX = e.touches[0].clientX;
this.touchStartY = e.touches[0].clientY;
},
touchEnd(e) {
let deltaX = e.changedTouches[0].clientX - this.touchStartX;
let deltaY = e.changedTouches[0].clientY - this.touchStartY;
if (Math.abs(deltaX) > 50 && Math.abs(deltaX) > Math.abs(deltaY)) {
// Reinitialize the timer when sliding left and right
clearInterval(this.setTime)
this.initSwiper();
if (deltaX >= 0) {
this.num--
if(this.num <0){
this.num = this.swiperList.length-1
}
} else {
this.num++
if(this.num >this.swiperList.length-1){
this.num = 0
}
}
} else {
console.log(" It may be touched by mistake !")
}
},
},
destroyed(){
clearInterval(this.setTime)
}
}
</script>
<style lang="scss" scoped>
.grapSwiper{
.banner{
width: 750rpx;
height: 640rpx;
position: relative;
.pic{
width: 750rpx;
height: 640rpx;
position: absolute;
}
.snipper{
position: absolute;
width: 100%;
height: 2rpx;
top: 210rpx;
left: 0;
display: flex;
align-items: center;
justify-content: center;
.sniItem{
width: 15rpx;
height: 2rpx;
background: #FFFFFF;
opacity: 0.4;
border-radius: 5rpx;
margin-right: 6rpx;
}
.activeItem{
width: 25rpx;
background: #FFFFFF;
opacity: 1;
}
}
}
}
</style>
The above is the construction of short video platform , Fade in and out Support left sliding and right pulley to broadcast pictures , More content welcome to follow the article
边栏推荐
- 美国隧道法ASTM E84 表面阻燃测试
- Can cdc2.2.1 listen to multiple PgSQL libraries at the same time?
- Weibo comments on high availability and high performance computing architecture
- Grep工具
- Information available from radar echo
- ASP dynamically creates table table
- Golang operation etcd
- CSDN failed to replicate problem
- Wechat public account development, send message reply text
- 【无工具搭建PHP8+oracle11g+Windows环境】内网/无网络/Win10/PHP连接oracle数据库实例
猜你喜欢

生产环境AIX小机报错B6267342问题处理

Huawei cloud AOM version 2.0 release

Deep learning remote sensing data set

Cloud native database query optimization - statistics and row count estimation

美国隧道法ASTM E84 表面阻燃测试

软件测试方法和技术知识点有哪些?

leetcode:91. 解码方法【dfs + 记忆化】

Hardware development notes (VIII): basic process of hardware development, making a USB to RS232 module (VII): creating a basic dip component (crystal oscillator) package and associating the principle

26 years old, 0 basic career change software test, from 3K to 16K monthly salary, a super complete learning guide compiled by me

Structure the fifth operation of the actual camp module
随机推荐
Which securities to choose for securities account opening? In addition, is it safe to open an account online now?
[crossbeam series] 5 crossbeam util and crossbeam queue: some practical gadgets
Datakit acts as an API server for local data acquisition
彩涂钢板密封板申请BS 476-3如何备样?
[cloud native] use of Nacos taskmanager task management
Introduction, deployment and application of moosefs
Go standard library context package: data, cancellation signal, deadline and other related operations between a single request and multiple goroutines and the request domain
A mysql IBD file is too large processing record
Is it safe to bind securities accounts to flush? Which securities firm can bind flush after opening an account
R language plot visualization: plot visualization box graph and several box plots of multiple classification variables
Is it appropriate to apply silicone paint to American Standard UL 790 class a?
How to use SMS to deliver service information to customers? The guide is here!
Detailed description of gaussdb (DWS) complex and diverse resource load management methods
Detailed explanation of MySQL and mvcc and the difference between RC and RR for snapshot reading
[multithreading] how to implement timer by yourself
Huawei cloud AOM version 2.0 release
状态管理 利用Session限制页面访问 只有通过登录验证SessionLogin.aspx才能访问Session.aspx
DevCloud加持下的青软,让教育“智”上云端
Huawei's software testing director with 7 years' experience, several suggestions for all students who want to switch to software testing
如果我在珠海,到哪里开户比较好?究竟网上开户是否安全么?