Skip to content

Instantly share code, notes, and snippets.

@ramsaylanier
Created November 21, 2017 04:36
Show Gist options
  • Save ramsaylanier/3affa856256d88c351fa28822e2ea183 to your computer and use it in GitHub Desktop.
Save ramsaylanier/3affa856256d88c351fa28822e2ea183 to your computer and use it in GitHub Desktop.
<template>
<div :class="$style.sidebar"/>
</template>
<script>
import {TweenMax, Power4} from 'gsap'
export default {
name: 'sidebar',
mounted () {
TweenMax.set(this.$el, {
x: this.$el.offsetWidth
})
},
computed: {
open () {
return this.$store.state.ui.sidebarOpen
}
},
watch: {
open: function (open) {
const dX = open ? 0 : this.$el.offsetWidth
TweenMax.to(this.$el, 0.6, {
x: dX,
ease: Power4.easeOut
})
}
}
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment