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

CSS 3D球形旋转

css+html即可实现3D球形旋转效果你敢信?你可以信!废话不多说,直接上代码!

<html>
<head>
</head>
<body>
<div id="box-preserve-3d">
    <div class="ball-center-x"></div>
    <div class="ball-center-x-one"></div>
    <div class="ball-center-x-two"></div>
    <div class="ball-center-x-three"></div>
    <div class="ball-center-x-four"></div>
    <div class="ball-center-x-five"></div>
    <div class="ball-center-y"></div>
    <div class="ball-center-y-one"></div>
    <div class="ball-center-y-two"></div>
    <div class="ball-center-y-three"></div>
    <div class="ball-center-y-four"></div>
    <div class="ball-center-y-five"></div>
    <div id="top">系</div>
    <div id="bottom">统</div>
    <div id="left">用</div>
    <div id="right">迎</div>
    <div id="front">欢</div>
    <div id="back">使</div>
</div>
<style>
    body{
        background:#000;
    }
    #box-perspective{
        width: 100px;height: 100px;margin: auto;margin-top: 50px;
        perspective: 800px;
        perspective-origin: 50% 50%;
    }
    #box-preserve-3d {
        position: absolute;
        width: 100px;height: 100px;
        transform-style: preserve-3d;
        margin: 20%;
    }
    #box-preserve-3d div {
        position: absolute;
        width: 100px;
        height: 100px;
        text-align: center;
        line-height: 100px;
    }
    .ball-center-x{
        border:1px solid red;
        border-radius: 100px;
        width: 200px;
        height: 200px;
        transform: rotateY(-90deg);
        transform-origin: 50% 50%;
    }
    .ball-center-x-one{
        border:1px solid green;
        border-radius: 100px;
        width: 200px;
        height: 200px;
        transform: rotateY(0deg);
        transform-origin: 50% 50%;
    }
    .ball-center-x-two{
        border:1px solid blue;
        border-radius: 100px;
        width: 200px;
        height: 200px;
        transform: rotateY(30deg);
        transform-origin: 50% 50%;
    }
    .ball-center-x-three{
        border:1px solid yellow;
        border-radius: 100px;
        width: 200px;
        height: 200px;
        transform: rotateY(60deg);
        transform-origin: 50% 50%;
    }
    .ball-center-x-four{
        border:1px solid yellow;
        border-radius: 100px;
        width: 200px;
        height: 200px;
        transform: rotateY(120deg);
        transform-origin: 50% 50%;
    }
    .ball-center-x-five{
        border:1px solid yellow;
        border-radius: 100px;
        width: 200px;
        height: 200px;
        transform: rotateY(150deg);
        transform-origin: 50% 50%;
    }
    .ball-center-y{
        border:1px solid pink;
        border-radius: 100px;
        width: 200px;
        height: 200px;
        transform: rotateX(90deg);
        transform-origin: 50% 50%;
    }
    .ball-center-y-one{
        border:1px solid purple;
        border-radius: 100px;
        width: 200px;height: 200px;
        transform: rotateX(0deg);
        transform-origin: 50% 50%;
    }
    .ball-center-y-two{
        border:1px solid cyan;
        border-radius: 100px;
        width: 200px;height: 200px;
        transform: rotateX(30deg);
        transform-origin: 50% 50%;
    }
    .ball-center-y-three{
        border:1px solid orange;
        border-radius: 100px;
        width: 200px;height: 200px;
        transform: rotateX(60deg);
        transform-origin: 50% 50%;
    }
    .ball-center-y-four{
        border:1px solid orange;
        border-radius: 100px;
        width: 200px;height: 200px;
        transform: rotateX(120deg);
        transform-origin: 50% 50%;
    }
    .ball-center-y-five{
        border:1px solid orange;
        border-radius: 100px;
        width: 200px;height: 200px;
        transform: rotateX(150deg);
        transform-origin: 50% 50%;
    }
    #box-perspective{
        width: 100px;height: 100px;margin-left: 260px;margin-top: 222px;
        perspective: 800px;
        perspective-origin: 50% 50%;
    }
    #box-preserve-3d {
        position: absolute;
        width: 100px;height: 100px;
        transform-style: preserve-3d;
    }
    #box-preserve-3d div {
        position: absolute;
        width: 100px;
        height: 100px;
        text-align: center;
        line-height: 100px;
        color: white;
        font-size: 26px;
    }
    #top{
        /*background-image: url('../images/top.png');*/
        background-size: 100px;
        background: red;
        transform: rotateX(90deg) translateZ(100px);
        transform-origin: 50% 50%;
    }
    #bottom{
        /*background-image: url('../images/top.png');*/
        background-size: 100px;
        background: red;
        transform: rotateX(-90deg) translateZ(100px);
        transform-origin: 50% 50%;
    }
    #left{
        /*background-image: url('../images/left.png');*/
        background-size: 100px;
        background: red;
        transform: rotateY(90deg) translateZ(100px);
        transform-origin: 50% 50%;
    }
    #right{
        /*background-image: url('../images/left.png');*/
        background-size: 100px;
        background: red;
        transform: rotateY(-90deg) translateZ(100px);
        transform-origin: 50% 50%;
    }
    #front{
        /*background-image: url('../images/front.png');*/
        background-size: 100px;
        background: red;
        transform: translateZ(100px);
        transform-origin: 50% 50%;
    }
    #back{
        /*background-image: url('../images/front.png');*/
        background-size: 100px;
        background: red;
        transform: translateZ(-100px) rotateY(-180deg);
        transform-origin: 50% 50%;
    }

    @keyframes turn3d {
        0% { transform: rotateY(0) rotateX(0deg); }
        100% { transform: rotateY(360deg) rotateX(360deg); }
    }

    #box-preserve-3d {
        animation: turn3d 10s infinite linear;
    }
    .loginbox{
        position: fixed;
        width: 455px;
        top: 15%;
        right: 25%;
    }
    .loginbox>div{
        background-color: white;
        border-radius: 4px;
        box-shadow: 5px 5px 20px #4444;
        padding: 20px;
    }
