首页 > 其他分享 >前端(动态雪景背景+动态蝴蝶)

前端(动态雪景背景+动态蝴蝶)

时间:2024-04-03 23:59:25浏览次数:20  
标签:蝴蝶 100% animation transform snow 雪景 动态 top left

 

1.CSS样式

<style>
    html, body, a, div, span, table, tr, td, strong, ul, ol, li, h1, h2, h3, p, input {
      font-weight: inherit;
      font-size: inherit;
      list-style: none;
      border-spacing: 0;
      border: 0;
      border-collapse: collapse;
      text-decoration: none;
      padding: 0;
      margin: 0;
    }
    html, body {
      font-family: "Segoe UI",Segoe,Tahoma,Arial,Verdana,sans-serif;
      background-color: #3D69A4;
      overflow: hidden;
      padding: 0;
      margin: 0;
      width: 100%;
      height: 100%;
    }
    .snow .snow_slice {
      position: absolute;
      left: 0;
      top: 0;
      width: 100%;
      height: 600px;
      pointer-events: none;
      transform-origin: 0% 0%;
      animation-timing-function: linear;
      animation-iteration-count: infinite;
      overflow: hidden;
      z-index: 2;
    }
    .snow .snow_1 {
      animation-name: snow_falling_fore;
      animation-delay: 0s;
      animation-duration: 50s;
      height: 100%;
      top: -100%;
      pointer-events: none;
    }
    .snow .snow_2 {
      animation-name: snow_falling_fore;
      animation-delay: 25s;
      animation-duration: 50s;
      height: 100%;
      top: -100%;
      pointer-events: none;
    }
    .snow .snow_3 {
      animation-name: snow_falling_mid;
      animation-delay: 0s;
      animation-duration: 70s;
      opacity: .5;
      top: -100%;
      height: 100%;
      pointer-events: none;
    }
    .snow .snow_4 {
      animation-name: snow_falling_mid;
      animation-delay: 35s;
      animation-duration: 70s;
      opacity: .5;
      top: -100%;
      height: 100%;
      pointer-events: none;
    }
    .snow .snow_drifter {
      width: 100%;
      height: 100%;
      background-repeat: repeat;
      background-image: url(./image/snow-static.png);
      pointer-events: none;
    }
    @keyframes snow_falling_fore {
      0% {
        top:-100%;
        opacity:0
      }
      1% {
        top:-100%;
        opacity:1
      }
      99.8% {
        top:100%;
        opacity:1
      }
      99.9% {
        opacity:0
      }
      100% {
        top:-100%;
        opacity:0
      }
    }
    @keyframes snow_falling_mid {
      0% {
        top:-100%;
        opacity:0
      }
      1% {
        top:-100%;
        opacity:1
      }
      99.8% {
        top:100%;
        opacity:1
      }
      99.9% {
        opacity:0
      }
      100% {
        top:-100%;
        opacity:0
      }
    }
    /* 四边 */
    .frost {
      height: 100%;
      width: 100%;
      position: fixed;
      top: 0;
      left: 0;
      overflow: hidden;
      pointer-events: none;
      z-index: 2;
    }
    .frost .frame_sprite {
      position: absolute;
      height: 100px;
      background-repeat: repeat-x;
      background-size: contain;
      background-position: center bottom;
      background-image: url(./image/border-ice.png);
    }
    .frost .frame_left {
      top: -133px;
      left: 0;
      transform: rotate(90deg);
      transform-origin: 0 100px;
      pointer-events: none;
      width: 500%;
    }
    .frost .frame_right {
      top: 100%;
      left: calc(100% - 100px);
      transform: rotate(-90deg);
      transform-origin: 0 0;
      width: 500%;
      pointer-events: none;
    }
    .frost .frame_top {
      top: 0;
      width: 500%;
      transform: rotate(180deg);
      pointer-events: none;
    }
    .frost .frame_bottom {
      bottom: 0;
      left: 0;
      width: 500%;
      pointer-events: none;
    }


     @keyframes left {
            0%{
                transform: rotateY(0deg);
                transform-origin: right center;
                perspective: 201px;

            }
            50%{
                transform: rotateY(70deg);
                transform-origin: right center;
                perspective: 201px;

            }
            100%{
                transform: rotateY(0deg);
                transform-origin: right center;
                perspective: 201px;
            }
        }
        @keyframes right {
            0%{
                transform: rotateY(0);
                transform-origin: left center;
                perspective: 201px;

            }
            50%{
                transform: rotateY(-70deg);
                transform-origin: left center;
                perspective: 201px;

            }
            100%{
                transform: rotateY(0);
                transform-origin: left center;
                perspective: 201px;

            }
        }

     #butterfly{
          margin-top: 150px;
            width: 600px;
            height: 500px;
            position: absolute;
            transform: scale(0.35);
            transform-style: preserve-3d;
      }

      #butterfly2{
        margin-top: 150px;

            width: 600px;
            height: 500px;
            margin-left: 1200px;
            position: relative;
            transform: scale(0.35);
            transform-style: preserve-3d;
      }


      .leftSide{
            width: 267px;
            height: 421px;
            background: url("image/leftSide.png") no-repeat;
            position: absolute;
            left: 26px;
            top: 40px;
            animation: left 2s infinite;
            z-index: 9999;
        }

        .body{
            width: 152px;
            height: 328px;
            background: url("image/body.png") no-repeat;
            position: absolute;
            margin: auto;
            left: 0;
            right: 0;
            bottom: 0;
            top: 0;
            z-index: 9999;
        }
        .rightSide{
            width: 284px;
            height: 460px;
            background: url("image/rightSide.png") no-repeat;
            position: absolute;
            right: 26px;
            top: 58px;
            animation: right 2s infinite;
            z-index: 9999;
        }

 

  • transform: rotate(90deg):将元素旋转90度。
  • transform-origin: 0 100px;:设置元素的变换原点为左上角,偏移量为100像素。
  • pointer-events: none:禁止鼠标事件在元素上触发。
  • width: 500%;:将元素的宽度设置为其父元素宽度的500%。
  • left: calc(100% - 100px):将元素的宽度减去100像素,然后将结果作为左外边距的值。这样做可以使得元素在水平方向上相对于其父元素进行定位,并且保持一定的距离。

 2.HTML

