Coder Social home page Coder Social logo

valerioageno / dynamic-images-page-transition Goto Github PK

View Code? Open in Web Editor NEW
9.0 1.0 1.0 87.73 MB

A pratical guide/example to learn how to make page transitions using images as the main component effect.

HTML 41.61% JavaScript 45.86% CSS 12.53%
page-transitions barba gsap animations transition transition-animation

dynamic-images-page-transition's Introduction

Dynamic images page transition ๐Ÿฆพ

Smooth page transition with barba.js & GSAP

What this repo want to be ๐Ÿ”ฅ

A pratical guide/example to learn how to make smooth page transitions using images as the main component effect.

It is realized using barba.js for the page transitions and GSAP for the dom elements effects.

You can find helpful documentation on their websites.

Instruction

  1. Dowload or clone from repo.
  2. open your live server
  3. load the "index.html" file in your favorite browser

All the page transitions are stored in the main.js file in the follow function:

//barba lifecycle
barba.init({
    debug: true,
    transitions: [
    {
        name: 'to-pages',
        async leave(data){
            const done = this.async();
            pageTransitionToPage(data.next.namespace);
            await delay(1300);
            done();
        },
        async enter() {
            contentAnimationToPage();
        },
        from: {
            namespace: 'home',
        },
        to: {
            namespace: [
                'about',
                'products',
                'contacts',
                'portfolio'
            ]
        },
    },
    {
        name: 'to-home',
        async leave(){
            const done = this.async();
            pageTransitionToHome();
            await delay(1000);
            done();
        },
        async enter(data) {
            contentAnimationToHome(data.current.namespace);
        },
        async after(data){
            listItemsShow();
            Cursor()
        },
        from: {
            namespace: [
                'about',
                'products',
                'contacts',
                'portfolio'
            ]
        },
        to: {
            namespcae: 'home'
        }
    },
    ]
});

The sequence of the animation from the home page is:

  1. Remove the left home page
  2. move the corresponding image
  3. remove the links list
  4. fix the image in the new page
  5. show the new title
  6. show the back link

dynamic-images-page-transition's People

Contributors

valerioageno avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

feworks

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.