css实现汽车行驶动画效果代码

代码语言:html

所属分类:动画

代码描述:css实现汽车行驶动画效果代码

代码标签: 行驶 动画 效果

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> 
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
    body{
	margin:0;
	color:#444;
	background:#00c380;
	font:300 18px/18px Roboto, sans-serif;
}
*,:after,:before{box-sizing:border-box}
.pull-left{float:left}
.pull-right{float:right}
.clearfix:after,.clearfix:before{content:'';display:table}
.clearfix:after{clear:both;display:block}

body{text-align:center;padding:80px;padding-top: 0;overflow:hidden}

.car .mirror-wrap:before,
.car .mirror-wrap:after,
.car .mirror-inner:before,
.car .mirror-inner:after,
.car .middle .top:before,
.car .middle .top:after,
.car .lights:before,
.car .lights:after,
.car .bumper .top:before,
.car .bumper .top:after,
.car .bumper .middle:before,
.car .tyres .tyre:before,
.car .tyres .tyre:after
{
	content:'';
	position:absolute;
}
.car{
	z-index:1;
	margin:0 auto;
	position:relative;
	display:inline-block;
}
.car .body{
	z-index:1;
	position:relative;
	-webkit-animation:suspension 4s linear infinite;
	        animation:suspension 4s linear infinite;
}
.car .mirror-wrap{
	width:88px;
	height:30px;
	margin:auto;
	position:relative;
	background-color:#fff;
	border-top-left-radius:45px 10px;
	border-top-right-radius:45px 10px;
}
.car .mirror-wrap:before,
.car .mirror-wrap:after{
	top:8px;
	border:5px solid #1a1c20;
	border-top:15px solid transparent;
}
.car .mirror-wrap:before{
	left:-5px;
	border-left:0 solid transparent;
}
.car .mirror-wrap:after{
	right:-5px;
	border-right:0 solid transparent;
}
.car .mirror-inner{
	top:2px;
	width:inherit;
	height:inherit;
	margin:inherit;
	position:inherit;
	background-color:#1a1c20;
	border-top-left-radius:50px 8px;
	border-top-right-radius:50px 8px;
}
.car .mirror-inner:before,
.car .mirror-inner:after{
	bottom:0;
	width:10px;
	height:8px;
	background-color:#252525;
}
.car .mirror-inner:before{
	left:-12px;
	border-radius:2px 0 0 5px;
}
.car .mirror-inner:after{
	right:-12px;
	border-radius:0 2px 5px 0;
}
.car .mirror{
	width:100%;
	z-index:10;
	height:25px;;
	overflow:hidden;
	position:relative;
	border-top-left-radius:45px 10px;
	border-top-right-radius:45px 10px;
}
.car .mirror .shine{
	left:50%;
	width:5px;
	z-index:-1;
	height:40px;
	position:absolute;
	margin-left:-2.5px;
	background-color:#3d3e3e;
	-webkit-animation:shine 4s linear infinite;
	        animation:shine 4s linear infinite;
}
.car .middle{
	z-index:1;
	margin-top:-2px;
}
.car .middle .top{
	width:98px;
	height:14px;
	margin:auto;
	position:relative;
	background-color:#f7f7f7;
}
.car .middle .top:before,
.car .middle .top:after{
	top:0;
	border:5px solid #f7f7f7;
	border-top:9px solid transparent;
}
.car .middle .top:before{
	left:-7px;
	border-left:2px solid transparent;
}
.car .middle .top:after{
	right:-7px;
	border-right:2px solid transparent;
}
.car .middle .top .line{
	top:2px;
	height:1px;
	width:44px;
	margin:auto;
	position:relative;
	background-color:#bebebe;
}
.car .middle .bottom{
	margin:auto;
	width:115px;
	height:20px;
	margin-top:-2px;
	background-color:#dfdfdf;
	border-top-left-radius:4px 5px;
	border-top-right-radius:4px 5px;
}
.car .lights{
	top:5px;
	width:111px;
	height:12px;
	margin:auto;
	position:relative;
	border-radius:2px;
	background-color:#6a6a6a;
}
.car .lights:before,
.car .lights:after{
	top:50%;
	width:16px;
	height:16px;
	margin-top:-8px;
	border-radius:50%;
	background-color:#fff;
	border:1px solid #777;
}
.car .lights:before{left:3px}
.car .lights:after{right:3px}
.car .lights .line{
	top:50%;
	left:50%;
	width:50%;
	height:1px;
	background:#fff;
	position:absolute;
	-webkit-transform:translateX(-50%);
	        transform:translateX(-50%);
}
.car .bumper .top{
	width:110px;
	height:10px;
	margin:auto;
	position:relative;
	background-color:#202428;
	border-radius:0 0 6px 6px;
	border-top:1px solid #474949;
	border-bottom:1px solid #474949;
}
.car .bumper .top:before,
.car .bumper .top:after{
	top:50%;
	width:10px;
	height:4px;
	margin-top:-2px;
	border-radius:1px;
	background-color:#FB8C00;
}
.car .bumper .top:before{left:5px}
.car .bumper .top:after{right:5px}
.car .bumper .middle{
	height:8px;
	width:102px;
	margin:auto;
	position:relative;
	background-color:#cfcfcf;
	border-radius:0 0 6px 6px;
}
.car .bumper .middle:before{
	top:50%;
	left:50%;
	color:#fff;
	height:12px;
	font-size:8px;
	padding:1px 4px;
	font-weight:500;
	margin-top:-6px;
	line-height:10px;
	text-align:center;
	white-space:nowrap;
	content:attr(data-numb);
	background-color:#E9573F;
	-webkit-transform:translateX(-50%);
	        transform:translateX(-50%);
}
.car .bumper .bottom{
	height:6px;
	width:85px;
	margin:auto;
	position:relative;
	background-color:#202428;
	border-radius:0 0 6px 6px;
	box-shadow:0 1px 11px rgba(0,0,0,.75);
}
.car .tyres{
	margin:auto;
	width:110px;
	position:relative;
}
.car .tyres .tyre{
	width:100%;
	height:40px;
	bottom:-6.5px;
	position:absolute;
}
.car .tyres .tyre:before{
	left:-5px;
	box-shadow:-2px 2px 0 #b7b7b8 inset;
}
.car .tyres .tyre:after{
	right:-5px;
	box-shadow:2px 2px 0 #b7b7b8 inset;
}
.car .tyres .tyre:before,
.car .tyres .tyre:after{
	width:18px;
	height:40px;
	border-radius:6px;
	background-color:#1a1c20;
	background:-webkit-linear-gradient(left,#333 50%,#555 50%);
	background:linear-gradient(to right,#333 50%,#555 50%);
	background-size:2px;
}
.car .tyres .tyre.back:before,
.car .tyres .tyre.back:after{bottom:3px}
.car .tyres .tyre..........完整代码请登录后点击上方下载按钮下载查看

网友评论0