</style>
</body>
</html>

 


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

相关文章:

  • RocketMQ文件刷盘机制深度解析与Java模拟实现
  • 对抗样本存在的原因
  • Linux驱动开发快速入门——字符设备驱动(直接操作寄存器设备树版)
  • DataWorks快速入门
  • 网络安全,文明上网(6)网安相关法律
  • Matlab科研绘图:自定义内置多款配色函数
  • shell脚本2---清风
  • StructRAG Boosting Knowledge 论文笔记
  • Genuine-OJ 是一个现代化的在线评测系统(Online Judge, OJ)
  • 计算机毕业设计 | SpringBoot+vue汽车资讯网站 汽车购买咨询管理系统(附源码+论文)
  • Android开发实战班 -应用架构 - MVVM 架构模式
  • TCP Analysis Flags 之 TCP Dup ACK
  • delphi fmx android 离线人脸识别
  • LLaMA-Factory 上手即用教程
  • 循环结构程序设计
  • 【C++】深入理解 C++ 优先级队列、容器适配器与 deque:实现与应用解析
  • 优选算法(双指针)
  • 一篇快速上手 Axios,一个基于 Promise 的网络请求库(涉及原理实现)
  • vue3教程:快速搭建Vue3项目
  • GLM4 PyTorch模型微调最佳实践
  • 第十种Prompt 框架-MASTER
  • ES6 (MNO-eUICC) 接口中 OTA 平台通信概述
  • DTH11传感器温度湿度+esp8266+阿里云+小程序
  • 对基因列表中批量的基因进行GO和KEGG注释
  • 小程序租赁系统开发为企业提供高效便捷的租赁服务解决方案
  • Sourcetree登录GitLab账号