Skip to content

Instantly share code, notes, and snippets.

@Bachana123
Created July 21, 2020 19:37
Show Gist options
  • Save Bachana123/7f636a1af53b6c4ec3a22f511c8fd241 to your computer and use it in GitHub Desktop.
Save Bachana123/7f636a1af53b6c4ec3a22f511c8fd241 to your computer and use it in GitHub Desktop.
/////// install first
npm i -D scrollmagic gsap scrollmagic-plugin-gsap
/////// plugin
/* eslint-disable import/no-webpack-loader-syntax */
import Vue from 'vue'
import { TweenMax, TimelineMax } from 'gsap'
import * as ScrollMagic from 'scrollmagic'
import { ScrollMagicPluginGsap } from 'scrollmagic-plugin-gsap'
ScrollMagicPluginGsap(ScrollMagic, TweenMax, TimelineMax)
const GSAPScrollMagic = {
install(Vue, options) {
// GSAP
Vue.prototype.$GSAP = {
TweenMax,
TimelineMax
// Linear,
// Power1,
// Power2,
// Power3,
// Back,
}
// ScrollMagic
Vue.prototype.$ScrollMagic = ScrollMagic
}
}
Vue.use(GSAPScrollMagic)
//////// nuxt config
{ src: '~/plugins/gsap-scrollmagic.js', mode: 'client', ssr: false },
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment