当前位置: 首页 > article >正文

css实现图片绕中心旋转,鼠标悬浮按钮炫酷展示

 vue模板中代码

<div class="contentBox clearfix home">
    <div class="circle">
        <img class="in-circle" src="../../assets/img/in-circle.png" alt="">
        <img class="out-circle" src="../../assets/img/out-circle.png" alt="">
    <div><img src="../../assets/img/hbsztda.png" alt=""></div>
    </div>
        <div class="leftAndRight left-wing">
        <div class="left-1"  @click="goPath(ztList[0])" style="color: #fff">
             {{ ztList[0].name }}
        </div>
    <div class="left-2"  @click="goPath(ztList[1])">
         {{ ztList[1].name }}
    </div>
    <div class="left-3"  @click="goPath(ztList[2])">
         {{ ztList[2].name }}
    </div>
    <div class="left-4"  @click="goPath(ztList[3])">
         {{ ztList[3].name }}
    </div>
    <div class="left-5"  @click="goPath(ztList[4])">
         {{ ztList[4].name }}
    </div>
    </div>
    <div class="leftAndRight right-wing">
    <div class="right-1"  @click="goPath(ztList[5])">
         {{ ztList[5].name }}
    </div>
    <div class="right-2"  @click="goPath(ztList[6])">
         {{ ztList[6].name }}
    </div>
    <div class="right-3"  @click="goPath(ztList[7])">
         {{ ztList[7].name }}
    </div>
    <div class="right-4"  @click="goPath(ztList[8])">
         {{ ztList[8].name }}
    </div>
    <div class="right-5"  @click="goPath(ztList[9])">
         {{ ztList[9].name }}
    </div>
    </div>
</div>

 css代码

