获得徽章 0
赞了这篇文章
赞了这篇沸点
使用css3绘制在道路上行驶的汽车动画特效
"```html
<!DOCTYPE html>
<html lang=\"en\">
<head>
<meta charset=\"UTF-8\">
<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">
<title>汽车行驶动画</title>
<style>
body {
background-color: #87CEEB; /* 天空颜色 */
margin: 0;
overflow: hidden;
}
.road {
position: absolute;
width: 100%;
height: 200px;
bottom: 0;
background-color: #333; /* 道路颜色 */
}
.car {
position: absolute;
width: 100px;
height: 50px;
background-color: red; /* 汽车颜色 */
border-radius: 10px;
animation: drive 5s linear infinite; /* 动画效果 */
}
@keyframes drive {
0% {
left: -100px; /* 从屏幕外开始 */
}
100% {
left: 100%; /* 向右移动到屏幕外 */
}
}
</style>
</head>
<body>
<div
"```html
<!DOCTYPE html>
<html lang=\"en\">
<head>
<meta charset=\"UTF-8\">
<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">
<title>汽车行驶动画</title>
<style>
body {
background-color: #87CEEB; /* 天空颜色 */
margin: 0;
overflow: hidden;
}
.road {
position: absolute;
width: 100%;
height: 200px;
bottom: 0;
background-color: #333; /* 道路颜色 */
}
.car {
position: absolute;
width: 100px;
height: 50px;
background-color: red; /* 汽车颜色 */
border-radius: 10px;
animation: drive 5s linear infinite; /* 动画效果 */
}
@keyframes drive {
0% {
left: -100px; /* 从屏幕外开始 */
}
100% {
left: 100%; /* 向右移动到屏幕外 */
}
}
</style>
</head>
<body>
<div
展开
4
2
赞了这篇沸点
赞了这篇文章
![[石化]](http://lf-web-assets.juejin.cn/obj/juejin-web/xitu_juejin_web/img/jj_emoji_73.55516c0.png)
![[不失礼貌的微笑]](http://lf-web-assets.juejin.cn/obj/juejin-web/xitu_juejin_web/img/jj_emoji_16.9d17f6d.png)