css钻石旋转实现:
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> <style type="text/css"> /* 钻石旋转 * 要实现这个钻石旋转: 首先需要明确这个钻石分为上下两个部分,上面包含六个正三角形,下面有6个倒三角形 * css实现正三角形:上右下左的方向 border-style: solid;border-color:transparent;border-width: 0 50px 170px 50px; border-bottom-color: rgba(255,0,0,0.5) * css实现倒三角形:上右下左的方向 border-style: solid;border-color:transparent;border-width: 170px 50px 0 50px; border-top-color: rgba(255,0,0,0.5) * 然后提供一个3D环境,给外层盒子添加 transform-style: preserve-3d;flat 所有的子元素在2D平面中;preserve-3D 所有的子元素 在3D 平面中 * 上面的三角形设置为绝对定位 absolute * 使用css3的transform 三角形按角度转动 排列成钻石的上半部分,同理实现下半部分 * rotateY:沿着Y轴实现旋转,translateZ:沿着Z轴移动88px;沿着X轴 旋转31度 * 写一个动画tuoluo 0~50%~100% 沿着z轴旋转 * 实现动画的循环播放animation: tuoluo 3s linear infinite; */ /*@keysframes*/ .wrap{ width: 200px; height: 400px; margin: 30px auto; } @keyframes tuoluo{ 0%{ transform: rotateY(0deg) rotateX(0deg); } 50%{ transform: rotateY(-180deg) rotateX(18deg); } 100%{ transform: rotateY(-360deg) rotateX(0deg); } } .wrap .tuoluo{ width: 100%; height: 100%; transform-style: preserve-3d; /* flat 所有的子元素在2D平面中*/ /* preserve-3D 所有的子元素 在3D 平面中*/ animation: tuoluo 3s linear infinite; } .wrap .tuoluo .tuoluo-top, .wrap .tuoluo .tuoluo-bottom{ position: relative; width: 100%; height: 50%; } .tuoluo-top .face-top{ position: absolute; top: 29px; width: 0; height: 0; border-style: solid; border-color: transparent; border-width: 0 50px 170px 50px; border-bottom-color: rgba(65,92,162,.5); /*元素变形基点的位置*/ transform-origin: center bottom; } .tuoluo-top .face-top:nth-of-type(1){ transform: rotateY(0deg) translateZ(88px) rotateX(31deg); } .tuoluo-top .face-top:nth-of-type(2){ transform: rotateY(60deg) translateZ(88px) rotateX(31deg); } .tuoluo-top .face-top:nth-of-type(3){ transform: rotateY(120deg) translateZ(88px) rotateX(31deg); } .tuoluo-top .face-top:nth-of-type(4){ transform: rotateY(180deg) translateZ(88px) rotateX(31deg); } .tuoluo-top .face-top:nth-of-type(5){ transform: rotateY(240deg) translateZ(88px) rotateX(31deg); } .tuoluo-top .face-top:nth-of-type(6){ transform: rotateY(300deg) translateZ(88px) rotateX(31deg); } .tuoluo-bottom .face-bottom{ position: absolute; width: 0; height: 0; border-style: solid; border-color: transparent; border-width: 170px 50px 0 50px; border-top-color: rgba(65,92,162,.5); /*元素变形基点的位置*/ transform-origin: center top; } .tuoluo-bottom .face-bottom:nth-of-type(1){ transform: rotateY(0deg) translateZ(88px) rotateX(-31deg); } .tuoluo-bottom .face-bottom:nth-of-type(2){ transform: rotateY(60deg) translateZ(88px) rotateX(-31deg); } .tuoluo-bottom .face-bottom:nth-of-type(3){ transform: rotateY(120deg) translateZ(88px) rotateX(-31deg); } .tuoluo-bottom .face-bottom:nth-of-type(4){ transform: rotateY(180deg) translateZ(88px) rotateX(-31deg); } .tuoluo-bottom .face-bottom:nth-of-type(5){ transform: rotateY(240deg) translateZ(88px) rotateX(-31deg); } .tuoluo-bottom .face-bottom:nth-of-type(6){ transform: rotateY(300deg) translateZ(88px) rotateX(-31deg); } </style> </head> <body> <p class="wrap"> <p class="tuoluo"> <p class="tuoluo-top"> <p class="face-top"></p> <p class="face-top"></p> <p class="face-top"></p> <p class="face-top"></p> <p class="face-top"></p> <p class="face-top"></p> </p> <p class="tuoluo-bottom"> <p class="face-bottom"></p> <p class="face-bottom"></p> <p class="face-bottom"></p> <p class="face-bottom"></p> <p class="face-bottom"></p> <p class="face-bottom"></p> </p> </p> </p> </body> </html>
以上是css实现钻石的旋转效果的详细内容。更多信息请关注PHP中文网其他相关文章!

