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

3D 环形旋转图片轮播(纯html,css,js)

<!DOCTYPE html>
<html lang="zh-CN">
<head><meta charset="UTF-8"><title>3D 环形旋转图片</title><style>body {margin: 0;height: 100vh;display: flex;align-items: center;justify-content: center;background: radial-gradient(circle at center, #111, #000);overflow: hidden;}.carousel {width: 400px;height: 300px;perspective: 1500px;}.ring {width: 100%;height: 100%;position: relative;transform-style: preserve-3d;animation: rotate 30s linear infinite;}.card {position: absolute;width: 280px;height: 200px;border-radius: 12px;overflow: hidden;box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 20px rgba(255,255,255,0.1);transition: transform 0.3s, box-shadow 0.3s;}.card img {width: 100%;height: 100%;object-fit: cover;display: block;}.card:hover {transform: scale(1.05) translateZ(500px);box-shadow: 0 20px 40px rgba(255, 255, 255, 0.4);}@keyframes rotate {from { transform: rotateY(0deg); }to   { transform: rotateY(-360deg); }}</style>
</head>
<body><div class="carousel"><div class="ring" id="ring"></div></div><script>const ring = document.getElementById("ring");const numCards = 8; const angle = 360 / numCards;const images = ["https://images.pexels.com/photos/414612/pexels-photo-414612.jpeg","https://images.pexels.com/photos/257360/pexels-photo-257360.jpeg","https://images.pexels.com/photos/34950/pexels-photo.jpg","https://images.pexels.com/photos/459225/pexels-photo-459225.jpeg","https://images.pexels.com/photos/207962/pexels-photo-207962.jpeg","https://images.pexels.com/photos/356378/pexels-photo-356378.jpeg","https://images.pexels.com/photos/158607/cairn-fog-mystical-background-158607.jpeg","https://images.pexels.com/photos/236047/pexels-photo-236047.jpeg"
];for (let i = 0; i < numCards; i++) {const card = document.createElement("div");card.className = "card";card.style.transform = `rotateY(${i * angle}deg) translateZ(500px)`;const img = document.createElement("img");img.src = images[i];card.appendChild(img);ring.appendChild(card);}</script>
</body>
</html>

http://www.xdnf.cn/news/1340065.html

相关文章:

  • 力扣hot100:无重复字符的最长子串,找到字符串中所有字母异位词(滑动窗口算法讲解)(3,438)
  • 从零开始理解 K 均值聚类:原理、实现与应用
  • 自学嵌入式第二十四天:数据结构(4)-栈
  • linux-ubuntu里docker的容器portainer容器建立后如何打开?
  • WSL的Ubuntu如何改名字
  • Ubuntu网络图标消失/以太网卡显示“未托管“
  • java项目:如何优化JVM参数?
  • nginx-自制证书实现
  • 读《精益数据分析》:精益画布——创业与产品创新的高效工具
  • 【工具】前端JS/VUE修改图片分辨率
  • 使用Docker部署Coze Studio开源版
  • Advanced Math Math Analysis |02 Limits
  • Oracle CLOB类型转换
  • k8s下的网络通信与认证
  • 【C++】模板(进阶)
  • 从YOLOv5到RKNN:零冲突转换YOLOv5模型至RK3588 NPU全指南
  • 在线课程|基于SprinBoot+vue的在线课程管理系统(源码+数据库+文档)
  • openEuler系统中如何将docker安装在指定目录
  • ES_文档
  • 【数据结构】树与二叉树:结构、性质与存储
  • 牛客:链表的回文结构详解
  • 牛客:链表分割算法详解
  • LeetCode100 -- Day3
  • C++---滑动窗口平滑数据
  • 深度学习之NLP基础
  • KB5063878补丁故障解决方案:从蓝屏幕到系统修复的全面指南
  • 短波红外科研相机:开启科研新视野的利器​
  • 【矩池云】实现Pycharm远程连接,上传数据并解压缩
  • C++入门自学Day16-- STL容器类型总结
  • 全文 part1 - DGEMM Using Tensor Cores, and Its Accurate and Reproducible Versions