当前位置: 首页 > 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.dtcms.com/a/342345.html

相关文章:

  • Docker:安装配置
  • Unity编辑器相关
  • 类加载问题与内存泄漏排查:隐藏在元数据区的致命陷阱
  • electron-vite_18Less和Sass共用样式指定
  • 超级 APP:重构多平台运营生态,一站式解决用户与商家痛点
  • Java性能优化:JVM工具与Tomcat调优实战
  • 批量收藏Chrome浏览器中打开的多个标签页快捷方法
  • 12_Go语言项目架构与工程实践
  • 手机惊魂
  • 《用餐》,午餐食堂即景小诗分享(手机/小视频/光盘/养生)
  • mysql第四章使用DQL命令查询数据(二)
  • MinerU:重新定义PDF智能提取的开源利器
  • PDF翻译软件哪个好?用对工具翻译无障碍
  • 计算机视觉第一课opencv(三)保姆级教学
  • 微信小程序基础Day1
  • Ubuntu 22.04 安装tensorrt
  • Building Systems with the ChatGPT API 使用 ChatGPT API 搭建系统(第五章学习笔记及总结)
  • Vue3源码reactivity响应式篇之Map、Set等代理处理详解
  • OpenCVSharp 核心功能模块详解:从基础操作到实战应用
  • 2025-08-21 Python进阶5——类和对象
  • Visual Studio 在机台上远程调试详细教程
  • LeetCode 反转链表
  • imx6ull-驱动开发篇33——platform 平台驱动模型
  • 【运维进阶】Shell 变量
  • Docker--Docker网络
  • 【学习笔记】网络安全专用产品类别与参考标准
  • 【问题思考】二分查找对比三分查找(任意点查找)的优越性(熵的角度)【gemini完成】
  • 语义分割开山之作:FCN网络从入门到精通
  • 概率论基础教程第5章 连续型随机变量(三)
  • 【复杂网络技术】什么是图神经网络?