Coder Social home page Coder Social logo

trendingtechnology / vue-displacement-slideshow Goto Github PK

View Code? Open in Web Editor NEW

This project forked from albancrepel/vue-displacement-slideshow

0.0 1.0 0.0 8.08 MB

A Vue.js 2.0 slideshow component working with Three.js

Vue 76.02% JavaScript 23.98%

vue-displacement-slideshow's Introduction

vue-displacement-slideshow

Webgl image displacement transitions made simple. A Vue.js 2.0 slideshow component working with Three.js and GSAP.

Demo

Demo gif

Live demo

Coming soon

Installation

NPM

 npm i --save vue-displacement-slideshow

Example

<template>
    <vue-displacement-slideshow 
            :images="images"
            displacement="require('../assets/displacement.png')"
            :intensity.number="0.2"
            :speedIn.number="1.4"
            :speedOut.number="1.4"
            ease="Expo.easeInOut"
            ref="slideshow"></vue-displacement-slideshow>
</template>
    
<script>
    import VueDisplacementSlideshow from "vue-displacement-slideshow";
    
    export default {
        components: {
            VueDisplacementSlideshow,
        },
        computed: {
            images() {
                return [
                    require("../assets/images/1.jpg"),
                    require("../assets/images/2.jpg"),
                    require("../assets/images/3.jpg")
                ];
            }
        },
        methods: {
            init() {
                //We loop through all our images by calling the 'next' method of our component every 2 seconds
                setInterval(() => {
                    this.$refs.slideshow.next();
                }, 2000);
            }
        },
        mounted() {
            this.init();
        }
    };
</script>
    

This component is heavily based on this library : https://github.com/robin-dela/hover-effect

Props

name type description required default value
images Array An array containing the paths of the images you wan to use true []
displacement String The path of the displacement image true none
intensity Number The intensity of the displacement false 1
speedIn Number The duration of the animation for the next image, in seconds false 1
speedOut Number The duration of the animation for the previous image, in seconds false 1
ease String The GSAP easing to use false Expo.easeOut

Methods

Name Description
next Transition to the second image.
previous Transition to the first image.

Behavior

The first image of the array is displayed at first. When we call the next method while currently showing the last image, it will go to the first image. When we call the previous method while currently showing the first image, it will go to the last image.

The images are displayed as we would use background-size:cover in CSS.

License

MIT

vue-displacement-slideshow's People

Contributors

albancrepel avatar

Watchers

 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.