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

image-transition-3d

v1.0.3

Published

## 介绍

Downloads

3

Readme

image-transition-3d

介绍

主要用于将图片做瓦片处理, 并进行异步动画切换。

快速使用

安装依赖

npm install image-transition-3d --save

# or

yarn add image-transition-3d

注册组件到 Vue

import Vue from 'vue'
import ImageTransition3d from "image-transition-3d";

Vue.use(ImageTransition3d);

使用

<template>
    <div id="app">
        <div style="width: 800px;height: 480px;position:relative;">
            <image-transition-3d
                    v-model="imageIndex"
                    :images="images"
            />
        </div>
    </div>
</template>

<script>
    export default {
        name: 'App',
        components: {},
        data() {
            return {
                // 当前显示图片(数组下标)
                imageIndex: 0,
                // 图片 src 列表
                images: [
                    '/image/1.jpg',
                    '/image/2.jpg',
                    '/image/3.jpg',
                    '/image/4.jpg',
                ],
            };
        }
    }
</script>

参数列表

| 参数 | 类型 | 说明 | | --- | --- | --- | | images | Array<String> | 图片 src 连接列表 | | value | Integer | 当前显示的 src 列表下标 | | cols | Integer | 列数 | | rows | Integer | 行数 | | customTransitions | Array<CustomTransition> | 自定义动画列表 | | duration | Integer | 动画切换图片间隔 ( ms ) | | useTransitionNames | Array<Object> | 切换随机使用的动画名称 |

CustomTransition

| 参数 | 类型 | 说明 | | --- | --- | --- | | name | Object | 动画名称(全局唯一) | | leaveStyle | Function(index) | 返回离开的样式的方法, index 为瓦片下标 | | enterStyle | Function(index) | 返回进入样式的开始位置样式 | | leaveDistributionTime | Integer , Function(index) | 瓦片动画开始随机延时范围 | | leaveDuration | Integer, Function(index) | 单个瓦片离开动画过度时间 | | enterDuration | Integer, Function(index) | 单个瓦片进入动画过度时间 |

使用指定动画配置

<template>
    <div id="app">
        <div style="width: 800px;height: 480px;position:relative;">
            <image-transition-3d
                    v-model="imageIndex"
                    :images="images"
                    :custom-transitions="customTransitions"
                    :use-transition-names="useTransitionNames"
            />
        </div>
    </div>
</template>

<script>
    export default {
        name: 'App',
        components: {},
        data() {
            return {
                imageIndex: 0,
                images: [
                    '/image/1.jpg',
                    '/image/2.jpg',
                    '/image/3.jpg',
                    '/image/4.jpg',
                ],
                // 自定义动画
                customTransitions: [
                    {
                        // 动画名称
                        name: "me",
                        // 离开动画 i : 第 i 个瓦片, 横着数
                        leaveStyle: function (i) {
                            return {
                                "opacity": 0,
                                "transform": "translateX(100px)"
                            }
                        },
                        // 入场动画
                        enterStyle: function (i) {
                            return {
                                "opacity": 0,
                                "transform": "translateX(-100px)"
                            }
                        },
                        // 异步离开的最大时间跨度 会随机一个时间开始单个瓦片动画
                        leaveDistributionTime: 1000,
                        // 离开动画过渡时间
                        leaveDuration: 1000,
                        // 入场动画过度时间
                        enterDuration: 1000,
                    }
                ],
                useTransitionNames: ['me']
            };
        }
    }
</script>

问题反馈

仓库

github: https://github.com/fangjc1986/image-transition-3d.git