文章数量
36
访客量
4952
访问量
9817

css特效之火箭升空行驶效果

阅读量:322
更新时间:2023-12-19 09:32:42

效果预览:效果预览
源码下载:关注公众号【RMRF】,回复【css18】可获取源码

HTML

<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>火箭升空行驶效果</title>
  <link rel="stylesheet" href="./css/index.css">
</head>

<body>
  <div class="content">
    <img src="./images/rocket.png" alt="">
  </div>
</body>

</html>

CSS

* {
  padding: 0px;
  margin: 0px;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  width: 100vw;
  background-color: #202020;
}

.content {
  position: relative;
}

.content::after {
  content: '';
  position: absolute;
  left: calc(50% - 3px);
  bottom: -55px;
  height: 60px;
  width: 6px;
  background: #f07f63;
  border-radius: 10px;
  background: linear-gradient(to bottom, #f07f63, transparent 80%);
  filter: blur(1px);
}

img {
  height: 50px;
  animation: launch 0.1s infinite alternate;
}

@keyframes launch {
  from {
    margin-top: 0px;
  }

  to {
    margin-top: 4px;
  }
}