Created
October 10, 2017 18:08
-
-
Save cosbgn/4202549cab21f7fae83c7daf36f89b31 to your computer and use it in GitHub Desktop.
Vue.js Loader
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
<template> | |
<div> | |
<div class="spinner"> | |
<div class="cube1"></div> | |
<div class="cube2"></div> | |
</div> | |
<br /> | |
<div class='has-text-centered'> | |
<p class='subtitle' v-html='msg'></p> | |
</div> | |
</div> | |
</template> | |
<script> | |
export default { | |
name: 'Loader', | |
props: { msg: { default: 'Updating.. <br /> One Second..' }} | |
} | |
</script> | |
<style> | |
/*Transiction*/ | |
.fade-enter-active, .fade-leave-active { | |
transition: opacity .5s | |
} | |
.fade-enter, .fade-leave-to /* .fade-leave-active below version 2.1.8 */ { | |
opacity: 0 | |
} | |
/*Actual Loader*/ | |
.spinner { | |
margin: 100px auto; | |
width: 40px; | |
height: 40px; | |
position: relative; | |
} | |
.cube1, .cube2 { | |
background-color: #333; | |
width: 15px; | |
height: 15px; | |
position: absolute; | |
top: 0; | |
left: 0; | |
-webkit-animation: sk-cubemove 1.8s infinite ease-in-out; | |
animation: sk-cubemove 1.8s infinite ease-in-out; | |
} | |
.cube2 { | |
-webkit-animation-delay: -0.9s; | |
animation-delay: -0.9s; | |
} | |
@-webkit-keyframes sk-cubemove { | |
25% { -webkit-transform: translateX(42px) rotate(-90deg) scale(0.5) } | |
50% { -webkit-transform: translateX(42px) translateY(42px) rotate(-180deg) } | |
75% { -webkit-transform: translateX(0px) translateY(42px) rotate(-270deg) scale(0.5) } | |
100% { -webkit-transform: rotate(-360deg) } | |
} | |
@keyframes sk-cubemove { | |
25% { | |
transform: translateX(42px) rotate(-90deg) scale(0.5); | |
-webkit-transform: translateX(42px) rotate(-90deg) scale(0.5); | |
} 50% { | |
transform: translateX(42px) translateY(42px) rotate(-179deg); | |
-webkit-transform: translateX(42px) translateY(42px) rotate(-179deg); | |
} 50.1% { | |
transform: translateX(42px) translateY(42px) rotate(-180deg); | |
-webkit-transform: translateX(42px) translateY(42px) rotate(-180deg); | |
} 75% { | |
transform: translateX(0px) translateY(42px) rotate(-270deg) scale(0.5); | |
-webkit-transform: translateX(0px) translateY(42px) rotate(-270deg) scale(0.5); | |
} 100% { | |
transform: rotate(-360deg); | |
-webkit-transform: rotate(-360deg); | |
} | |
} | |
</style> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Css from: http://tobiasahlin.com/spinkit/