<div id="butterfly">
    <div class="leftSide"></div>
    <div class="body"></div>
    <div class="rightSide"></div>

</div>


<div id="butterfly2" >
  <div class="leftSide"></div>
  <div class="body"></div>
  <div class="rightSide"></div>

</div>
<div class="image" style="position: absolute;top: 0;" >
  <img src="image/lxja.webp" style="width: 600px;margin-left: 600px;margin-top: 50px;border-radius: 50px;">

</div>

  <div class="snow">
    <div class="snow_slice snow_1">
      <div class="snow_drifter drift_1"></div>
    </div>
    <div class="snow_slice snow_2">
      <div class="snow_drifter drift_2"></div>
    </div>
    <div class="snow_slice snow_3">
      <div class="snow_drifter drift_3"></div>
    </div>
    <div class="snow_slice snow_4">
      <div class="snow_drifter drift_4"></div>
    </div>
  </div>
  <div class="frost">
    <div class="frame_sprite frame_left"></div>
    <div class="frame_sprite frame_right"></div>
    <div class="frame_sprite frame_top"></div>
    <div class="frame_sprite frame_bottom"></div>
  </div>

标签:蝴蝶,100%,animation,transform,snow,雪景,动态,top,left
From: https://blog.csdn.net/jklzbc/article/details/137360574

相关文章

  • 【HTML】简单制作一个动态3D正方体
     目录前言开始HTML部分JS部分CSS部分效果图总结前言    无需多言,本文将详细介绍一段代码,具体内容如下: 开始    首先新建文件夹,创建两个文本文档,其中HTML的文件名改为[index.html],JS的文件名改为[script.js],CSS的文件名改为[style.css],创建好后......
  • 【高校科研动态】贵州师大博士生封清为一作在J. Clean. Prod.发文:中国扶贫搬迁对生态
    目录1.文章简介 2.主要研究内容    3.文章引用1.文章简介 论文名称:QuantifyingtheextentofecologicalimpactfromChina'spovertyalleviationrelocationprogram:AcasestudyinGuizhouProvince第一作者及通讯作者:封清(博士研究生),周忠发(教授)第一作......
  • 代码随想录算法训练营三刷day44 | 动态规划之 完全背包 518. 零钱兑换 II 377. 组合总
    三刷day44完全背包基础知识问题描述举个栗子518.零钱兑换II1.确定dp数组以及下标的含义2.确定递推公式3.dp数组如何初始化4.确定遍历顺序5.举例推导dp数组377.组合总和Ⅳ1.确定dp数组以及下标的含义2.确定递推公式3.dp数组如何初始化4.确定遍历顺序5.举例来推导dp......
  • Python 使用matplotlib创建各种静态、动态、交互式和3D图表的功能
    在Python中,你可以使用各种库来创建和显示图表。其中,最常用的库之一是matplotlib,它提供了创建各种静态、动态、交互式和3D图表的功能。另一个流行的库是seaborn,它基于matplotlib,并提供了更高级别的界面,用于绘制有吸引力的统计图形。以下是一个使用matplotlib创建并显示简单折线......
  • 阿里云可观测 2024 年 3 月产品动态
    本月可观测热文回顾文章一览:全新架构!日志服务SLS自研免登录方案发布AIOps智能运维:有没有比专家经验更优雅的错/慢调用分析工具?一文看懂如何做好SQL质量监控使用SPL高效实现FlinkSLSConnector下推功能快报点击此处,了解更多产品详情。......
  • 【数据结构与算法篇】动态顺序表实战项目:通讯录
    【数据结构与算法】动态顺序表实战项目:通讯录......
  • Python实现动态进度条
    ★进度条基本实现功能代码importsysimporttime#进度条-功能演示defprogress_bar_demo(title,symbol):forperinrange(1,101):print("\r",end="")print(f"【{title}】:{per}%:{symbol*(per//2)}",end=""......
  • .NET 代理模式(二) 动态代理-DynamicProxy
    前言我们都知道,在.NET中实现动态代理AOP有多种方案,也有很多框架支持,但大多框架的实现原理都是通过Emit配合Activator一起使用,从IL级别上实现动态代理。其实在.NET中有一个更为简单的方案可以实现动态代理,那就是DispatchProxy类。DispatchProxy类DispatchProxy类是.NETCor......
  • jwt实现登录 和 接口实现动态权限
     [Authorize]  ====  usingMicrosoft.AspNetCore.Authorization;   登录的DTOnamespacelogin;publicclassWeatherForecast{publicDateOnlyDate{get;set;}publicintTemperatureC{get;set;}publicintTemperatureF=>32+(in......
  • 动态规划---线性dp1
    7-3最大子序列总和给定K个整数序列{N1,N2,...,NK}。连续子序列定义为{Ni,Ni+1,...,Nj},其中1≤i≤j≤K。最大子序列是具有最大元素总和的连续子序列。例如,给定序列{-2,11,-4,13,-5,-2},其最大子序列为{11,-4,13},最大和为20。现在,您应该找到最大的总和,以及......