Coder Social home page Coder Social logo

vue-lottie's Introduction

Wapper of bodymovin.js

bodymovin is Adobe After Effects plugin for exporting animations as JSON, also it provide bodymovin.js for vender them as svg/canvas/html.

Demo

https://serzz1990.github.io/vue-lottie/ Demo

Why Lottie?

Flexible After Effects features

We currently support solids, shape layers, masks, alpha mattes, trim paths, and dash patterns. And we’ll be adding new features on a regular basis.

Manipulate your animation any way you like

You can go forward, backward, and most importantly you can program your animation to respond to any interaction.

Small file sizes

Bundle vector animations within your app without having to worry about multiple dimensions or large file sizes. Alternatively, you can decouple animation files from your app’s code entirely by loading them from a JSON API.

Learn morehttp://airbnb.design/lottie/

Looking for lottie files › https://www.lottiefiles.com/

Installation

Install through npm:

npm install vue-lottie-ssr --save

Available props:

  • data - animation json data.
  • width - svg width (Number).
  • height - svg height (Number).
  • loop - loop animation. [default: false]
  • autoplay - autoplay animation. [default: true]
  • settings - bodymovin renderer settings (Object).

Available methods:

  • play - play animation
  • pause - pause animation
  • stop - stop animation
  • setSpeed - setSpeed animation

Usage

<template>
    <div id="app">
        <vue-lottie ref="lottie" loop autoplay :data="animationData" :height="400" :width="400"></vue-lottie>

        <div>
            <p>Speed: x{{speed}}</p>
            <input type="range" value="1" min="0" max="3" step="0.5" v-on:change="onSpeedChange" v-model="speed">
        </div>
        <button v-on:click="stop">stop</button>
        <button v-on:click="pause">pause</button>
        <button v-on:click="play">play</button>
    </div>

</template>
<script>
    import vueLottie from './components/vue-lottie.vue'
    import animationData from './assets/pinjump.json'

    export default {
        name: 'app',
        components: {
            vueLottie
        },
        data () {
            return {
                speed: 1,
                animationData
            }
        },
        computed: {
            lottie () {
                return this.$refs.lottie
            }
        },
        methods: {
            stop () {
                this.lottie.stop()
            },

            play () {
                this.lottie.play()
            },

            pause () {
                this.lottie.pause()
            },

            onSpeedChange: function () {
                this.lottie.setSpeed(this.speed)
            }
        }
    }
</script>

SSR

Component has validation Vue.prototype.$isServer set `true for server side rendering

Vue.prototype.$isServer = true

More information on Bodymoving Documentation

License

MIT

vue-lottie's People

Contributors

chenqingspring avatar serzz1990 avatar th1nkk1d avatar

Watchers

James Cloos avatar Simon Tretter avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.