wya1
    • 课程
    • 书籍
    • 工具
    • 博客
    • 登录
    • 注册

    小言_互联网的博客

    小言_互联网的博客

    个人资料

    小言_互联网

    • 访问:2792592次
    • 积分:10000
    • 等级:0

    文章分类

    1. java(241)
    2. python(163)
    3. 人工智能(100)
    4. Linux(92)
    5. AI(80)
    6. 技术交流(79)
    7. 前端(73)
    8. 热点文章(70)
    9. OpenCV(56)
    10. C++(55)

    文章存档

    1. 2020年04月(4134)
    2. 2019年10月(1013)
    3. 2019年09月(810)
    4. 2019年08月(9)
    5. 2019年05月(8)
    6. 2019年04月(79)
    7. 2019年03月(41)

    阅读排行

    1. 《Python程序设计与算法基础教程(第二版)》江红 余青松 课后代码题详解(7392)
    2. 9月知乎大神推荐的磁力链搜索网站与磁力链原理解析(7087)
    3. python123《Python语言程序设计》程序题答案 (第1周)(6264)
    4. 生猛!看 AV 神器来了!实时把画质变成 4k 高清,延时仅3毫秒,登上GitHub 趋势榜!...(5177)
    5. 抖音X-Gorgon接口,非逆向Andserver(4942)
    6. 若依框架RuoYi前后端分离项目导入IDEA及运行启动(4806)
    7. Dev-C++ 的一些常见问题(中文乱码、C/C++11运行环境、左侧工程栏、函数提示等操作)(4585)
    8. 如何对Excel表的姓名进行脱敏处理(3883)
    9. VScode中使用Cmake遇到的问题及其解决方法(3119)
    10. Unity 接入 ILRuntime 热更方案(3021)

    评论排行

    1. 深度学习一年学习心得(如何入门)(0)
    2. sql server中字符串类型的日期如何比较大小(0)
    3. Android面试经历2018(0)
    4. 面试给我的感悟(0)
    5. 关于CentOS中KVM处于paused状态,却怎么也改变不了状态的问题解决(0)
    6. Python中pandas dataframe删除一行或一列:drop函数(0)
    7. 使用Win10 Hyper-V 创建虚拟机(0)
    8. 10 年三线小城 IT 开发的感悟(0)
    9. 入行必看_老程序员对准程序员满满的爱(0)
    10. 人脸识别(一)——人脸识别简介(0)

    推荐文章

    1. 20+个很棒的 Python 脚本的集合(迷你项目)
    2. 又发现一个ChatGPT国内镜像站,无次数限制也无广告
    3. 解决报错:org.springframework.web.client.HttpClientErrorException$Unauthorized: 401 : [no body]
    4. 解决 eslint 的 Parsing error: Unexpected token 错误
    5. Proxy error: Could not proxy request
    6. 五、肺癌检测-数据集训练 training.py model.py
    7. 安装Photoshop时出现The installation cannot continue as the installer file may be damaged. Download the in
    8. STM32单片机之温湿度检测系统(DTH11、OLED、LCD1602)
    9. 误差分析计算公式及其 matlab 代码实现(mse、mape、rmse等)
    10. echarts——实现3D地图+3D柱状图 效果——粗糙代码记录——技能提升

    Vue 使用CSS3 实现简单过渡动画

    2019-10-08 11:13 386人阅读  评论(0)

    实现点击缩放、移动,鼠标点击移动完成旋转

    <template>
      <div id="import-template" @mouseup.self="mouseUp">
        <ul class="box" @click="reset" @mousedown.self="mouseDown($event)" @mousemove="mouseMove($event)" @mouseup.self="mouseUp" ref="box">
          <li v-for="item in list" :key="item.id" :id="item.name" @click.stop="select(item.name, item.href)" :ref="item.name" >
            <img :src="item.url" alt="">
          </li>
        </ul>
      </div>
    </template>
    
    <script>
      export default {
        name: 'Index',
        data() {
          return {
           list: [
             {id: 1, url: require('@/assets/images/1.jpg'), href: 'https://www.baidu.com', name: 'first'},
             {id: 2, url: require('@/assets/images/2.jpg'), href: 'https://www.jd.com', name: 'second'},
             {id: 3, url: require('@/assets/images/3.jpg'), href: 'https://www.taobao.com', name: 'third'},
             {id: 4, url: require('@/assets/images/4.jpg'), href: 'https://www.163.com', name: 'fourth'},
             {id: 5, url: require('@/assets/images/5.jpg'), href: 'https://www.sina.com.cn', name: 'fifth'},
           ],
           flag: false,
           distance: ``,
          }
        },
        mounted() {
          delete sessionStorage.currentName
        },
        methods: {
          //鼠标按下
          mouseDown(e) {
            // let cX, cY, x, y
            // cX = e.clientX
            // cY = e.clientY
            // x = ( e.clientX / window.innerWidth ) * 2 - 1
            // y = - ( e.clientY / window.innerHeight ) * 2 + 1
            // console.log(cX, cY)
            // console.log(x, y)
            this.flag = true
            this.distance = e.clientX
          },
          //鼠标移动
          mouseMove(e) {
            if (this.flag) {
              let angle = e.clientX - this.distance
              if (angle >= 30 || angle <= -30) {
                this.mouseUp()
              } else {
                this.$refs.box.style.transition = `all 3s`
                this.$refs.box.style.transform = `rotateY(${-angle}deg)`
              }
            }
          },
          //鼠标抬起
          mouseUp() {
            this.flag = false
            this.distance = ``
          },
          //选中
          select(name, href) {
            this.$refs.box.style.transform = ``
            if (sessionStorage.currentName) {
              if (name != sessionStorage.currentName) {
                this.reset()
              } else {
                window.location.href = href
              }
            }
            sessionStorage.currentName = name
            this.$refs[name][0].className = `${name}-move-style z-index`
          },
          //重置
          reset() {
            this.$refs.first[0].className = ''
            this.$refs.second[0].className = ''
            this.$refs.third[0].className = ''
            this.$refs.fourth[0].className = ''
            this.$refs.fifth[0].className = ''
            delete sessionStorage.currentName
          }
        }
      }
    </script>
    
    <style scoped>
      #import-template {
        perspective: 600px;
        transform-style: preserve-3d;
      }
      .box {
        padding-top: 50px;
        width: 100%;
        height: 230px;
        display: flex;
        justify-content: space-between;
        perspective: 600px;
        /*transform-style: preserve-3d;*/
        /*backface-visibility: hidden;*/
      }
      .box li {
        height: 200px;
        transition: all 2s;
        cursor: pointer;
      }
      .box li img {
        display: block;
        width: 100%;
        height: 100%;
      }
    
      /* 3D效果 */
      .box li#first {
        transform: rotateY(90deg) translateX(10px);
      }
      .box li#second {
        transform: rotateY(50deg) translateX(14px);
      }
      .box li#third {}
      .box li#fourth {
        transform: rotateY(-50deg) translateX(-14px);
      }
      .box li#fifth {
        transform: rotateY(-90deg) translateX(-10px);
      }
    
      .first-move-style {
        transform: translate(570px, 150px) scale(1.6)!important;
      }
      .second-move-style {
        transform: translate(284px, 150px) scale(1.6)!important;
      }
      .third-move-style {
        transform: translate(0, 150px) scale(1.6)!important;
      }
      .fourth-move-style {
        transform: translate(-284px, 150px) scale(1.6)!important;
      }
      .fifth-move-style {
        transform: translate(-570px, 150px) scale(1.6)!important;
      }
    
      .z-index {
        z-index: 999
      }
    
      /* 2D效果 */
      /*.box li#first {*/
      /*  transform: rotateY(20deg) skewY(-10deg) translateY(58px);*/
      /*}*/
      /*.box li#second {*/
      /*  transform: rotateY(20deg) skewY(-5deg) translate(-7px, 15px);*/
      /*}*/
      /*.box li#fourth {*/
      /*  transform: rotateY(-20deg) skewY(5deg) translate(7px, 15px);*/
      /*}*/
      /*.box li#fifth {*/
      /*  transform: rotateY(-20deg) skewY(10deg) translateY(58px);*/
      /*}*/
    
      /*.first-move-style {*/
      /*  transform: translate(570px, 150px) scale(1.6)!important;*/
      /*}*/
      /*.second-move-style {*/
      /*  transform: translate(284px, 150px) scale(1.6)!important;*/
      /*}*/
      /*.third-move-style {*/
      /*  transform: translate(0, 150px) scale(1.6)!important;*/
      /*}*/
      /*.fourth-move-style {*/
      /*  transform: translate(-284px, 150px) scale(1.6)!important;*/
      /*}*/
      /*.fifth-move-style {*/
      /*  transform: translate(-570px, 150px) scale(1.6)!important;*/
      /*}*/
    
      /* 测试样式 */
      /*.box li#first {*/
      /*  transform: rotateY(25deg) skewY(10deg);*/
      /*}*/
      /*.box li#second {*/
      /*  transform: rotateY(20deg) skewY(5deg) translate(-7px, 40px);*/
      /*}*/
      /*.box li#third {*/
      /*  transform: translateY(52px);*/
      /*}*/
      /*.box li#fourth {*/
      /*  transform: rotateY(-20deg) skewY(-5deg) translate(7px, 40px);*/
      /*}*/
      /*.box li#fifth {*/
      /*  transform: rotateY(-25deg) skewY(-10deg);*/
      /*}*/
    
      /*.first-move-style {*/
      /*  transform: translate(570px, 150px) scale(1.2)!important;*/
      /*}*/
      /*.second-move-style {*/
      /*  transform: translate(284px, 150px) scale(1.2)!important;*/
      /*}*/
      /*.third-move-style {*/
      /*  transform: translate(0, 150px) scale(1.2)!important;*/
      /*}*/
      /*.fourth-move-style {*/
      /*  transform: translate(-284px, 150px) scale(1.2)!important;*/
      /*}*/
      /*.fifth-move-style {*/
      /*  transform: translate(-570px, 150px) scale(1.2)!important;*/
      /*}*/
    </style>
    

    转载:https://blog.csdn.net/BradyCC/article/details/102325636
    查看评论
    * 以上用户言论只代表其个人观点,不代表本网站的观点或立场

    Copyright © 2016 wya1 wya1.com All Rights Reserved 鄂ICP备15022242号-2