html_css模拟端午赛龙舟运动

简介: html_css模拟端午赛龙舟运动

⭐前言

大家好,我是yma16,本期给大家分享css实现赛龙舟运动。

💖 样式布局

风格:卡通

首先采用一张包括水元素的照片作为背景

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>annimation</title>
    <style>
      * {
        margin: 0;
        padding: 0;
      }
      body {
        width: 100vw;
        height: 100vh;
        background: url(./background.jpg);
        background-repeat: no-repeat;
        background-size: cover;
        display: grid;
        grid-template: 1fr/1fr;
      }
    </style>
  </head>
  <body>
  </body>
</html>

背景图和龙舟的布局

💖 添加龙舟

使用ul的li元素配置龙舟属性添加龙舟图片

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>annimation</title>
    <style>
      * {
        margin: 0;
        padding: 0;
      }
      body {
        width: 100vw;
        height: 100vh;
        background: url(./background.jpg);
        background-repeat: no-repeat;
        background-size: cover;
        display: grid;
        grid-template: 1fr/1fr;
      }
      .box {
        margin: 0 auto;
      }
      ul {
        display: block;
        position: absolute;
        top: 300px;
        left:0;
      }
      li {
        text-align: center;
        color: #000;
        line-height: 80px;
        text-transform: uppercase;
        height: 80px;
        width: 200px;
        opacity: 1;
        color: #fff;
      }
      .li-boat {
        height: 300px;
        width: 300px;
        background: url(./boat.png);
        background-repeat: no-repeat;
        background-size: cover;
      }
    </style>
  </head>
  <body>
    <div class='box'>
      <ul>
        <li>
          <div class="li-boat"></div>
        </li>
        <li>
          <div class="li-boat"></div>
        </li>
        <li>
          <div class="li-boat"></div>
        </li>
        <li>
          <div class="li-boat"></div>
        </li>
        <li>
          <div class="li-boat"></div>
        </li>
      </ul>
    </div>
  </body>
</html>

💖 添加css_animation运动

水平移动

@keyframes move {
  from {
    transform: translateX(0vh);
  }
  to {
    transform: translateX(80vh);
  }
}
li:nth-child(1) {
  animation-timing-function: ease;
}
li:nth-child(2) {
  animation-timing-function: ease-in;
}
li:nth-child(3) {
  animation-timing-function: ease-in-out;
}
li:nth-child(4) {
  animation-timing-function: ease-out;
}
li:nth-child(5) {
  animation-timing-function: linear;
}

完整的代码如下

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>annimation</title>
    <style>
      * {
        margin: 0;
        padding: 0;
      }
      body {
        width: 100vw;
        height: 100vh;
        background: url(./background.jpg);
        background-repeat: no-repeat;
        background-size: cover;
        display: grid;
        grid-template: 1fr/1fr;
      }
      .box {
        margin: 0 auto;
      }
      ul {
        display: block;
        position: absolute;
        top: 300px;
        left: 0;
      }
      li {
        text-align: center;
        color: #000;
        line-height: 80px;
        text-transform: uppercase;
        height: 80px;
        width: 200px;
        animation-name: move;
        animation-duration: 12s;
        animation-iteration-count: infinite;
        transform: translateY(80vh);
        opacity: 1;
        color: #fff;
      }
      .li-boat {
        height: 300px;
        width: 300px;
        background: url(./boat.png);
        background-repeat: no-repeat;
        background-size: cover;
      }
      @keyframes move {
        from {
          transform: translateX(0vh);
        }
        to {
          transform: translateX(150vh);
        }
      }
      li:nth-child(1) {
        animation-timing-function: ease;
      }
      li:nth-child(2) {
        animation-timing-function: ease-in;
      }
      li:nth-child(3) {
        animation-timing-function: ease-in-out;
      }
      li:nth-child(4) {
        animation-timing-function: ease-out;
      }
      li:nth-child(5) {
        animation-timing-function: linear;
      }
      .title{
        width:auto;
        height: 50px;
        text-align: center;
        margin: 0 auto;
        color: rgb(89, 114, 189);
        background: #fff;
        font-size: 32px;
        font-weight: bold;
      }
    </style>
  </head>
  <body>
    <div class='title'>
      <img src="boat.png" height="30px"/>端午节赛龙舟活动<img src="boat.png" height="30px"/>
      </div>
    <div class='box'>
      <ul>
        <li>
          <div class="li-boat"></div>
        </li>
        <li>
          <div class="li-boat"></div>
        </li>
        <li>
          <div class="li-boat"></div>
        </li>
        <li>
          <div class="li-boat"></div>
        </li>
        <li>
          <div class="li-boat"></div>
        </li>
      </ul>
    </div>
  </body>
</html>

效果如下

inscode的代码如下

⭐结束

本文分享结束!

💖感谢你的阅读💖

如有更好的意见欢迎指出!


目录
打赏
0
1
1
0
52
分享
相关文章
css_animation运动的贝塞尔曲线
css_animation运动的贝塞尔曲线
54 0
《HTML5+JavaScript动画基础》——1.2 帧与运动
自然,这是有代价的。随着系统变得越来越大,规则变得越来越复杂,电脑必须能够迅速地计算出下一份图像描述,并将其显示出来。如果你想保持一定的帧率,那么给予电脑的处理时间(毫秒级)就极其有限。如果电脑无法及时完成计算,帧率就会下降
1859 0
css 运动背景
css 运动背景原理: animation-name: bgmove;animation-duration: 100s; animation-timing-function: linear; animation-delay: 0; animation-iteration-count: infinite; animation介绍: 属性 描述 animation 指定定义所有动画属性(除了 animation-play-state 外)的速记值。
896 0
抖音快手小红书虚拟评论截图生成器,模拟对话制作工具,html+js+css
这是一款纯前端实现的多平台虚拟评论生成器,支持抖音、快手、小红书风格,适用于产品演示与UI设计。采用Vanilla JS与Flexbox布局,利用IndexedDB存储数据,CSS Variables切换主题。
病历单生成器在线制作,病历单生成器app,HTML+CSS+JS恶搞工具
本项目为医疗病历模拟生成器,旨在为医学教学和软件开发测试提供数据支持,严格遵守《医疗机构病历管理规定》。
仿真银行app下载安装, 银行卡虚拟余额制作app,用html+css+js实现逼真娱乐工具
这是一个简单的银行账户模拟器项目,用于学习前端开发基础。用户可进行存款、取款操作,所有数据存储于浏览器内存中
制作b超单生成器, 假怀孕b超单图片制作, p图医院证明【css+html+js装逼恶搞神器】
本资源提供一个适合用于熟人之间恶搞的工具,效果逼真,仅供学习参考与娱乐。包含前端技术学习要点:语义化布局、响应式设计、Flexbox、图片自适应

热门文章

最新文章

AI助理

你好,我是AI助理

可以解答问题、推荐解决方案等

登录插画

登录以查看您的控制台资源

管理云资源
状态一览
快捷访问