更新记录

1.0.5(2023-11-24)

更新使用说明文档

1.0.4(2023-09-15)

改为uni_modules规范

1.0.3(2023-06-16)

优化

查看更多

平台兼容性

Vue2 Vue3
App 快应用 微信小程序 支付宝小程序 百度小程序 字节小程序 QQ小程序
app-vue app-nvue
钉钉小程序 快手小程序 飞书小程序 京东小程序
H5-Safari Android Browser 微信浏览器(Android) QQ浏览器(Android) Chrome IE Edge Firefox PC-Safari

piaoyi-animate 动画库插件

使用示例如下:

<template>
    <view class="animatecon">
        <view class="animate-item" v-for="(item, index) in list" :key="index">
            <view class="title">
                {{item.title}}
            </view>
            <view class="animate-item_box">
                <piaoyi-animate v-for="(i, j) in item.children" :key="j" class="piaoyi-animate" :type="i.type" :duration="i.duration">
                    {{i.type}}
                </piaoyi-animate>
            </view>
        </view>
    </view>
</template>

<script>
    import piaoyiAnimate from '@/uni_modules/piaoyi-animate/components/piaoyi-animate/piaoyi-animate.vue'
    export default {
        data() {
            return {
                list: [{
                    title: '抖动型动画',
                    children: [{
                        type: 'bounce',
                        duration: 1000
                    },{
                        type: 'flash',
                        duration: 1000
                    },{
                        type: 'pulse',
                        duration: 1000
                    },{
                        type: 'rubberBand',
                        duration: 1000
                    },{
                        type: 'shakeX',
                        duration: 1000
                    },{
                        type: 'shakeY',
                        duration: 1000
                    },{
                        type: 'headShake',
                        duration: 1000
                    },{
                        type: 'swing',
                        duration: 1000
                    },{
                        type: 'tada',
                        duration: 1000
                    },{
                        type: 'wobble',
                        duration: 1000
                    }, {
                        type: 'jello',
                        duration: 1000
                    }, {
                        type: 'heartBeat',
                        duration: 1000
                    }]
                }, {
                    title: '从外向内动画',
                    children: [{
                        type: 'backInDown',
                        duration: 1000
                    }, {
                        type: 'backInLeft',
                        duration: 1000
                    }, {
                        type: 'backInRight',
                        duration: 1000
                    }, {
                        type: 'backInUp',
                        duration: 1000
                    }]
                }, {
                    title: '从内向外动画',
                    children: [{
                        type: 'backOutDown',
                        duration: 1000
                    }, {
                        type: 'backOutLeft',
                        duration: 1000
                    }, {
                        type: 'backOutRight',
                        duration: 1000
                    }, {
                        type: 'backOutUp',
                        duration: 1000
                    }]
                }, {
                    title: '由外向内+抖动动画',
                    children: [{
                        type: 'bounceIn',
                        duration: 1000
                    }, {
                        type: 'bounceInDown',
                        duration: 1000
                    }, {
                        type: 'bounceInLeft',
                        duration: 1000
                    }, {
                        type: 'bounceInRight',
                        duration: 1000
                    }, {
                        type: 'bounceInUp',
                        duration: 1000
                    }]
                }, {
                    title: '由内向外+抖动动画',
                    children: [{
                        type: 'bounceOut',
                        duration: 1000
                    }, {
                        type: 'bounceOutDown',
                        duration: 1000
                    }, {
                        type: 'bounceOutLeft',
                        duration: 1000
                    }, {
                        type: 'bounceOutRight',
                        duration: 1000
                    }, {
                        type: 'bounceOutUp',
                        duration: 1000
                    }]
                }, {
                    title: '翻转动画',
                    children: [{
                        type: 'flip',
                        duration: 1000
                    }, {
                        type: 'flipInX',
                        duration: 1000
                    }, {
                        type: 'flipInY',
                        duration: 1000
                    }, {
                        type: 'flipOutX',
                        duration: 1000
                    }, {
                        type: 'flipOutY',
                        duration: 1000
                    }]
                }]
            };
        },
        components: {
            piaoyiAnimate
        }
    }
</script>

<style lang="scss">
.animatecon {
    min-height: 100vh;
    background: #eee;
    .animate-item {
        .title {
            background: #fff;
            color: #333;
            padding: 20rpx 5%;
            font-weight: 500;
            margin-bottom: 30rpx;
        }
        .animate-item_box {
            display: flex;
            flex-wrap: wrap;
            padding: 0 5%;
            .piaoyi-animate {
                width: 30%;
                height: 80rpx;
                color: #fff;
                text-align: center;
                line-height: 80rpx;
                border-radius: 10rpx;
                font-weight: 500;
                background: #007aff;
                margin-right: 5%;
                margin-bottom: 20rpx;
                &:nth-child(3),&:nth-child(6),&:nth-child(9),&:nth-child(12) {
                    margin-right: 0;
                }
            }
        }
    }
}
</style>

使用说明

此插件包含多种动画,直接引入插件,通过slot插槽插入自己的内容

Prop

参数名称 描述
type 动画类型,具体通过导入插件使用上面示例代码查看效果现在自己需要的动画类型
duration 动画时长,默认值2000

可接定制化组件开发

右侧有本人代表作小程序二维码,可以扫码体验

因为文档内容有限,本示例只展示了部分动画(type值),需要更多动画内容可以加QQ群获取更多资源

如使用过程中有问题或有一些好的建议,欢迎加QQ群互相学习交流:120594820

隐私、权限声明

1. 本插件需要申请的系统权限列表:

2. 本插件采集的数据、发送的服务器地址、以及数据用途说明:

3. 本插件是否包含广告,如包含需详细说明广告表达方式、展示频率:

许可协议

MIT协议

使用中有什么不明白的地方,就向插件作者提问吧~ 我要提问