npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

animation-list

v2.2.1

Published

Animation rendering based on Vue3 list elements (supports animation callbacks)

Downloads

8

Readme

animation-list

简介

https://img-blog.csdnimg.cn/e7208f78e2a8455090da6bfebd23e41a.gif#pic_center

  • animation-list 基于vue列表动画插件,支持vue3.0
  • 支持每个元素的动画监听(start,update,end)

引用

  • 安装
npm i animation-list
  • 例子
<template>
  <AnimationList ref="animationListRef">
    <div class="item" v-for="item in 8" :key="item">{{ item }}</div>
  </AnimationList>
</template>

<script lang="ts" setup>
import { onMounted, ref } from 'vue'
import AnimationList from 'animation-list/AnimationList.vue'
const animationListRef = ref<InstanceType<typeof AnimationList>>()
onMounted(() => {
  animationListRef.value?.initHooks({
    end: () => {
        console.log('动画结束')
        animationListRef.value?.animationCall() // 重新触发动画
    }
  })
})
</script>

<style  scoped>
.animation-list {
  overflow: hidden;
}
</style>

参数

属性

| 参数 | 默认值 | 备注 | | ------------- | ------------------------- | ---------------- | | firstShow | true | 默认是否渲染动画 | | deep | false | 是否深层查找 | | animationType | ANIMATION_TYPE.RIGHT_LEFT | 默认从右到左动画 |

ANIMATION_TYPE默认动画

| key | 动画 | 效果 | 备注 | | ---------- | ---------- | ---------- | ------------------ | | BOTTOM_TOP | bottom-top | 从下向上 | | | TOP_BOTTOM | top-bottom | 从上向下 | | | RIGHT_LEFT | right-left | 从右到左 | 默认 | | LEFT_RIGHT | left-right | 从左到右 | | | SAMLL_BIG | small-big | 从小到大 | | | BIG_SMALL | big-small | 从大到小 | | | CUSTOM | custom | 自定义动画 | 根据例子自定义动画 |

异步渲染流程

// 1.设置属性取消默认渲染动画 firstShow
// 2.获取数据后重新触发
import { onMounted, ref,nextTick } from 'vue'
setTimeout(() => {
    // 获取数据
    nextTick(() => {
        animationListRef.value?.animationCall()
    })
}, 1500)

自定义动画

<template>
<AnimationList ref="animationListRef" :animationType="ANIMATION_TYPE.CUSTOM">
    <div class="item" v-for="item in 8" :key="item">{{ item }}</div>
    </AnimationList>
</template>
<script lang="ts" setup>
    import AnimationList from 'animation-list/AnimationList.vue'
    import { ANIMATION_TYPE } from "animation-list/uitls";

</script>

<style  scoped>
    .animation-list {
        overflow: hidden;
    }
    /** 自定义动画部分(必须) **/
    .ls-custom {
        display: block;
        opacity: 1 !important;
        animation: ls-custom ease 0.26s !important;
    }
    @keyframes ls-custom {
        0% {
            opacity: 0;
            transform: scale(1.6);
        }
        100% {
            opacity: 1;
            transform: scale(1);
        }
    }

</style>
  • 在 style 样式加入
    • ls-custom 初始化
    • ls-custom 动画开始
    • keyframes 动画

hooks生命周期

animationListRef.value?.initHooks({
    start:()=>{},
    update:(params: { index: number; el: HTMLElement | Element }) => {},
    end:()=>{}
})

  • 1.x.x - vue2 相关文档,请以该版本的 README 为准

  • 2.x.x - vue3