.home {
        width: 100vw;
        height: 100%;
        background: #000F17;
        position: relative;
        display: flex;
        justify-content: center;
        align-items: center;
        .circle {
            width: 505px;
            height: 505px;
            max-width: 100%;
            max-height: 100%;
            text-align: center;
            background-size: 100% 100%;
            color: #FFFFFF;
            font-size: 40px;
            font-family: Microsoft YaHei UI, Microsoft YaHei UI;
            font-weight: 400;
            position: relative;
            display: grid;
            place-items: center;
            .in-circle {
                width: 400px;
                height: 400px;
                position: absolute;
                transition: 0.5s;
                transform-origin: center center;  
                animation: rotation 10s linear infinite;
            }
            @-webkit-keyframes rotation{
                from {-webkit-transform: rotate(0deg);}
                to {-webkit-transform: rotate(360deg);}
            }
            .out-circle {
                width: 100%;
                height: 100%;
                position: absolute;
                transition: 0.5s;
                transform-origin: center center;  
                animation: rotateImg 10s linear infinite;
            }
            @-webkit-keyframes rotateImg{
                from {-webkit-transform: rotate(0deg);}
                to {-webkit-transform: rotate(-360deg);}
            }
            div {
                margin: auto;
            }
        }
        .leftAndRight {
            width: 35vw;
            height: 80vh;
            position: absolute;
            top: 50%;
            transform: translateY(-50%);
            font-size: 24px;
            color: #FFFFFF;
            display: flex;
            flex-direction: column;
            justify-content: space-around;
        }
        .left-wing {
            left: 0;
            background: url('../../assets/img/left.png') no-repeat;
            background-position: right;
            background-size: auto 100%;
            text-align: right;
        }
        .right-wing {
            right: 0;
            background: url('../../assets/img/right.png') no-repeat;
            background-size: auto 100%;
            align-items: flex-end;
        }
        .left-1,
        .left-2, 
        .left-3,
        .left-4,
        .left-5 {
            width: 22vw;
            height: 8vh;
            line-height: 8vh;
            text-align: center;
            box-sizing: border-box;
            border: 0.5px solid #D8D8D8;
            cursor: pointer;
            color: #fff;
            background-color: plum;
            background-color:#bb65c3;
            border: none;
            transition: all 0.3s ease-in-out;
            filter: hue-rotate(calc(4.6 * 137deg));
        }
        .left-1 {
            margin-left: 10%;
        }
        .left-2 {
            margin-left: 17%;
        }
        .left-3 {
            margin-left: 25%;
        }
        .left-4 {
            margin-left: 17%;
        }
        .left-5 {
            margin-left: 10%;
        }

        .left-1::before,
        .left-1::after,
        .left-2::before,
        .left-2::after,
        .left-3::before,
        .left-3::after,
        .left-4::before,
        .left-4::after,
        .left-5::before,
        .left-5::after,
        .right-1::before,
        .right-1::after,
        .right-2::before,
        .right-2::after,
        .right-3::before,
        .right-3::after,
        .right-4::before,
        .right-4::after,
        .right-5::before,
        .right-5::after {
            /* 将两个伪元素的相同部分写在一起 */
            content: "";
            position: absolute;
            width: 20px;
            height: 20px;
            border: 2px solid plum;
            /* 动画过渡 最后的0.3s是延迟时间 */
            transition: all 0.3s ease-in-out 0.3s;
        }
        .left-1::before,
        .left-2::before,
        .left-3::before,
        .left-4::before,
        .left-5::before,
        .right-1::before,
        .right-2::before,
        .right-3::before,
        .right-4::before,
        .right-5::before {
            top: 0;
            left: 0;
            /* 删除左边元素的右、下边框 */
            border-right: 0;
            border-bottom: 0;
        }
        .left-1::after,
        .left-2::after,
        .left-3::after,
        .left-4::after,
        .left-5::after,
        .right-1::after,
        .right-2::after,
        .right-3::after,
        .right-4::after,
        .right-5::after {
            bottom: 0;
            right: 0;
            /* 删除右边元素的左、上边框 */
            border-top: 0;
            border-left: 0;
        }
        .left-1:hover,
        .left-2:hover,
        .left-3:hover,
        .left-4:hover,
        .left-5:hover,
        .right-1:hover,
        .right-2:hover,
        .right-3:hover,
        .right-4:hover,
        .right-5:hover {
            background-color: plum;
            // color: #000;
            /* 发光效果和倒影 */
            box-shadow: 0 0 50px plum;
            /* below是下倒影 1px是倒影的元素相隔的距离 最后是个渐变颜色 */
            -webkit-box-reflect: below 1px linear-gradient(transparent,rgba(0,0,0,0.3));
            /* 设置以上属性的延迟时间 */
            // transition-delay: 0.4s;
            background-color:#bb65c3;
            border: none;

        }
        .left-1:hover::before,
        .left-1:hover::after,
        .left-2:hover::before,
        .left-2:hover::after,
        .left-3:hover::before,
        .left-3:hover::after,
        .left-4:hover::before,
        .left-4:hover::after,
        .left-5:hover::before,
        .left-5:hover::after,
        .right-1:hover::before,
        .right-1:hover::after,
        .right-2:hover::before,
        .right-2:hover::after,
        .right-3:hover::before,
        .right-3:hover::after,
        .right-4:hover::before,
        .right-4:hover::after,
        .right-5:hover::before,
        .right-5:hover::after {
            width: 60%;
            height: 60%;
            transition-delay: 0s;
        }
        .right-1,
        .right-2, 
        .right-3,
        .right-4,
        .right-5 {
            width: 22vw;
            height: 8vh;
            line-height: 8vh;
            text-align: center;
            box-sizing: border-box;
            cursor: pointer;
            color: #fff;
            background-color: plum;
            background-color:#bb65c3;
            border: none;
            transition: all 0.3s ease-in-out;
            filter: hue-rotate(calc(4.6 * 137deg));
        }
        .right-1 {
            margin-right: 10%;
        }
        .right-2 {
            margin-right: 17%;
        }
        .right-3 {
            margin-right: 25%;
        }
        .right-4 {
            margin-right: 17%;
        }
        .right-5 {
            margin-right: 10%;
        }
    }
    @media screen and (max-width:1600px){
        .home .circle{
            font-size: 28px;
            width: 385px;
            height: 385px;
            line-height: 385px;
            .in-circle {
                width: 300px;
                height: 300px;
            }
        }
        .home .leftAndRight {
            font-size: 22px;
        }
    }
    @media screen and (max-width:1366px){
        .home .circle{
            width: 205px;
            height: 205px;
            line-height: 205px;
            font-size: 26px;
            .in-circle {
                width: 200px;
                height: 200px;
            }
        }
        .home .leftAndRight {
            font-size: 20px;
        }
    }

运行效果


http://www.kler.cn/a/147057.html

相关文章:

  • 【Git】Git Clone 指定自定义文件夹名称:详尽指南
  • 第 14 章 -Go语言 错误处理
  • Django5 2024全栈开发指南(一):框架简介、环境搭建与项目结构
  • uniapp 实现tabbar分类导航及滚动联动效果
  • 蓝桥杯-顺子日期
  • 使用 Go 实现将任何网页转化为 PDF
  • android 9 adb安装过程学习(三)
  • TS 函数及多态
  • Windows10-用户账户控制、Windows远程桌面
  • 解决:前端js下载文件流出现“未知文件格式”错误
  • C语言重点编程题——11-20
  • Android 编译系统AIDL模块couldn‘t find import for class错误
  • leetcode42接雨水问题
  • Javascript每天一道算法题(十八)——矩阵置零-中等
  • 带你用uniapp从零开发一个仿小米商场_10. 首页开发
  • MATLAB算法实战应用案例精讲-【图像处理】图像增强
  • go 在使用Elasticsearch 聚合查询时 如何设置使用中国时区
  • C语言第三十五弹---打印九九乘法表
  • 【JMeter】不同场景下的接口请求
  • Sass基础知识详细讲解【附带表图】
  • ubuntu22.04 安装 jupyterlab
  • C#中警告IDE0290、IDE1006、IDE1100、IDE0251、IDE0300及处理
  • flutter 输入框组件 高度问题
  • 大语言模型:以Amazon Titan等大语言模型为例介绍
  • Vue简易的车牌输入键盘,可以根据需要修改
  • 如何搭建zerotier服务器组网实现内网穿透