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>
<div class="wrap">
<div class="tuoluo">
<div class="tuoluo-top">
<div class="face-top"></div>
<div class="face-top"></div>
<div class="face-top"></div>
<div class="face-top"></div>
<div class="face-top"></div>
<div class="face-top"></div>
</div>
<div class="tuoluo-bottom">
<div class="face-bottom"></div>
<div class="face-bottom"></div>
<div class="face-bottom"></div>
<div class="face-bottom"></div>
<div class="face-bottom"></div>
<div class="face-bottom"></div>
</div>
</div>
</div>
</body>
</html>

  

css钻石旋转实现的更多相关文章

  1. CSS之旋转立方体

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  2. css做旋转相册效果

    css做旋转相册效果 <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> &l ...

  3. js+css立体旋转

    纯 CSS3 制作可口可乐罐  这个效果相信大家很多人看过了,纯css实现的立体可口可乐罐,看起来相当高大上~ 于是今天我这小菜鸟试着研究下,稍微遗憾的是,没有看到源码,还是直接F12吧,貌似实现也不 ...

  4. CSS 3D旋转 hover 后设置transform 是相对于正常位置

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  5. css transform旋转属性

    将以下代码复制到本地就可以看到效果: <!DOCTYPE html> <html lang="en"> <head> <meta char ...

  6. CSS transform旋转问题

    我们都知道css的transform可以让旋转多少角度:transform:rotate(90deg),但是设置后只能旋转一次,如何想让它一直旋转下去怎么办?一种是使用matrix属性获取当前tran ...

  7. css制作旋转风车(transform 篇)

    做这个案例之前首先要大概了解CSS的transform的属性 transform 属性向元素应用 2D 或 3D 转换.该属性允许我们对元素进行旋转.缩放.移动或倾斜. 看看效果图 打开的时候自动旋转 ...

  8. CSS色调旋转滤镜

    一 关于filter 首先看一下官方对于CSS的filter属性的定义: CSS属性将模糊或颜色偏移等图形效果应用于元素.滤镜通常用于调整图像,背景和边框的渲染. 本文主要讲的是filter中的一个属 ...

  9. 个人制作-css+html旋转立方体的制作

    源代码: <!DOCTYPE html><html><head>    <title></title>    <meta charse ...

随机推荐

  1. 项目一:第一天 1、项目概述 2、环境搭建(重点) 3、Jquery Easyui 前端UI框架 4、Jquery Ztree 树形插件使用

    1.项目环境 注:添加jar包直接在common_parent里面添加. 搭建数据库 create tablespace bos317space datafile 'c:\ bos317.dbf'   ...

  2. 树莓派 Learning 002 装机后的必要操作 --- 04 添加软件源 之 添加公钥 --- 解决“由于没有公钥,无法验证下列签名”问题

    树莓派 装机后的必要操作 - 添加软件源 解决 添加公钥 时会遇到的问题 当你添加完Debian的软件源后,在终端中执行sudo apt-get update时,会出现下面的错误:(这里我添加了3个软 ...

  3. ubuntu server usb安装盘制作问题

    本来服务器上装的是windows server 2003,开多个虚拟机装linux来用,但发现不管是vmware还是virtualbox,总是有内存泄漏,大约2个星期左右16G内存就全没了,任务管理器 ...

  4. 【机器学习】分类器组合——AdaBoost

    AdaBoost是一种迭代算法,其核心思想是针对同一个训练集训练不同的分类器(弱分类器),然后把这些弱分类器集合起来,构成一个更强的最终分类器(强分类器). AdaBoost其实只是boost的一个特 ...

  5. Windows使用Github

    首先,你需要执行下面两条命令,作为 git 的基础配置,作用是告诉 git 你是谁,你输入的信息将出现在你创建的提交中. git config --global user.name "你的名 ...

  6. 2. Web渗透测试中常见逻辑漏洞解析与实战

    注:以下漏洞示例已由相关厂商修复,切勿非法测试! 0x01 漏洞挖掘 01  注册 注册中最常见的有两个,一个是恶意注册,另一个是账户遍历.一个好的注册界面应该是这样 或者这样的 而不是这样的 要么使 ...

  7. HBase表数据分页处理

    HBase表数据分页处理 HBase是Hadoop大数据生态技术圈中的一项关键技术,是一种用于分布式存储大数据的列式数据库,关于HBase更加详细的介绍和技术细节,朋友们可以在网络上进行搜寻,笔者本人 ...

  8. 序列化 (C#)

    序列化是指将对象转换成字节流,从而存储对象或将对象传输到内存.数据库或文件的过程. 它的主要用途是保存对象的状态,以便能够在需要时重新创建对象. 反向过程称为"反序列化". 序列化 ...

  9. Boost Python学习笔记(五)

    你将学到什么 在C++中调用Python代码时的返回值问题 基础类型 修改Python脚本(build/zoo.py) def rint(): return 2 def rstr(): return ...

  10. [Java]构造函数内部多态的行为所引起的灾难

    构造函数内部的多态行为所产生的意想不到的结果 一.Java版本 1 package com.company; 2 import static com.brianyi.util.Print.*; 3 4 ...