码迷,mamicode.com
首页 > Web开发 > 详细

css3跳动的心制作

时间:2017-09-11 23:31:40      阅读:320      评论:0      收藏:0      [点我收藏+]

标签:padding   背景   转换   缩放   transform   ram   tom   href   margin   

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>心的跳动</title>
<link rel="stylesheet" type="text/css" href="css/love.css">
<script src="js/jquery.min.js"></script>
</head>
<body>
<div class="heart">
<div class="topLeft"></div>
<div class="topRight"></div>
<div class="bottom"></div>
</div>
</body>
</html>

css属性

* {
margin: 0;
padding: 0;
}
body {
width: 100%; /*如果要给背景加颜色或者图片必须把宽度设置为100%。*/
background-color: #000;
}
.heart {
margin: 100px auto;
width: 200px;
height: 200px;
position: relative;
animation-name: shake; /*为 @keyframes 动画规定一个名称*/
animation-duration: 0.5s; /*定义动画完成一个周期所需要的时间,以秒或毫秒计。*/
animation-iteration-count: infinite; /*定义动画的播放次数。infinite:无限次*/
}
.heart div {
width: 100%;
height: 100%;
position: absolute;
background: #f00;
animation-name: shadow;
animation-duration: 0.5s;
animation-iteration-count: infinite;
}
.topLeft,.topRight {
border-radius: 100px 100px 0 0; /*div左右的圆度*/
}
.topLeft {
transform: translate(-50px,0) rotate(-45deg);
/*transform:该属性允许我们对元素进行旋转、缩放、移动或倾斜。
translate:移动位置,rotate:旋转角度。*/
}
.topRight {
transform: translate(50px,0) rotate(45deg);
}
.bottom {
transform: translate(0,64px) rotate(45deg) scale(.9,.9); /*scale:定义 2D 缩放转换。*/
}

/*定义动画*/
@keyframes shake {
from {
transform:scale(.9,.9);
}
to {
transform:scale(1.1,1.1);
}
}
@keyframes shadow {
from {
}
to {
box-shadow:0px 0px 50px red; /*阴影*/
}
}

css3跳动的心制作

标签:padding   背景   转换   缩放   transform   ram   tom   href   margin   

原文地址:http://www.cnblogs.com/zy66blogs/p/7507871.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!