在这篇文章中,布莱克·莫里(Blackle Mori)向您展示了一些骇客,同时试图推动同位HTML支持的极限。如果您敢于使用这些,以免您也被标记为CSS罪犯。

具有CSS的自定义光标很棒,但是我们可以将JavaScript提升到一个新的水平。使用JavaScript,我们可以在光标状态之间过渡,将动态文本放置在光标中,应用复杂的动画并应用过滤器。

互动CSS动画和元素相互启动的元素在2025年似乎更合理。虽然不需要在CSS中实施乒乓球,但CSS的灵活性和力量的增加,可以怀疑Lee&Aver Lee&Aver Lee有一天将是一场

有关利用CSS背景滤波器属性来样式用户界面的提示和技巧。您将学习如何在多个元素之间进行背景过滤器,并将它们与其他CSS图形效果集成在一起以创建精心设计的设计。

好吧,事实证明,SVG的内置动画功能从未按计划进行弃用。当然,CSS和JavaScript具有承载负载的能力,但是很高兴知道Smil并没有像以前那样死在水中

是的,让#039;跳上文字包装:Safari Technology Preview In Pretty Landing!但是请注意,它与在铬浏览器中的工作方式不同。

此CSS-tricks更新了,重点介绍了年鉴,最近的播客出现,新的CSS计数器指南以及增加了几位新作者,这些新作者贡献了有价值的内容。

在大多数情况下,人们展示了@Apply的@Apply功能,其中包括Tailwind的单个property实用程序之一(会改变单个CSS声明)。当以这种方式展示时,@Apply听起来似乎很有希望。如此明显


热AI工具

Undresser.AI Undress
人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover
用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool
免费脱衣服图片

Clothoff.io
AI脱衣机

Video Face Swap
使用我们完全免费的人工智能换脸工具轻松在任何视频中换脸!

热门文章

热工具

Atom编辑器mac版下载
最流行的的开源编辑器

SecLists
SecLists是最终安全测试人员的伙伴。它是一个包含各种类型列表的集合,这些列表在安全评估过程中经常使用,都在一个地方。SecLists通过方便地提供安全测试人员可能需要的所有列表,帮助提高安全测试的效率和生产力。列表类型包括用户名、密码、URL、模糊测试有效载荷、敏感数据模式、Web shell等等。测试人员只需将此存储库拉到新的测试机上,他就可以访问到所需的每种类型的列表。

Dreamweaver CS6
视觉化网页开发工具

SublimeText3汉化版
中文版,非常好用

DVWA
Damn Vulnerable Web App (DVWA) 是一个PHP/MySQL的Web应用程序,非常容易受到攻击。它的主要目标是成为安全专业人员在合法环境中测试自己的技能和工具的辅助工具,帮助Web开发人员更好地理解保护Web应用程序的过程,并帮助教师/学生在课堂环境中教授/学习Web应用程序安全。DVWA的目标是通过简单直接的界面练习一些最常见的Web漏洞,难度各不相同。请注意,该软件中