This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const tlLeave = gsap.timeline({ | |
defaults: { duration: 0.75, ease: "Power2.easeOut" }, | |
}); | |
const tlEnter = gsap.timeline({ | |
defaults: { duration: 0.75, ease: "Power2.easeOut" }, | |
}); | |
//Make the functions for the leave and enter animations | |
const leaveAnimation = (current, done) => { | |
const product = current.querySelector(".image-container"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const barba = require('@barba/core'); | |
const anime = require('animejs'); | |
const Home = require('./views/home'); | |
const WhoWeAre = require('./views/whoweare'); | |
class App { | |
init() { | |
barba.init({ | |
transitions: [{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import History from './history'; | |
import Barba from 'barba.js'; | |
const history = new History(); | |
Barba.Pjax.goTo = function(url) { | |
history.goTo(url); | |
this.onStateChange(); | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Barba from 'barba.js'; | |
import mud from '../loader/behaviour'; | |
import events from '../helpers/events'; | |
import { transitionEnd, css3 } from '../helpers/prefix'; | |
import Tweezer from 'tweezer.js'; | |
export const views = () => { | |
const heroClassName = 'is-page-with-hero'; | |
const heroWithOutClassName = 'is-page-without-hero'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// BARBA.JS INIT and Page transitions | |
var ExpandTransition = Barba.BaseTransition.extend({ | |
start: function() { | |
Promise | |
.all([this.newContainerLoading, this.zoom()]) | |
.then(this.showNewPage.bind(this)); | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// /app/javascript/packs/application.js | |
import Barba from 'barba.js' | |
import {HideShowTransition, FadeTransition} from '../barbaTransitions' | |
/** | |
* | |
* @param {Element} conatainerElement | |
*/ | |
function initAll(conatainerElement) { | |
// initialize all js scripts inside conatainerElement |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Internally, do something like this | |
Promise | |
.all([ | |
this.loadNewContent, | |
this.transitionOut({ | |
fromRoute, | |
event, | |
oldContainer, | |
promise |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set up | |
put cdn for html ur using for all the html ur transitioning | |
<script src="https://unpkg.com/@barba/core"></script> | |
html structure | |
<body data-barba="wrapper"> | |
<!-- put here content that will not change |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@import url('https://fonts.googleapis.com/css2?family=Ubuntu&display=swap'); | |
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;800&display=swap'); | |
* { | |
margin: 0; | |
padding: 0; | |
} | |
body, html { | |
min-width: 100%; | |
min-height: 100vh; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
can animate the flex-basis property using CSS transitions in a media query: | |
In this example, we have a flex container with three flex items, each with a different flex-basis. When the screen width is less than or equal to 768px, the media query is triggered and we want the flex items to stack vertically. We set the flex-basis to 100% for each item, which causes them to take up the full width of the container. | |
We also add an .active class to the items we want to animate. In this case, we're animating the second and third boxes to have a smaller flex-basis when the screen width is reduced. The first box remains at flex-basis: 100% because we want it to take up the full width of the container at all times. | |
To animate the flex-basis property, we add a transition property to the .box class. In the media query, we then change the flex-basis property of the active boxes to the desired value, and the transition effect takes care of the rest. |