diff --git a/css/flipin.css b/css/flipin.css new file mode 100644 index 00000000..89811b16 --- /dev/null +++ b/css/flipin.css @@ -0,0 +1,801 @@ +/* +Animate.css - http://daneden.me/animate +LICENSED UNDER THE MIT LICENSE (MIT) + +Copyright (c) 2012 Dan Eden + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +.animated { + -webkit-animation-fill-mode: both; + -moz-animation-fill-mode: both; + -ms-animation-fill-mode: both; + -o-animation-fill-mode: both; + animation-fill-mode: both; + -webkit-animation-duration: 1s; + -moz-animation-duration: 1s; + -ms-animation-duration: 1s; + -o-animation-duration: 1s; + animation-duration: 1s; +} + +.animated.hinge { + -webkit-animation-duration: 2s; + -moz-animation-duration: 2s; + -ms-animation-duration: 2s; + -o-animation-duration: 2s; + animation-duration: 2s; +} + + + + + + + + + + + + +@-webkit-keyframes flipInUp { + 0% { + -webkit-transform: perspective(400px) rotateX(-90deg); + opacity: 0; + } + + 40% { + -webkit-transform: perspective(400px) rotateX(10deg); + } + + 70% { + -webkit-transform: perspective(400px) rotateX(-10deg); + } + + 100% { + -webkit-transform: perspective(400px) rotateX(0deg); + opacity: 1; + } +} +@-moz-keyframes flipInUp { + 0% { + -moz-transform: perspective(400px) rotateX(-90deg); + opacity: 0; + } + + 40% { + -moz-transform: perspective(400px) rotateX(10deg); + } + + 70% { + -moz-transform: perspective(400px) rotateX(-10deg); + } + + 100% { + -moz-transform: perspective(400px) rotateX(0deg); + opacity: 1; + } +} +@-o-keyframes flipInUp { + 0% { + -o-transform: perspective(400px) rotateX(-90deg); + opacity: 0; + } + + 40% { + -o-transform: perspective(400px) rotateX(10deg); + } + + 70% { + -o-transform: perspective(400px) rotateX(-10deg); + } + + 100% { + -o-transform: perspective(400px) rotateX(0deg); + opacity: 1; + } +} +@keyframes flipInUp { + 0% { + transform: perspective(400px) rotateX(-90deg); + opacity: 0; + } + + 40% { + transform: perspective(400px) rotateX(10deg); + } + + 70% { + transform: perspective(400px) rotateX(-10deg); + } + + 100% { + transform: perspective(400px) rotateX(0deg); + opacity: 1; + } +} + +.flipInUp { + -webkit-backface-visibility: visible !important; + -webkit-animation-name: flipInUp; + -moz-backface-visibility: visible !important; + -moz-animation-name: flipInUp; + -o-backface-visibility: visible !important; + -o-animation-name: flipInUp; + backface-visibility: visible !important; + animation-name: flipInUp; +} + +@-webkit-keyframes flipInDown { + 0% { + -webkit-transform: perspective(400px) rotateX(90deg); + opacity: 0; + } + + 40% { + -webkit-transform: perspective(400px) rotateX(-10deg); + } + + 70% { + -webkit-transform: perspective(400px) rotateX(10deg); + } + + 100% { + -webkit-transform: perspective(400px) rotateX(0deg); + opacity: 1; + } +} +@-moz-keyframes flipInDown { + 0% { + -moz-transform: perspective(400px) rotateX(90deg); + opacity: 0; + } + + 40% { + -moz-transform: perspective(400px) rotateX(-10deg); + } + + 70% { + -moz-transform: perspective(400px) rotateX(10deg); + } + + 100% { + -moz-transform: perspective(400px) rotateX(0deg); + opacity: 1; + } +} +@-o-keyframes flipInDown { + 0% { + -o-transform: perspective(400px) rotateX(90deg); + opacity: 0; + } + + 40% { + -o-transform: perspective(400px) rotateX(-10deg); + } + + 70% { + -o-transform: perspective(400px) rotateX(10deg); + } + + 100% { + -o-transform: perspective(400px) rotateX(0deg); + opacity: 1; + } +} +@keyframes flipInDown { + 0% { + transform: perspective(400px) rotateX(90deg); + opacity: 0; + } + + 40% { + transform: perspective(400px) rotateX(-10deg); + } + + 70% { + transform: perspective(400px) rotateX(10deg); + } + + 100% { + transform: perspective(400px) rotateX(0deg); + opacity: 1; + } +} + +.flipInDown { + -webkit-backface-visibility: visible !important; + -webkit-animation-name: flipInDown; + -moz-backface-visibility: visible !important; + -moz-animation-name: flipInDown; + -o-backface-visibility: visible !important; + -o-animation-name: flipInDown; + backface-visibility: visible !important; + animation-name: flipInDown; +} + +@-webkit-keyframes flipInLeft { + 0% { + -webkit-transform: perspective(400px) rotateY(90deg); + opacity: 0; + } + + 40% { + -webkit-transform: perspective(400px) rotateY(-10deg); + } + + 70% { + -webkit-transform: perspective(400px) rotateY(10deg); + } + + 100% { + -webkit-transform: perspective(400px) rotateY(0deg); + opacity: 1; + } +} +@-moz-keyframes flipInLeft { + 0% { + -moz-transform: perspective(400px) rotateY(90deg); + opacity: 0; + } + + 40% { + -moz-transform: perspective(400px) rotateY(-10deg); + } + + 70% { + -moz-transform: perspective(400px) rotateY(10deg); + } + + 100% { + -moz-transform: perspective(400px) rotateY(0deg); + opacity: 1; + } +} +@-o-keyframes flipInLeft { + 0% { + -o-transform: perspective(400px) rotateY(90deg); + opacity: 0; + } + + 40% { + -o-transform: perspective(400px) rotateY(-10deg); + } + + 70% { + -o-transform: perspective(400px) rotateY(10deg); + } + + 100% { + -o-transform: perspective(400px) rotateY(0deg); + opacity: 1; + } +} +@keyframes flipInLeft { + 0% { + transform: perspective(400px) rotateY(90deg); + opacity: 0; + } + + 40% { + transform: perspective(400px) rotateY(-10deg); + } + + 70% { + transform: perspective(400px) rotateY(10deg); + } + + 100% { + transform: perspective(400px) rotateY(0deg); + opacity: 1; + } +} + +.flipInLeft { + -webkit-backface-visibility: visible !important; + -webkit-animation-name: flipInLeft; + -moz-backface-visibility: visible !important; + -moz-animation-name: flipInLeft; + -o-backface-visibility: visible !important; + -o-animation-name: flipInLeft; + backface-visibility: visible !important; + animation-name: flipInLeft; +} + +@-webkit-keyframes flipInRight { + 0% { + -webkit-transform: perspective(400px) rotateY(-90deg); + opacity: 0; + } + + 40% { + -webkit-transform: perspective(400px) rotateY(10deg); + } + + 70% { + -webkit-transform: perspective(400px) rotateY(-10deg); + } + + 100% { + -webkit-transform: perspective(400px) rotateY(0deg); + opacity: 1; + } +} +@-moz-keyframes flipInRight { + 0% { + -moz-transform: perspective(400px) rotateY(-90deg); + opacity: 0; + } + + 40% { + -moz-transform: perspective(400px) rotateY(10deg); + } + + 70% { + -moz-transform: perspective(400px) rotateY(-10deg); + } + + 100% { + -moz-transform: perspective(400px) rotateY(0deg); + opacity: 1; + } +} +@-o-keyframes flipInRight { + 0% { + -o-transform: perspective(400px) rotateY(-90deg); + opacity: 0; + } + + 40% { + -o-transform: perspective(400px) rotateY(10deg); + } + + 70% { + -o-transform: perspective(400px) rotateY(-10deg); + } + + 100% { + -o-transform: perspective(400px) rotateY(0deg); + opacity: 1; + } +} +@keyframes flipInRight { + 0% { + transform: perspective(400px) rotateY(-90deg); + opacity: 0; + } + + 40% { + transform: perspective(400px) rotateY(10deg); + } + + 70% { + transform: perspective(400px) rotateY(-10deg); + } + + 100% { + transform: perspective(400px) rotateY(0deg); + opacity: 1; + } +} + +.flipInRight { + -webkit-backface-visibility: visible !important; + -webkit-animation-name: flipInRight; + -moz-backface-visibility: visible !important; + -moz-animation-name: flipInRight; + -o-backface-visibility: visible !important; + -o-animation-name: flipInRight; + backface-visibility: visible !important; + animation-name: flipInRight; +} + + + + + + + + + + + + + + + + + + + +/* Dismissal animation */ + +@-webkit-keyframes flipOutClose { + 0% { + -webkit-transform: perspective(400px) rotateX(0deg); + opacity: 1; + } + 100% { + -webkit-transform: perspective(400px) rotateX(90deg); + opacity: 0; + } +} + +@-moz-keyframes flipOutClose { + 0% { + -moz-transform: perspective(400px) rotateX(0deg); + opacity: 1; + } + 100% { + -moz-transform: perspective(400px) rotateX(90deg); + opacity: 0; + } +} + +@-o-keyframes flipOutClose { + 0% { + -o-transform: perspective(400px) rotateX(0deg); + opacity: 1; + } + 100% { + -o-transform: perspective(400px) rotateX(90deg); + opacity: 0; + } +} + +@keyframes flipOutClose { + 0% { + transform: perspective(400px) rotateX(0deg); + opacity: 1; + } + 100% { + transform: perspective(400px) rotateX(90deg); + opacity: 0; + } +} + +.flipOutClose { + -webkit-animation-name: flipOutClose; + -webkit-backface-visibility: visible !important; + -moz-animation-name: flipOutClose; + -moz-backface-visibility: visible !important; + -o-animation-name: flipOutClose; + -o-backface-visibility: visible !important; + animation-name: flipOutClose; + backface-visibility: visible !important; +} + + + + + + +/* Fallback fade-ins */ + + + +/* + +@-webkit-keyframes fadeInUp { + 0% { + opacity: 0; + -webkit-transform: translateY(20px); + } + + 100% { + opacity: 1; + -webkit-transform: translateY(0); + } +} + +@-moz-keyframes fadeInUp { + 0% { + opacity: 0; + -moz-transform: translateY(20px); + } + + 100% { + opacity: 1; + -moz-transform: translateY(0); + } +} + +@-o-keyframes fadeInUp { + 0% { + opacity: 0; + -o-transform: translateY(20px); + } + + 100% { + opacity: 1; + -o-transform: translateY(0); + } +} + +@keyframes fadeInUp { + 0% { + opacity: 0; + transform: translateY(20px); + } + + 100% { + opacity: 1; + transform: translateY(0); + } +} + + +.fadeInUp { + -webkit-animation-name: fadeInUp; + -moz-animation-name: fadeInUp; + -o-animation-name: fadeInUp; + animation-name: fadeInUp; +} +@-webkit-keyframes fadeInDown { + 0% { + opacity: 0; + -webkit-transform: translateY(-20px); + } + + 100% { + opacity: 1; + -webkit-transform: translateY(0); + } +} + +@-moz-keyframes fadeInDown { + 0% { + opacity: 0; + -moz-transform: translateY(-20px); + } + + 100% { + opacity: 1; + -moz-transform: translateY(0); + } +} + +@-o-keyframes fadeInDown { + 0% { + opacity: 0; + -ms-transform: translateY(-20px); + } + + 100% { + opacity: 1; + -ms-transform: translateY(0); + } +} + +@keyframes fadeInDown { + 0% { + opacity: 0; + transform: translateY(-20px); + } + + 100% { + opacity: 1; + transform: translateY(0); + } +} + +.fadeInDown { + -webkit-animation-name: fadeInDown; + -moz-animation-name: fadeInDown; + -o-animation-name: fadeInDown; + animation-name: fadeInDown; +} +@-webkit-keyframes fadeInLeft { + 0% { + opacity: 0; + -webkit-transform: translateX(-20px); + } + + 100% { + opacity: 1; + -webkit-transform: translateX(0); + } +} + +@-moz-keyframes fadeInLeft { + 0% { + opacity: 0; + -moz-transform: translateX(-20px); + } + + 100% { + opacity: 1; + -moz-transform: translateX(0); + } +} + +@-o-keyframes fadeInLeft { + 0% { + opacity: 0; + -o-transform: translateX(-20px); + } + + 100% { + opacity: 1; + -o-transform: translateX(0); + } +} + +@keyframes fadeInLeft { + 0% { + opacity: 0; + transform: translateX(-20px); + } + + 100% { + opacity: 1; + transform: translateX(0); + } +} + +.fadeInLeft { + -webkit-animation-name: fadeInLeft; + -moz-animation-name: fadeInLeft; + -o-animation-name: fadeInLeft; + animation-name: fadeInLeft; +} +@-webkit-keyframes fadeInRight { + 0% { + opacity: 0; + -webkit-transform: translateX(20px); + } + + 100% { + opacity: 1; + -webkit-transform: translateX(0); + } +} + +@-moz-keyframes fadeInRight { + 0% { + opacity: 0; + -moz-transform: translateX(20px); + } + + 100% { + opacity: 1; + -moz-transform: translateX(0); + } +} + +@-o-keyframes fadeInRight { + 0% { + opacity: 0; + -o-transform: translateX(20px); + } + + 100% { + opacity: 1; + -o-transform: translateX(0); + } +} + +@keyframes fadeInRight { + 0% { + opacity: 0; + transform: translateX(20px); + } + + 100% { + opacity: 1; + transform: translateX(0); + } +} + +.fadeInRight { + -webkit-animation-name: fadeInRight; + -moz-animation-name: fadeInRight; + -o-animation-name: fadeInRight; + animation-name: fadeInRight; +} + + +*/ + + + + +/* Very simple omnidirectional animation */ + + + +/* + +@-webkit-keyframes bounceIn { + 0% { + opacity: 0; + -webkit-transform: scale(.3); + } + + 50% { + opacity: 1; + -webkit-transform: scale(1.05); + } + + 70% { + -webkit-transform: scale(.9); + } + + 100% { + -webkit-transform: scale(1); + } +} + +@-moz-keyframes bounceIn { + 0% { + opacity: 0; + -moz-transform: scale(.3); + } + + 50% { + opacity: 1; + -moz-transform: scale(1.05); + } + + 70% { + -moz-transform: scale(.9); + } + + 100% { + -moz-transform: scale(1); + } +} + +@-o-keyframes bounceIn { + 0% { + opacity: 0; + -o-transform: scale(.3); + } + + 50% { + opacity: 1; + -o-transform: scale(1.05); + } + + 70% { + -o-transform: scale(.9); + } + + 100% { + -o-transform: scale(1); + } +} + +@keyframes bounceIn { + 0% { + opacity: 0; + transform: scale(.3); + } + + 50% { + opacity: 1; + transform: scale(1.05); + } + + 70% { + transform: scale(.9); + } + + 100% { + transform: scale(1); + } +} + +.bounceIn { + -webkit-animation-name: bounceIn; + -moz-animation-name: bounceIn; + -o-animation-name: bounceIn; + animation-name: bounceIn; +} + +*/ \ No newline at end of file diff --git a/css/flipin.less b/css/flipin.less new file mode 100644 index 00000000..e8885a39 --- /dev/null +++ b/css/flipin.less @@ -0,0 +1,474 @@ +/* +Animate.css - http://daneden.me/animate +LICENSED UNDER THE MIT LICENSE (MIT) + +Copyright (c) 2012 Dan Eden + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +@anim-duration: 1s; +@hinge-anim-duration: 2s; + +.animated { + -webkit-animation-fill-mode: both; + -moz-animation-fill-mode: both; + -ms-animation-fill-mode: both; + -o-animation-fill-mode: both; + animation-fill-mode: both; + -webkit-animation-duration: @anim-duration; + -moz-animation-duration: @anim-duration; + -ms-animation-duration: @anim-duration; + -o-animation-duration: @anim-duration; + animation-duration: @anim-duration; +} + +.animated.hinge { + -webkit-animation-duration: @hinge-anim-duration; + -moz-animation-duration: @hinge-anim-duration; + -ms-animation-duration: @hinge-anim-duration; + -o-animation-duration: @hinge-anim-duration; + animation-duration: @hinge-anim-duration; +} + + + + + + + + + + + + +@-webkit-keyframes flip-in-up { + 0% { + -webkit-transform: perspective(400px) rotateX(-90deg); + opacity: 0; + } + + 40% { + -webkit-transform: perspective(400px) rotateX(10deg); + } + + 70% { + -webkit-transform: perspective(400px) rotateX(-10deg); + } + + 100% { + -webkit-transform: perspective(400px) rotateX(0deg); + opacity: 1; + } +} +@-moz-keyframes flip-in-up { + 0% { + -moz-transform: perspective(400px) rotateX(-90deg); + opacity: 0; + } + + 40% { + -moz-transform: perspective(400px) rotateX(10deg); + } + + 70% { + -moz-transform: perspective(400px) rotateX(-10deg); + } + + 100% { + -moz-transform: perspective(400px) rotateX(0deg); + opacity: 1; + } +} +@-o-keyframes flip-in-up { + 0% { + -o-transform: perspective(400px) rotateX(-90deg); + opacity: 0; + } + + 40% { + -o-transform: perspective(400px) rotateX(10deg); + } + + 70% { + -o-transform: perspective(400px) rotateX(-10deg); + } + + 100% { + -o-transform: perspective(400px) rotateX(0deg); + opacity: 1; + } +} +@keyframes flip-in-up { + 0% { + transform: perspective(400px) rotateX(-90deg); + opacity: 0; + } + + 40% { + transform: perspective(400px) rotateX(10deg); + } + + 70% { + transform: perspective(400px) rotateX(-10deg); + } + + 100% { + transform: perspective(400px) rotateX(0deg); + opacity: 1; + } +} + +.flip-in-up { + -webkit-backface-visibility: visible !important; + -webkit-animation-name: flip-in-up; + -moz-backface-visibility: visible !important; + -moz-animation-name: flip-in-up; + -o-backface-visibility: visible !important; + -o-animation-name: flip-in-up; + backface-visibility: visible !important; + animation-name: flip-in-up; +} + +@-webkit-keyframes flip-in-down { + 0% { + -webkit-transform: perspective(400px) rotateX(90deg); + opacity: 0; + } + + 40% { + -webkit-transform: perspective(400px) rotateX(-10deg); + } + + 70% { + -webkit-transform: perspective(400px) rotateX(10deg); + } + + 100% { + -webkit-transform: perspective(400px) rotateX(0deg); + opacity: 1; + } +} +@-moz-keyframes flip-in-down { + 0% { + -moz-transform: perspective(400px) rotateX(90deg); + opacity: 0; + } + + 40% { + -moz-transform: perspective(400px) rotateX(-10deg); + } + + 70% { + -moz-transform: perspective(400px) rotateX(10deg); + } + + 100% { + -moz-transform: perspective(400px) rotateX(0deg); + opacity: 1; + } +} +@-o-keyframes flip-in-down { + 0% { + -o-transform: perspective(400px) rotateX(90deg); + opacity: 0; + } + + 40% { + -o-transform: perspective(400px) rotateX(-10deg); + } + + 70% { + -o-transform: perspective(400px) rotateX(10deg); + } + + 100% { + -o-transform: perspective(400px) rotateX(0deg); + opacity: 1; + } +} +@keyframes flip-in-down { + 0% { + transform: perspective(400px) rotateX(90deg); + opacity: 0; + } + + 40% { + transform: perspective(400px) rotateX(-10deg); + } + + 70% { + transform: perspective(400px) rotateX(10deg); + } + + 100% { + transform: perspective(400px) rotateX(0deg); + opacity: 1; + } +} + +.flip-in-down { + -webkit-backface-visibility: visible !important; + -webkit-animation-name: flip-in-down; + -moz-backface-visibility: visible !important; + -moz-animation-name: flip-in-down; + -o-backface-visibility: visible !important; + -o-animation-name: flip-in-down; + backface-visibility: visible !important; + animation-name: flip-in-down; +} + +@-webkit-keyframes flip-in-left { + 0% { + -webkit-transform: perspective(400px) rotateY(90deg); + opacity: 0; + } + + 40% { + -webkit-transform: perspective(400px) rotateY(-10deg); + } + + 70% { + -webkit-transform: perspective(400px) rotateY(10deg); + } + + 100% { + -webkit-transform: perspective(400px) rotateY(0deg); + opacity: 1; + } +} +@-moz-keyframes flip-in-left { + 0% { + -moz-transform: perspective(400px) rotateY(90deg); + opacity: 0; + } + + 40% { + -moz-transform: perspective(400px) rotateY(-10deg); + } + + 70% { + -moz-transform: perspective(400px) rotateY(10deg); + } + + 100% { + -moz-transform: perspective(400px) rotateY(0deg); + opacity: 1; + } +} +@-o-keyframes flip-in-left { + 0% { + -o-transform: perspective(400px) rotateY(90deg); + opacity: 0; + } + + 40% { + -o-transform: perspective(400px) rotateY(-10deg); + } + + 70% { + -o-transform: perspective(400px) rotateY(10deg); + } + + 100% { + -o-transform: perspective(400px) rotateY(0deg); + opacity: 1; + } +} +@keyframes flip-in-left { + 0% { + transform: perspective(400px) rotateY(90deg); + opacity: 0; + } + + 40% { + transform: perspective(400px) rotateY(-10deg); + } + + 70% { + transform: perspective(400px) rotateY(10deg); + } + + 100% { + transform: perspective(400px) rotateY(0deg); + opacity: 1; + } +} + +.flip-in-left { + -webkit-backface-visibility: visible !important; + -webkit-animation-name: flip-in-left; + -moz-backface-visibility: visible !important; + -moz-animation-name: flip-in-left; + -o-backface-visibility: visible !important; + -o-animation-name: flip-in-left; + backface-visibility: visible !important; + animation-name: flip-in-left; +} + +@-webkit-keyframes flip-in-right { + 0% { + -webkit-transform: perspective(400px) rotateY(-90deg); + opacity: 0; + } + + 40% { + -webkit-transform: perspective(400px) rotateY(10deg); + } + + 70% { + -webkit-transform: perspective(400px) rotateY(-10deg); + } + + 100% { + -webkit-transform: perspective(400px) rotateY(0deg); + opacity: 1; + } +} +@-moz-keyframes flip-in-right { + 0% { + -moz-transform: perspective(400px) rotateY(-90deg); + opacity: 0; + } + + 40% { + -moz-transform: perspective(400px) rotateY(10deg); + } + + 70% { + -moz-transform: perspective(400px) rotateY(-10deg); + } + + 100% { + -moz-transform: perspective(400px) rotateY(0deg); + opacity: 1; + } +} +@-o-keyframes flip-in-right { + 0% { + -o-transform: perspective(400px) rotateY(-90deg); + opacity: 0; + } + + 40% { + -o-transform: perspective(400px) rotateY(10deg); + } + + 70% { + -o-transform: perspective(400px) rotateY(-10deg); + } + + 100% { + -o-transform: perspective(400px) rotateY(0deg); + opacity: 1; + } +} +@keyframes flip-in-right { + 0% { + transform: perspective(400px) rotateY(-90deg); + opacity: 0; + } + + 40% { + transform: perspective(400px) rotateY(10deg); + } + + 70% { + transform: perspective(400px) rotateY(-10deg); + } + + 100% { + transform: perspective(400px) rotateY(0deg); + opacity: 1; + } +} + +.flip-in-right { + -webkit-backface-visibility: visible !important; + -webkit-animation-name: flip-in-right; + -moz-backface-visibility: visible !important; + -moz-animation-name: flip-in-right; + -o-backface-visibility: visible !important; + -o-animation-name: flip-in-right; + backface-visibility: visible !important; + animation-name: flip-in-right; +} + + + + + + + + + + + + + + + + + + + +/* Dismissal animation */ + +@-webkit-keyframes flipOutClose { + 0% { + -webkit-transform: perspective(400px) rotateX(0deg); + opacity: 1; + } + 100% { + -webkit-transform: perspective(400px) rotateX(90deg); + opacity: 0; + } +} + +@-moz-keyframes flipOutClose { + 0% { + -moz-transform: perspective(400px) rotateX(0deg); + opacity: 1; + } + 100% { + -moz-transform: perspective(400px) rotateX(90deg); + opacity: 0; + } +} + +@-o-keyframes flipOutClose { + 0% { + -o-transform: perspective(400px) rotateX(0deg); + opacity: 1; + } + 100% { + -o-transform: perspective(400px) rotateX(90deg); + opacity: 0; + } +} + +@keyframes flipOutClose { + 0% { + transform: perspective(400px) rotateX(0deg); + opacity: 1; + } + 100% { + transform: perspective(400px) rotateX(90deg); + opacity: 0; + } +} + +.flipOutClose { + -webkit-animation-name: flipOutClose; + -webkit-backface-visibility: visible !important; + -moz-animation-name: flipOutClose; + -moz-backface-visibility: visible !important; + -o-animation-name: flipOutClose; + -o-backface-visibility: visible !important; + animation-name: flipOutClose; + backface-visibility: visible !important; +} diff --git a/css/hopscotch.less b/css/hopscotch.less index 08df0f4b..dc555849 100644 --- a/css/hopscotch.less +++ b/css/hopscotch.less @@ -1,5 +1,6 @@ @import "util.less"; @import "bounce.less"; +@import "flipin.less"; @anim-duration: .5s; @bubbleCornerRadius: 10px; @@ -26,6 +27,10 @@ div#hopscotch-bubble { .transition('top, left', @anim-duration, ease-in-out); } + &.invisible { + opacity: 0; + } + &.hide, .hide, .hide-all { diff --git a/js/hopscotch.js b/js/hopscotch.js index b07a8237..eaf0c36a 100644 --- a/js/hopscotch.js +++ b/js/hopscotch.js @@ -35,7 +35,9 @@ waitingToStart = false, // is a tour waiting for the document to finish // loading so that it can start? hasSessionStorage = (typeof window.sessionStorage !== undefinedStr), - docStyle = document.body.style; + docStyle = document.body.style, + flipDuration = 2000, + closeDuration = 1000; if (winHopscotch) { // Hopscotch already exists. @@ -330,7 +332,8 @@ bubbleWidth = utils.getPixelValue(step.width) || opt.bubbleWidth; bubblePadding = utils.valOrDefault(step.padding, opt.bubblePadding); - utils.removeClass(el, 'bounce-down bounce-up bounce-left bounce-right'); + //utils.removeClass(el, 'bounce-down bounce-up bounce-left bounce-right'); + utils.removeClass(el, 'flip-in-down flip-in-up flip-in-left flip-in-right'); // SET POSITION boundingRect = targetEl.getBoundingClientRect(); @@ -338,22 +341,22 @@ bubbleHeight = el.offsetHeight; top = (boundingRect.top - bubbleHeight) - opt.arrowWidth; left = boundingRect.left; - bounceDirection = 'bounce-down'; + bounceDirection = 'flip-in-down'; } else if (step.orientation === 'bottom') { top = boundingRect.bottom + opt.arrowWidth; left = boundingRect.left; - bounceDirection = 'bounce-up'; + bounceDirection = 'flip-in-up'; } else if (step.orientation === 'left') { top = boundingRect.top; left = boundingRect.left - bubbleWidth - 2*bubblePadding - 2*bubbleBorder - opt.arrowWidth; - bounceDirection = 'bounce-right'; + bounceDirection = 'flip-in-right'; } else if (step.orientation === 'right') { top = boundingRect.top; left = boundingRect.right + opt.arrowWidth; - bounceDirection = 'bounce-left'; + bounceDirection = 'flip-in-left'; } // SET (OR RESET) ARROW OFFSETS @@ -385,6 +388,7 @@ el.style.left = left + 'px'; // Do the bouncing effect + /* if (bounce) { bounceDelay = opt.smoothScroll ? opt.scrollDuration : 0; @@ -394,12 +398,13 @@ // Then remove it setTimeout(function() { utils.removeClass(el, bounceDirection); - }, bounceDelay + 2000); // bounce lasts 2 seconds + }, bounceDelay + flipDuration); // bounce lasts 2 seconds } + */ } - }; + }, - this.init = function() { + init = function() { var el = document.createElement('div'), containerEl = document.createElement('div'), bubbleContentEl = document.createElement('div'), @@ -453,7 +458,7 @@ window.attachEvent('onresize', onWinResize); } - this.hide(); + utils.addClass(el, 'invisible'); document.body.appendChild(el); return this; }; @@ -547,6 +552,7 @@ this.setTitle(step.title ? step.title : ''); this.setContent(step.content ? step.content : ''); this.setNum(idx); + this.orientation = step.orientation; this.showPrevButton(this.prevBtnEl && showPrev && (idx > 0 || subIdx > 0)); this.showNextButton(this.nextBtnEl && showNext && !isLast); @@ -635,21 +641,45 @@ } }; + this.getArrowDirection = function() { + if (this.orientation === 'top') { + return 'down'; + } + if (this.orientation === 'bottom') { + return 'up'; + } + if (this.orientation === 'left') { + return 'right'; + } + if (this.orientation === 'right') { + return 'left'; + } + }; + this.show = function() { - var self = this; + var self = this, + className = 'flip-in-' + this.getArrowDirection(); + + utils.removeClass(this.element, 'hide'); if (opt.animate) { setTimeout(function() { utils.addClass(self.element, 'animate'); }, 50); } - utils.removeClass(this.element, 'hide'); + else { + utils.removeClass(self.element, 'hide'); + utils.addClass(self.element, className); + } isShowing = true; return this; }; this.hide = function() { - utils.addClass(this.element, 'hide'); - utils.removeClass(this.element, 'animate'); + var el = this.element; + el.style.top = ''; + el.style.left = ''; + utils.addClass(el, 'hide'); + utils.removeClass(el, 'animate invisible flip-in-up flip-in-down flip-in-right flip-in-left'); isShowing = false; return this; }; @@ -693,7 +723,7 @@ utils.removeClass(this.element, 'animate'); }; - this.init(); + init.call(this); }; Hopscotch = function(initOptions) { @@ -783,7 +813,8 @@ * to bring it back into the viewport. */ adjustWindowScroll = function() { - var bubbleEl = getBubble().element, + var bubble = getBubble(), + bubbleEl = bubble.element, bubbleTop = utils.getPixelValue(bubbleEl.style.top), bubbleBottom = bubbleTop + utils.getPixelValue(bubbleEl.offsetHeight), targetEl = utils.getStepTarget(getCurrStep()), @@ -821,6 +852,7 @@ } if (targetTop >= windowTop && targetTop <= windowTop + opt.scrollTopMargin) { + bubble.show(); return; } @@ -842,6 +874,7 @@ // and clear the interval scrollTarget = scrollToVal; clearInterval(scrollInt); + bubble.show(); } window.scrollTo(0, scrollTarget); @@ -849,11 +882,13 @@ if (utils.getScrollTop() === scrollTop) { // Couldn't scroll any further. Clear interval. clearInterval(scrollInt); + bubble.show(); } }, 10); } else { window.scrollTo(0, scrollToVal); + bubble.show(); } } }, @@ -985,7 +1020,7 @@ } this.showStep(currStepNum, currSubstepNum); - bubble = getBubble().show(); + bubble = getBubble(); if (opt.animate) { bubble.initAnimate(); @@ -1024,7 +1059,9 @@ this.prevStep = function() { var step = getCurrStep(), - foundTarget = false; + foundTarget = false, + bubble = getBubble(), + self = this; utils.invokeCallbacks('prev', [currTour.id, currStepNum]); if (step.onPrev) { @@ -1055,13 +1092,16 @@ } } - this.showStep(currStepNum, currSubstepNum); + utils.addClass(bubble.element, 'invisible'); + self.showStep(currStepNum, currSubstepNum); + return this; }; this.nextStep = function() { - var step = getCurrStep(), - foundTarget = false; + var step = getCurrStep(), + foundTarget = false, + bubble = getBubble(); // invoke Next button callbacks utils.invokeCallbacks('next', [currTour.id, currStepNum]); @@ -1093,6 +1133,8 @@ return this.endTour(true, false); } } + + utils.addClass(bubble.element, 'invisible'); this.showStep(currStepNum, currSubstepNum); return this;