更新第27个小实例
|
@ -30,4 +30,5 @@
|
|||
23. HTML5+CSS3小实例之简单好玩的水球加载效果
|
||||
24. HTML5+CSS3小实例之酷炫的ANIPLEX文字特效
|
||||
25. HTML5+CSS3小实例之后台管理系统的侧边导航栏
|
||||
26. HTML5+CSS3小实例之自定义滤镜实现液体加载动画
|
||||
26. HTML5+CSS3小实例之自定义滤镜实现液体加载动画
|
||||
27. HTML5+CSS3小实例之3D旋转木马相册
|
|
@ -0,0 +1,78 @@
|
|||
*{
|
||||
/* 初始化 取消页面的内外边距 */
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
body{
|
||||
/* 弹性布局 水平、垂直居中 */
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
/* 100%窗口高度 */
|
||||
height: 100vh;
|
||||
background-color: #000;
|
||||
/* 视距 让元素看起来更有3D效果 */
|
||||
perspective: 900px;
|
||||
}
|
||||
section{
|
||||
position: relative;
|
||||
width: 200px;
|
||||
height: 300px;
|
||||
/* 让其子元素位于3D空间中 */
|
||||
transform-style: preserve-3d;
|
||||
/* 接下来执行动画 */
|
||||
/* 动画名称 时长 线性的 无限次播放 */
|
||||
animation: rotate 20s linear infinite;
|
||||
}
|
||||
section:hover{
|
||||
/* 鼠标移上动画暂停 */
|
||||
animation-play-state: paused;
|
||||
}
|
||||
section div{
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
text-align: center;
|
||||
/* 设置元素的倒影效果,below是倒影效果在元素下方,15px是元素和倒影的距离,后面的属性是设置倒影渐变 */
|
||||
-webkit-box-reflect: below 15px -webkit-linear-gradient(transparent 50%,rgba(255,255,255,0.3));
|
||||
}
|
||||
section div img{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
section div:nth-child(1){
|
||||
transform: rotateY(0deg) translateZ(300px);
|
||||
}
|
||||
section div:nth-child(2){
|
||||
transform: rotateY(45deg) translateZ(300px);
|
||||
}
|
||||
section div:nth-child(3){
|
||||
transform: rotateY(90deg) translateZ(300px);
|
||||
}
|
||||
section div:nth-child(4){
|
||||
transform: rotateY(135deg) translateZ(300px);
|
||||
}
|
||||
section div:nth-child(5){
|
||||
transform: rotateY(180deg) translateZ(300px);
|
||||
}
|
||||
section div:nth-child(6){
|
||||
transform: rotateY(225deg) translateZ(300px);
|
||||
}
|
||||
section div:nth-child(7){
|
||||
transform: rotateY(270deg) translateZ(300px);
|
||||
}
|
||||
section div:nth-child(8){
|
||||
transform: rotateY(315deg) translateZ(300px);
|
||||
}
|
||||
|
||||
/* 定义旋转动画 */
|
||||
@keyframes rotate {
|
||||
0%{
|
||||
transform: rotateY(0deg);
|
||||
}
|
||||
100%{
|
||||
transform: rotateY(360deg);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no">
|
||||
|
||||
<title>3D旋转木马相册</title>
|
||||
<link rel="stylesheet" href="../css/27.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<section>
|
||||
<div><img src="../images/op/1.jpg" alt=""></div>
|
||||
<div><img src="../images/op/2.jpg" alt=""></div>
|
||||
<div><img src="../images/op/3.jpg" alt=""></div>
|
||||
<div><img src="../images/op/4.jpg" alt=""></div>
|
||||
<div><img src="../images/op/5.jpg" alt=""></div>
|
||||
<div><img src="../images/op/6.jpg" alt=""></div>
|
||||
<div><img src="../images/op/7.jpg" alt=""></div>
|
||||
<div><img src="../images/op/8.jpg" alt=""></div>
|
||||
</section>
|
||||
</body>
|
||||
|
||||
</html>
|
After Width: | Height: | Size: 211 KiB |
After Width: | Height: | Size: 216 KiB |
After Width: | Height: | Size: 238 KiB |
After Width: | Height: | Size: 244 KiB |
After Width: | Height: | Size: 178 KiB |
After Width: | Height: | Size: 40 KiB |
After Width: | Height: | Size: 37 KiB |
After Width: | Height: | Size: 223 KiB |