Created
May 5, 2016 10:48
-
-
Save nukosuke/be2ea10cd9d8dcad2e8db41c00ca5736 to your computer and use it in GitHub Desktop.
Vue.jsとanimete.cssでアニメーション ref: http://qiita.com/nukosuke/items/548dbee9cc715e5dfb32
This file contains 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
$ npm install vue vue-router --save |
This file contains 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
script(id='page-1' type='x-template') | |
.page | |
h1 ページ1 | |
img(src='img/page-1.gif' alt='page-1') |
This file contains 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
components.p1 = Vue.component('page-1', { | |
template: '#page-1' | |
}); |
This file contains 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
/* アニメーション */ | |
// 表示: 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; | |
} |
This file contains 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
Vue.transition('page', { | |
enterClass: 'fadeInUp', | |
leaveClass: 'slideOutRight', | |
}); |
This file contains 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
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