国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

011:vue結(jié)合css動(dòng)畫animation實(shí)現(xiàn)下雪效果

這篇具有很好參考價(jià)值的文章主要介紹了011:vue結(jié)合css動(dòng)畫animation實(shí)現(xiàn)下雪效果。希望對(duì)大家有所幫助。如果存在錯(cuò)誤或未考慮完全的地方,請(qǐng)大家不吝賜教,您也可以點(diǎn)擊"舉報(bào)違法"按鈕提交疑問。

1. 實(shí)現(xiàn)效果

GIF錄屏文件太卡有點(diǎn)卡,實(shí)際是很絲滑的

animation動(dòng)畫和vue3相結(jié)合,# vue2/vue3 常用示例專欄,vue.js,css,前端,scss,animation文章來源地址http://www.zghlxwxcb.cn/news/detail-806448.html

2. 編寫一個(gè)下雪效果組件 VabSnow.vue

  1. src 下新建 components 文件,創(chuàng)建VabSnow.vue組件文件
<template>
  <div class="content" :style="styleObj">
    <div v-for="(item, index) in 200" :key="index" class="snow"></div>
  </div>
</template>

<script>
  export default {
    name: 'VabSnow',
    props: {
      styleObj: {
        type: Object,
        default: () => {
          return {}
        },
      },
    },
    data() {
      return {}
    },
    created() {},
    mounted() {},
    methods: {},
  }
</script>

<style lang="scss" scoped>
  .content {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: radial-gradient(ellipse at bottom, #1b2735 0%, #090a0f 100%);
    filter: drop-shadow(0 0 10px white);
  }

  @function random_range($min, $max) {
    $rand: random();
    $random_range: $min + floor($rand * (($max - $min) + 1));

    @return $random_range;
  }

  .snow {
    $total: 200;
    position: absolute;
    width: 10px;
    height: 10px;
    background: white;
    border-radius: 50%;

    @for $i from 1 through $total {
      $random-x: random(1000000) * 0.0001vw;
      $random-offset: random_range(-100000, 100000) * 0.0001vw;
      $random-x-end: $random-x + $random-offset;
      $random-x-end-yoyo: $random-x + ($random-offset / 2);
      $random-yoyo-time: random_range(30000, 80000) / 100000;
      $random-yoyo-y: $random-yoyo-time * 100vh;
      $random-scale: random(10000) * 0.0001;
      $fall-duration: random_range(10, 30) * 1s;
      $fall-delay: random(30) * -1s;

      &:nth-child(#{$i}) {
        opacity: random(10000) * 0.0001;
        transform: translate($random-x, -10px) scale($random-scale);
        animation: fall-#{$i} $fall-duration $fall-delay linear infinite;
      }

      @keyframes fall-#{$i} {
        #{percentage($random-yoyo-time)} {
          transform: translate($random-x-end, $random-yoyo-y) scale($random-scale);
        }

        to {
          transform: translate($random-x-end-yoyo, 100vh) scale($random-scale);
        }
      }
    }
  }
</style>

3. 頁(yè)面使用

<template>
  <div class="home">
    <div class="body">
      <VabSnow />
    </div>
  </div>
</template>

<script>
  import VabSnow from '@/components/VabSnow' //引入組件
  export default {
    name: 'Demo',
    components: {
      VabSnow,
    },
  }
</script>

<style scoped lang="scss">
  .home {
    .body {
      width: 890px;
      height: 500px;
      border: #030303 solid 10px;
      box-sizing: border-box;
      box-sizing: border-box;
    }
  }
</style>

4. 注意點(diǎn)

  1. 沒啥注意的,主要是scss的變量操作及css動(dòng)畫 ??

到了這里,關(guān)于011:vue結(jié)合css動(dòng)畫animation實(shí)現(xiàn)下雪效果的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點(diǎn)僅代表作者本人,不代表本站立場(chǎng)。本站僅提供信息存儲(chǔ)空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請(qǐng)注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實(shí)不符,請(qǐng)點(diǎn)擊違法舉報(bào)進(jìn)行投訴反饋,一經(jīng)查實(shí),立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費(fèi)用

相關(guān)文章

  • Vue 中通用的 css 列表入場(chǎng)動(dòng)畫效果

    Vue 中通用的 css 列表入場(chǎng)動(dòng)畫效果

    ? css 代碼? 封裝的列表組件,我是直接循環(huán)列表組件的,并且加了一個(gè)index 屬性 直接傳遞給子組件的第一個(gè) 元素上 ? 這樣就能實(shí)現(xiàn)列表一項(xiàng)接一項(xiàng)進(jìn)入的效果動(dòng)畫了?

    2024年02月15日
    瀏覽(23)
  • Unity Animation -- 改進(jìn)動(dòng)畫效果

    Unity Animation -- 改進(jìn)動(dòng)畫效果

    ? ? ? 在上一篇筆記中(Unity Animation -- Overview_亦楓Leonlew的博客-CSDN博客),我們制作了簡(jiǎn)單的小球彈跳的動(dòng)畫,但這個(gè)動(dòng)畫看起來很不自然,小球的彈跳看起來就像是不受重力影響的物體,沒有加速度的影響。要讓小球的彈跳動(dòng)畫看起來更自然(不使用物理引擎,只使用動(dòng)畫

    2023年04月12日
    瀏覽(21)
  • 基于css實(shí)現(xiàn)動(dòng)畫效果

    基于css實(shí)現(xiàn)動(dòng)畫效果

    ????????本文將會(huì)基于css,實(shí)現(xiàn)各種動(dòng)畫效果,接下來會(huì)從簡(jiǎn)單幾個(gè)例子入手。 效果 效果展示

    2024年01月23日
    瀏覽(24)
  • css的animation動(dòng)畫

    創(chuàng)建動(dòng)畫序列,需要使用 animation 屬性或其子屬性,該屬性允許配置動(dòng)畫時(shí)間、時(shí)長(zhǎng)以及其他動(dòng)畫細(xì)節(jié),但該屬性不能配置動(dòng)畫的實(shí)際表現(xiàn),動(dòng)畫的實(shí)際表現(xiàn)是由 @keyframes 規(guī)則實(shí)現(xiàn) 屬性 描述 animation-name 指定由 @keyframes 描述的關(guān)鍵幀名稱 animation-duration 設(shè)置動(dòng)畫一個(gè)周期的時(shí)長(zhǎng)

    2024年02月06日
    瀏覽(42)
  • animate.css 動(dòng)畫

    Animate.css | A cross-browser library of CSS animations. class=\\\"animate__bounce\\\" 1.? ? bounce ? ? ? ? ? ? 彈跳 2.?? ?flash ? ? ? ? ? ? ?閃爍 3.?? ?pulse ? ? ? ? ? ? ?放大,縮小 4.?? ?rubberBand ? ? ? ? 放大,縮小,彈簧 5.?? ?shake ? ? ? ? ? ? ?左右晃動(dòng) 6.?? ?headShake ? ? ? ? ?左右小幅

    2024年02月11日
    瀏覽(28)
  • CSS3實(shí)現(xiàn)動(dòng)畫加載效果
  • css動(dòng)畫(animation)常用屬性

    ? ??? ??? ??? ??? ??? ???? 1.animation-name:動(dòng)畫名稱 ?? ??? ??? ??? ??? ??? ??? ??? ??? ? ?2.@keyframes:動(dòng)畫定義,后面跟動(dòng)畫名稱 ?? ??? ??? ??? ??? ??? ??? ??? ??? ? 3.animation-duration:動(dòng)畫持續(xù)時(shí)長(zhǎng),單位(s) ?? ??? ??? ??? ??? ??? ?

    2023年04月27日
    瀏覽(26)
  • CSS中animation動(dòng)畫-詳解

    CSS中animation動(dòng)畫-詳解

    1、animation有什么組成? Animations由兩部分組成:css動(dòng)畫的配置,以及一系列的keyframes(用來描述動(dòng)畫的開始、過程、結(jié)束狀態(tài))。不需要了解任何Js技術(shù)即可完成動(dòng)畫的制作 2、關(guān)鍵幀應(yīng)該怎么表示? 0%表示動(dòng)畫的初始時(shí)間,也可以通過from表示。100%表示動(dòng)畫的結(jié)束時(shí)間

    2024年02月01日
    瀏覽(18)
  • CSS animation動(dòng)畫使用詳解

    CSS animation動(dòng)畫使用詳解

    目錄 一、animation動(dòng)畫的使用步驟 第一步:定義動(dòng)畫 第二步:使用動(dòng)畫 二、animation的復(fù)合屬性 三、animation的拆分屬性 四、動(dòng)畫屬性 animation:動(dòng)畫名稱 動(dòng)畫時(shí)長(zhǎng) 速度曲線 延遲時(shí)間 重復(fù)次數(shù) 動(dòng)畫方向 執(zhí)行完畢時(shí)的狀態(tài) 逐幀動(dòng)畫(配合精靈圖使用) animation-timing-function:step(N) N為將動(dòng)

    2024年02月16日
    瀏覽(28)
  • css有哪些動(dòng)畫效果怎么實(shí)現(xiàn)的

    ?css常見的動(dòng)畫效果:平移,縮放,旋轉(zhuǎn) css實(shí)現(xiàn)動(dòng)畫主要有三種方式: transition實(shí)現(xiàn)漸變動(dòng)畫 transform實(shí)現(xiàn)縮放平移效果動(dòng)畫 animation實(shí)現(xiàn)自定義動(dòng)畫? ?transition實(shí)現(xiàn)漸變動(dòng)畫 transform實(shí)現(xiàn)縮放平移效果動(dòng)畫? animation實(shí)現(xiàn)自定義動(dòng)畫? 屬性 描述 屬性值 animation-name 動(dòng)畫名稱 animat

    2024年02月09日
    瀏覽(23)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請(qǐng)作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包