微信小程序图片在视频上运动,触边反弹,全屏可用

编程入门 行业动态 更新时间:2024-10-05 05:14:42

微信小程序图片在视频上运动,触边反弹,<a href=https://www.elefans.com/category/jswz/34/1763477.html style=全屏可用"/>

微信小程序图片在视频上运动,触边反弹,全屏可用

    data() {return {theWidth: null, //可视最大宽theHeight: null, //可视最大高thex: 0, //动态x they: 0, //动态y speed:50, //X运动速度speed2:50, //Y运动速度ee:null, //全屏事件对象}move(){this.timer = setInterval(()=>{this.thex = this.thex + this.speed;this.they = this.they + this.speed2;if(this.thex >= this.theWidth){               this.thex = this.theWidth;this.speed = -this.speed;}else if(this.thex <= 0){this.thex = 0;this.speed = -this.speed;};if(this.they >= this.theHeight){this.they = this.theHeight;this.speed2 = -this.speed2;}else if(this.they <= 0){this.they = 0;this.speed2 = -this.speed2;}    },1000)},screenChange(e){//全屏与退出全屏都要重新获取可视宽高this.ee = e;setTimeout(()=>{console.log("全屏或者退出全屏!!!");let getWindowInfo = uni.getWindowInfo();console.log("getWindowInfo=>",getWindowInfo);this.maxWidth = getWindowInfo.windowWidth;this.maxHeight = getWindowInfo.windowHeight;this.theWidth = (this.maxWidth * 2) - 160;console.log("this.theWidth=>", this.theWidth);this.theHeight = (this.maxHeight * 2) - 160;console.log("this.theHeight=>", this.theHeight);if(this.ee.detail.fullscreen == true){this.showMenu = false;console.log("全屏");}else if(this.ee.detail.fullscreen == false){this.showMenu = true;console.log("非全屏");}},1000)},

更多推荐

微信小程序图片在视频上运动,触边反弹,全屏可用

本文发布于:2024-03-23 17:41:06,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1740944.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:全屏   程序   图片   视频   微信小

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!