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

CSS 3D动画,围绕旋转动画Demo

效果:

鼠标移入停止旋转移出继续旋转,这种效果有一个问题就是中心的图片层级较高,四周的小图片层级较低,小图片旋转至前面时会被中心的图片覆盖,所以鼠标移入移出时可能会选不中图片,会导致无法停止、继续播放动画需要注意!可以通过调整位置,错位的方式解决或者调整z-index属性层级显示。

<div class="content"><div class="skin_action"><div class="centerIcon"></div><div class="planet"><div class="ball ball1"></div><div class="ball ball2"></div><div class="ball ball3"></div><div class="ball ball4"></div></div></div>
</div>

CSS:

.skin_action{width: 50%;height: 87%;position: relative;left: 10%;top: 5%;
}
.centerIcon{width: 60%;height: 50%;background-image: url('/img/newLogin-centerIcon.png');background-size: 100% 100%;background-repeat: no-repeat;background-position: center;position: relative;z-index: 1;left: 20%;top: 13%;
}
.skin_action .planet {/*border: 2px solid #fff;*/width: 90%;height: 100%;transform-style: preserve-3d;animation: planet-rotate 30s linear infinite;position: relative;z-index: 0;top: -57%;left: 5%;
}
.skin_action .ball1 {width: 25%;height: 30%;left: 0%;top: 0%;cursor: pointer;position: absolute;background-image: url("/img/newLogin-ydhlIcon.png");background-size: 100% 100%;background-repeat: no-repeat;background-position: center;animation: ball1-rotate 30s linear infinite;
}
.skin_action .ball2 {width: 25%;height: 30%;left: 80%;top: 0%;cursor: pointer;position: absolute;background-image: url("/img/newLogin-xtszIcon.png");background-size: 100% 100%;background-repeat: no-repeat;background-position: center;animation: ball1-rotate 30s linear infinite;
}
.skin_action .ball3 {width: 25%;height: 30%;left: 0%;top: 80%;cursor: pointer;position: absolute;background-image: url("/img/newLogin-sbjkIcon.png");background-size: 100% 100%;background-repeat: no-repeat;background-position: center;animation: ball1-rotate 30s linear infinite;
}
.skin_action .ball4 {width: 25%;height: 30%;left: 80%;top: 70%;cursor: pointer;position: absolute;background-image: url("/img/newLogin-ztjcIcon.png");background-size: 100% 100%;background-repeat: no-repeat;background-position: center;animation: ball1-rotate 30s linear infinite;
}@keyframes planet-rotate {0% {transform: rotate(0deg) scaleY(0.5) rotate(0);}100% {transform: rotate(0deg) scaleY(0.5) rotate(360deg);}
}
@keyframes ball1-rotate {0% {transform: rotate(0) scaleY(2) rotate(0deg);}100% {transform: rotate(-360deg) scaleY(2) rotate(0deg);}}

JS:

    /*鼠标移入时暂停动画*/$(document).ready(function() {var $planet = $('.planet');var $boxes = $('.ball');// 鼠标移入时暂停动画$('.planet .ball,.planet').on('mouseenter', function() {$planet.css('animation-play-state', 'paused');$boxes.css('animation-play-state', 'paused');});// 鼠标移出时恢复动画$('.planet .ball,.planet').on('mouseleave', function() {$planet.css('animation-play-state', 'running');$boxes.css('animation-play-state', 'running');});});

http://www.dtcms.com/a/343019.html

相关文章:

  • 常见 Linux 网络命令梳理
  • AGV 技术落地场景解析:从制造业到仓储物流,看自动导引车的行业应用
  • 【Ruoyi解密-02.登录流程:】登录-找密码不抓瞎
  • 封装FTPSClient连接ftps服务器
  • 一个成熟的运维及售后岗位应掌握的知识体系详解
  • Linux动态库制作和使用
  • Manus AI 与多语言手写识别:技术、应用与未来
  • Nginx + Vue/React 前端 + API:防止路径混淆漏洞与跨域问题实战分享
  • [Mysql数据库] Mysql安全知识
  • Oracle ADG 切换方式详解:Switchover 与 Failover 操作指南
  • 〖领码方案〗前端 PageData 完整解决方案 第四版
  • 深度解析Structured Outputs:让AI输出严格遵循JSON Schema的结构化响应
  • 【日常学习】2025-8-21 了解些测试名词
  • 【GPT入门】第52课 openwebui安装与使用
  • Zynq中级开发七项必修课-第三课:S_AXI_GP0 主动访问 PS 地址空间
  • 通信算法之317:基于Xilinx FPGA平台的符号同步算法(接收序列与本地序列互相关-不共轭乘)
  • ODDR实现多bit单边沿采样数据转为多bit双沿采样数据
  • 前端-Vue笔记(核心语法)
  • linux内核 - 内存分配机制介绍
  • MySQL 8.4.6 LTS 安装教程 windows
  • 如何在mac玩windows游戏?3个工具推荐,不用换电脑!
  • MiniGPT-4
  • 在Excel和WPS表格中合并多个单元格这样最快
  • 第14章 结构和其他数据形式
  • 数据分类分级的关键难点以及应对之道
  • Go1.25的源码分析-src/runtime/runtime1.go(GMP)g
  • U盘安装 CentOS Stream 10 实战复盘:三大常见问题与解决方法
  • 通义千问VL-Plus:当AI“看懂”屏幕,软件测试的OCR时代正式终结!
  • Java 项目中 MySQL 数据向 Redis 迁移的技术实践与深度剖析
  • JVM 性能监控工具全解析:从命令行到可视化全方位指南