Skip to content

Instantly share code, notes, and snippets.

@nukosuke
Created May 5, 2016 10:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nukosuke/be2ea10cd9d8dcad2e8db41c00ca5736 to your computer and use it in GitHub Desktop.
Save nukosuke/be2ea10cd9d8dcad2e8db41c00ca5736 to your computer and use it in GitHub Desktop.
Vue.jsとanimete.cssでアニメーション ref: http://qiita.com/nukosuke/items/548dbee9cc715e5dfb32
$ npm install vue vue-router --save
script(id='page-1' type='x-template')
.page
h1 ページ1
img(src='img/page-1.gif' alt='page-1')
components.p1 = Vue.component('page-1', {
template: '#page-1'
});
/* アニメーション */
// 表示: fadeInUp
@keyframes fadeInUp {
from {
opacity: 0;
transform: translate3d(0, 100%, 0);
}
to {
opacity: 1;
transform: none;
}
}
.fadeInUp {
animation-name: fadeInUp;
animation-delay: 0.5s; // 前のコンポーネントが消えるまで遅延させる
animation-duration: 1s;
animation-fill-mode: both;
}
// 非表示: slideOutRight
@keyframes slideOutRight {
from {
transform: translate3d(0, 0, 0);
}
to {
visibility: hidden;
transform: translate3d(100%, 0, 0);
}
}
.slideOutRight {
animation-name: slideOutRight;
animation-duration: 0.5s; // fadeInUpのanimation-delayと一致させる
animation-fill-mode: both;
}
Vue.transition('page', {
enterClass: 'fadeInUp',
leaveClass: 'slideOutRight',
});
script(id='page-1' type='x-template')
.page(transition='page') //- 登録したpageトランジションを適用
h1 ページ1
img(src='img/page-1.gif' alt='page-1')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment