一个css3 旋转效果 -- 待续
<div class="container">
<div> <figure></figure> <figure></figure> <figure></figure> <figure></figure> </div>
<div><figure></figure><figure></figure><figure></figure><figure></figure></div>
<div><figure></figure><figure></figure><figure></figure><figure></figure></div>
</div>
<style>
*{
/* 3D 加速 */
transform-style:preserve-3d;
}
body{
background:black;
}
.container{
width:200px;
height:200px;
position:relative;
margin:200px auto; /* preserve-3d是在做3d转换的时候用到的,然后就会有Z轴的3d转换效果, 如果不设置或者设置成flat看到的只是一个平面上的变换 */ transform-style:preserve-3d;
}
.container div{
width:200px;
height:200px;
position:absolute;
} .container div:nth-child(1){
transform:rotateX(90deg);
} .container div:nth-child(2){
transform:rotateY(90deg);
} @keyframes rotate{
from{
transform: rotateY(0deg);
}
to{
transform: rotateY(360deg);
}
} /** 每个div 有4个 figure*/
figure{
width:100%;
height:100%;
margin:0;
position:absolute;
background:url(http://img.duoziwang.com/2016/09/02/15483442009.jpg) no-repeat; /**把背景图像扩展至足够大,以使背景图像完全覆盖背景区域。**/
background-size:cover;
} figure:nth-child(1){
/** 有些时候需要实现一些倒影的效果。比如说,你看到一个美女,
你想从另一个角度来看这个MM的风姿 。 **/
-webkit-box-reflect:above;
}
figure:nth-child(2){
/* 下倒影, 就像走在湖面上的效果 */ -webkit-box-reflect:below;
}
figure:nth-child(3){
-webkit-box-reflect:left;
}
figure:nth-child(4){
-webkit-box-reflect:right;
} body{
animation: rotate 2s linear infinite; transform-orgin:50% 200px;
} html{
overflow:hidden;
} </style>
<script> var div = document.querySelector('div');
var flag = false;// 是否启动拖拽 document.addEventListener('mousedown', function() {
flag = true; document.body.style.setProperty('animation-play-state', 'paused'); }, false); document.addEventListener('mouseup', function() {
flag = false; document.body.style.setProperty('animation-play-state', 'running'); }, false); document.addEventListener('mousemove', function move(e) {
if (!flag) {
move.lastX = e.x;
move.lastY = e.y;
return;
}
var transform = getComputedStyle(div).getPropertyValue('transform'); transform == 'none' && (transform = ''); div.style.setProperty('transform', transform + 'rotateX(' + (move.lastY - e.y) / 5 + 'deg) rotateY(' + (e.x - move.lastX) / 5 + 'deg)'); move.lastX = e.x; move.lastY = e.y; }, false); </script>
一个css3 旋转效果 -- 待续的更多相关文章
- JS判断浏览器是否支持某一个CSS3属性
1.引子 css3的出现让浏览器的表现更加的丰富多彩,表现冲击最大的就是动画了,在日常书写动画的时候,很有必要去事先判断浏览器是否支持,尤其是在写CSS3动画库的时候.比如transition的ani ...
- 判断浏览器是否支持某一个CSS3属性
判断浏览器是否支持某一个CSS3属性 function supportCss3(style) { var prefix = ['webkit', 'Moz', 'ms', 'o'], i, humpS ...
- css3 旋转效果加上双面显示效果
在学习Css3的过程中,我想做一个类似金字塔,菱形翻页效果,如图这种效果 如是,我自己设计了一个,不带js的旋转效果: 1>第一步我先设计了一个方块,内含一个旋转了45deg的小方块,代码如下: ...
- 一个CSS3滤镜Drop-shadow阴影效果
<html> <head> <title>CSS3 Drop-shadow阴影</title> <style type="text/cs ...
- 分享一个css3写的气泡对话框,适合于即时通讯和留言本的动态内容
效果预览: css code .message_content{width:100%;margin-top:10px;clear:both;float:left;} .face{float:left; ...
- 一个css3流程导图
这也是公司用到的,写个demo出来分享 <!DOCTYPE html> <html> <head> <meta http-equiv="Conten ...
- JS判断浏览器是否支持某一个CSS3属性的方法
var div = document.createElement('div'); console.log(div.style.transition); //如果支持的话, 会输出 "&quo ...
- 一个css3 DNA 效果
这个效果就是 不断沿 Y 轴旋转 <div id="container"></div> <style> body{ background:bla ...
- 分享一个css3学习使用的选择器手册
http://www.haorooms.com/tools/css_selecter/
随机推荐
- 129. Sum Root to Leaf Numbers(从根节点加到叶子节点的和)
Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a numb ...
- Android LCD
Android LCD(一):LCD基本原理篇Android LCD(二):LCD常用接口原理篇Android LCD(三):Samsung LCD接口篇Android LCD(四):LCD驱动调试篇
- 做Webservice时报错java.util.List是接口, 而 JAXB 无法处理接口。
Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExc ...
- js 前台ajax验证马克一下
function check_form(){ var email=$("#email").val(); var code=$("#code").val(); v ...
- sql行列互换
出现这个结果: sql如下: end) as erjidu from a GROUP BY y;
- 求职之路共分享——亲身面试题(一) 1/三层与MVC区别
转自http://www.cnblogs.com/ndxsdhy/archive/2011/08/04/2127908.html 觉得这篇文章挺容易理解的, http://www.cnblogs.co ...
- 给定字符串数组,用map的key保存数组中字符串元素,value保存字符串元素出现次数,最后统计个字符串元素出现次数
import java.util.HashMap; public class map1 { public static void main(String[] args) { String[] arra ...
- 指定library路径
1.执行 ?.jar文件: 1.1.“java -jar ?.jar” 1.2.如果 ?.jar里面使用了JNI调用了 ?.dll/?.so 等文件,可能会报错 找不到相关的 库文件,如果这样的话,可 ...
- Hyper:基于Hypervisor的容器化解决方案
近日,初创公司HyperHQ发布了他们的开源项目Hyper,Hyper是一个可以在hypervisor上运行Docker镜像的引擎,它融合了Docker容器和虚拟机的优点,旨在打造一个性能更好.更安全 ...
- 利用JS获取地址栏的中文参数
地址栏中为:localhost:22865/ZYHSYY.aspx?BQH=305&DoctorName=张三&DoctorId=100我想利用JS获取到“张三”,请问该如何写js?目 ...