Reverse opacity animation on mouse out after hover - html

I'm wondering if it is possible to reverse a keyframes animation on mouse out after hover without using JavaScript (that's a requirement for a project I'm working on). I have tried animation-direction: alternate; and animation-direction: reverse on the original .molehill selector and on the .molehill:hover > img selector without any luck. See JSFiddle for current status, but essentially the mole is animated to come out of the molehill on hover. When you remove the mouse, he disappears, but I would rather have the animation reverse so it looks like he's slowly going back in.
HTML:
<div class="molehill">
<div>
<img id="m1" src="http://uf.heatherlaude.com/img_directory/molehill-1.png" alt="mole">
</div>
<img id="m2" src="http://uf.heatherlaude.com/img_directory/molehill-2.png" alt="mole">
<img id="m3" src="http://uf.heatherlaude.com/img_directory/molehill-3.png" alt="mole">
<img id="m4" src="http://uf.heatherlaude.com/img_directory/molehill-4.png" alt="mole">
<img id="m5" src="http://uf.heatherlaude.com/img_directory/molehill-5.png" alt="mole">
<img id="m6" src="http://uf.heatherlaude.com/img_directory/molehill-6.png" alt="mole">
<img id="m7" src="http://uf.heatherlaude.com/img_directory/molehill-7.png" alt="mole">
<img id="m8" src="http://uf.heatherlaude.com/img_directory/molehill-8.png" alt="mole">
</div>
CSS:
.molehill {
width: 359px;
height:250px;
position: relative;
}
.molehill > img {
transition: 1s;
}
#m1, #m2, #m3, #m4, #m5, #m6, #m7, #m8 {
position: absolute;
width: 100%
height: 100%;
}
#m2, #m3, #m4, #m5, #m6, #m7, #m8 {
opacity: 0;
}
.molehill:hover > img {
animation-name: molehill_test;
-webkit-animation-name: molehill_test;
animation-duration: 3.25s;
-webkit-animation-duration: 3.25s;
animation-fill-mode: forwards;
-webkit-animation-fill-mode: forwards;
animation-iteration-count: 1;
-webkit-animation-iteration-count: 1;
}
#m2 {
animation-delay:.25s;
-webkit-animation-delay:.25s
}
#m3 {
animation-delay:.75s;
-webkit-animation-delay:.75s
}
#m4 {
animation-delay:1.25s;
-webkit-animation-delay:1.25s
}
#m5 {
animation-delay:1.75s;
-webkit-animation-delay:1.75s
}
#m6 {
animation-delay:2.25s;
-webkit-animation-delay:2.25s
}
#m7 {
animation-delay:2.75s;
-webkit-animation-delay:2.75s
}
#m8 {
animation-delay:3.25s;
-webkit-animation-delay:3.25s
}
#keyframes molehill_test {
0% {
opacity: 0;
}
50% {
opacity: 1;
}
100% {
opacity: 1;
}
}
#-webkit-keyframes molehill_test {
0% {
opacity: 0;
}
50% {
opacity: 1;
}
100% {
opacity: 1;
}
}
Full code on JSFiddle:
https://jsfiddle.net/qmgy4133/

it's possible with the help of jquery
$('#trigger').on({
mouseenter: function() {
$('#item').show();
$('#item').addClass('flipped');
},
mouseleave: function() {
$('#item').removeClass('flipped');
}
});
#trigger {
position: relative;
display: inline-block;
padding: 5px 10px;
margin: 0 0 10px 0;
background: teal;
color: white;
font-family: sans-serif;
}
#item {
position: relative;
height: 100px;
width: 100px;
background: red;
display: none;
-webkit-transform: perspective(350px) rotateX(-90deg);
transform: perspective(350px) rotateX(-90deg);
-webkit-transform-origin: 50% 0%;
transform-origin: 50% 0%;
animation: flipperUp 0.7s;
animation-fill-mode: forwards;
-webkit-animation: flipperUp 0.7s;
-webkit-animation-fill-mode: forwards;
}
#item.flipped {
animation: flipper 0.7s;
animation-fill-mode: forwards;
-webkit-animation: flipper 0.7s;
-webkit-animation-fill-mode: forwards;
}
#keyframes flipper {
0% {
transform: perspective(350px) rotateX(-90deg);
}
33% {
transform: perspective(350px) rotateX(0deg);
}
66% {
transform: perspective(350px) rotateX(10deg);
}
100% {
transform: perspective(350px) rotateX(0deg);
}
}
#-webkit-keyframes flipper {
0% {
-webkit-transform: perspective(350px) rotateX(-90deg);
}
33% {
-webkit-transform: perspective(350px) rotateX(0deg);
}
66% {
-webkit-transform: perspective(350px) rotateX(10deg);
}
100% {
-webkit-transform: perspective(350px) rotateX(0deg);
}
}
#keyframes flipperUp {
0% {
transform: perspective(350px) rotateX(0deg);
}
33% {
transform: perspective(350px) rotateX(10deg);
}
66% {
transform: perspective(350px) rotateX(0deg);
}
100% {
transform: perspective(350px) rotateX(-90deg);
}
}
#-webkit-keyframes flipperUp {
0% {
-webkit-transform: perspective(350px) rotateX(0deg);
}
33% {
-webkit-transform: perspective(350px) rotateX(10deg);
}
66% {
-webkit-transform: perspective(350px) rotateX(0deg);
}
100% {
-webkit-transform: perspective(350px) rotateX(-90deg);
}
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id='trigger'>Hover Me</div>
<div id='item'></div>
this is only example

Related

Centering a span inside a div

I have a rotating text slider on my website that uses keyframe transitions.
I have all the text centered but the text inside the span sits to the side and I have tried everything I can think of to center it with no job.
/*Sentence*/
.sentence{
color: #999;
font-size: 3em;
text-align:center;
}
/*Wrapper*/
.wrapper{
font-family: serif;
text-align:center;
position: relative;
width: 100%;
}
/*Vertical Sliding*/
.slidingVertical{
display: inline;
}
.slidingVertical span{
animation: topToBottom 12.5s linear infinite 0s;
-ms-animation: topToBottom 12.5s linear infinite 0s;
-webkit-animation: topToBottom 12.5s linear infinite 0s;
color: #00abe9;
opacity: 0;
overflow: hidden;
position: absolute;
}
.slidingVertical span:nth-child(2){
animation-delay: 2.5s;
-ms-animation-delay: 2.5s;
-webkit-animation-delay: 2.5s;
}
.slidingVertical span:nth-child(3){
animation-delay: 5s;
-ms-animation-delay: 5s;
-webkit-animation-delay: 5s;
}
.slidingVertical span:nth-child(4){
animation-delay: 7.5s;
-ms-animation-delay: 7.5s;
-webkit-animation-delay: 7.5s;
}
.slidingVertical span:nth-child(5){
animation-delay: 10s;
-ms-animation-delay: 10s;
-webkit-animation-delay: 10s;
}
/*topToBottom Animation*/
#-moz-keyframes topToBottom{
0% { opacity: 0; }
5% { opacity: 0; -moz-transform: translateY(-50px); }
10% { opacity: 1; -moz-transform: translateY(0px); }
25% { opacity: 1; -moz-transform: translateY(0px); }
30% { opacity: 0; -moz-transform: translateY(50px); }
80% { opacity: 0; }
100% { opacity: 0; }
}
#-webkit-keyframes topToBottom{
0% { opacity: 0; }
5% { opacity: 0; -webkit-transform: translateY(-50px); }
10% { opacity: 1; -webkit-transform: translateY(0px); }
25% { opacity: 1; -webkit-transform: translateY(0px); }
30% { opacity: 0; -webkit-transform: translateY(50px); }
80% { opacity: 0; }
100% { opacity: 0; }
}
#-ms-keyframes topToBottom{
0% { opacity: 0; }
5% { opacity: 0; -ms-transform: translateY(-50px); }
10% { opacity: 1; -ms-transform: translateY(0px); }
25% { opacity: 1; -ms-transform: translateY(0px); }
30% { opacity: 0; -ms-transform: translateY(50px); }
80% { opacity: 0; }
100% { opacity: 0; }
}
<section class="wrapper">
<div class="sentence">
<p>header text - why use our service</p>
<div class="slidingVertical">
<span style="color:white; background:#018fcf">Best service on the market</span>
<span style="color:white; background:#0e7dcb">reason 1</span>
<span style="color:white; background:#1977B0">Long reason 2 - best value for money</span>
<span style="color:white; background:#276cb1">reason 3</span>
<span style="color:white; background:#125eaa">reason 5</span>
</div>
<br>
<p>footer text - service is epic</p>
</div>
</section>
Also as you will see, the span doesnt fit to the size of the text and forces the text to wrap.
I have tried increasing the div and span to 100% width but that seems to decrease it to 0 for some strange reason.
It's because you position your spans absolutely - you need to center that absolute by adding left:50% and translating the x back -50%
I have also added position relative to your container:
/*Sentence*/
.sentence{
color: #999;
font-size: 3em;
text-align:center;
}
/*Wrapper*/
.wrapper{
font-family: serif;
text-align:center;
position: relative;
width: 100%;
}
/*Vertical Sliding*/
.slidingVertical{
position:relative;
}
.slidingVertical span{
animation: topToBottom 12.5s linear infinite 0s;
-ms-animation: topToBottom 12.5s linear infinite 0s;
-webkit-animation: topToBottom 12.5s linear infinite 0s;
color: #00abe9;
opacity: 0;
overflow: hidden;
position: absolute;
left: 50%;
transform: translate(-50%, 0);
}
.slidingVertical span:nth-child(2){
animation-delay: 2.5s;
-ms-animation-delay: 2.5s;
-webkit-animation-delay: 2.5s;
}
.slidingVertical span:nth-child(3){
animation-delay: 5s;
-ms-animation-delay: 5s;
-webkit-animation-delay: 5s;
}
.slidingVertical span:nth-child(4){
animation-delay: 7.5s;
-ms-animation-delay: 7.5s;
-webkit-animation-delay: 7.5s;
}
.slidingVertical span:nth-child(5){
animation-delay: 10s;
-ms-animation-delay: 10s;
-webkit-animation-delay: 10s;
}
/*topToBottom Animation*/
#-moz-keyframes topToBottom{
0% { opacity: 0; -moz-transform: translate(-50%, -50px); }
5% { opacity: 0; -moz-transform: translate(-50%, -50px); }
10% { opacity: 1; -moz-transform: translate(-50%, 0px); }
25% { opacity: 1; -moz-transform: translate(-50%, 0px); }
30% { opacity: 0; -moz-transform: translate(-50%, 50px); }
80% { opacity: 0; -moz-transform: translate(-50%, 50px); }
100% { opacity: 0; -moz-transform: translate(-50%, 50px); }
}
#-webkit-keyframes topToBottom{
0% { opacity: 0; -webkit-transform: translate(-50%, -50px); }
5% { opacity: 0; -webkit-transform: translate(-50%, -50px); }
10% { opacity: 1; -webkit-transform: translate(-50%, 0px); }
25% { opacity: 1; -webkit-transform: translate(-50%, 0px); }
30% { opacity: 0; -webkit-transform: translate(-50%, 50px); }
80% { opacity: 0; -webkit-transform: translate(-50%, 50px); }
100% { opacity: 0; -webkit-transform: translate(-50%, 50px); }
}
#-ms-keyframes topToBottom{
0% { opacity: 0; -ms-transform: translate(-50%, -50px); }
5% { opacity: 0; -ms-transform: translate(-50%, -50px); }
10% { opacity: 1; -ms-transform: translate(-50%, 0px); }
25% { opacity: 1; -ms-transform: translate(-50%, 0px); }
30% { opacity: 0; -ms-transform: translate(-50%, 50px); }
80% { opacity: 0;-ms-transform: translate(-50%, 50px); }
100% { opacity: 0;-ms-transform: translate(-50%, 50px); }
}
<section class="wrapper">
<div class="sentence">
<p>header text - why use our service</p>
<div class="slidingVertical">
<span style="color:white; background:#018fcf">Best service on the market</span>
<span style="color:white; background:#0e7dcb">reason 1</span>
<span style="color:white; background:#1977B0">Long reason 2 - best value for money</span>
<span style="color:white; background:#276cb1">reason 3</span>
<span style="color:white; background:#125eaa">reason 5</span>
</div>
<br>
<p>footer text - service is epic</p>
</div>
</section>

css animation+transition triggered timed every 10 seconds AND on hover

i'm using this code to trigger a css animation every 10 seconds
#keyframes tada_9122 {
0% { transform: scale(1) }
0.63291% { transform:scale(.9) rotate(-2deg) }
1.26582% { transform:scale(.9) rotate(-1deg) }
1.89873% { transform:scale(1.1) rotate(2deg) }
2.53165% { transform:scale(1.1) rotate(-1deg) }
3.16456% { transform:scale(1.1) rotate(2deg) }
3.79747% { transform:scale(1.1) rotate(-1deg) }
4.43038% { transform:scale(1.1) rotate(1deg) }
5.06329% { transform:scale(1) rotate(0) }
100% { transform:scale(1) rotate(0) }
}
.callToAction {
animation: tada_9122 10s linear infinite;
transform-origin: 50% 50%;
}
<div class="callToAction" style="width:100px;height:100px;background-color:red;">
</div>
But how can i also trigger the same animation when hovering .callToAction ?
This doesn't work:
.callToAction:hover {
animation: tada_9122 10s;
transform-origin: 50% 50%;
}
The solution for that is to create another keyframe with another name and use when hovering
#keyframes tada_9122 {
0% {
transform: scale(1)
}
0.63291% {
transform: scale(.9) rotate(-2deg)
}
1.26582% {
transform: scale(.9) rotate(-1deg)
}
1.89873% {
transform: scale(1.1) rotate(2deg)
}
2.53165% {
transform: scale(1.1) rotate(-1deg)
}
3.16456% {
transform: scale(1.1) rotate(2deg)
}
3.79747% {
transform: scale(1.1) rotate(-1deg)
}
4.43038% {
transform: scale(1.1) rotate(1deg)
}
5.06329% {
transform: scale(1) rotate(0)
}
100% {
transform: scale(1) rotate(0)
}
}
#keyframes tada_9122_2 {
0% {
transform: scale(1)
}
0.63291% {
transform: scale(.9) rotate(-2deg)
}
1.26582% {
transform: scale(.9) rotate(-1deg)
}
1.89873% {
transform: scale(1.1) rotate(2deg)
}
2.53165% {
transform: scale(1.1) rotate(-1deg)
}
3.16456% {
transform: scale(1.1) rotate(2deg)
}
3.79747% {
transform: scale(1.1) rotate(-1deg)
}
4.43038% {
transform: scale(1.1) rotate(1deg)
}
5.06329% {
transform: scale(1) rotate(0)
}
100% {
transform: scale(1) rotate(0)
}
}
.callToAction {
animation: tada_9122 10s linear infinite;
animation-delay: 1s;
transform-origin: 50% 50%;
}
.callToAction:hover {
animation: tada_9122_2 10s linear infinite;
transform-origin: 50% 50%;
}
<div class="callToAction" style="width:100px;height:100px;background-color:red;">
</div>
it will not work because you run the animation on the class for infinite and every 10s on the parent class you called .callToAction, so it as usual run the animation on the parent every 10s and not work the other animation in the same time when you hover on the same class, its already have animated,
solution: you can remove animation on the parent and run your animation just on the .callToAction:hover, it will work successfully,
or
The trick is to put your div callToAction inside another div with some class parent_callToAction and give animation to it on hover.
<div class="parent_callToAction">
<div class="callToAction"></div>
</div>
Also, give both the div the same dimension
.callToAction, .parent_callToAction{
width:100px;
height:100px;
background-color:red;
}
Here, is a SNIPPET
#keyframes tada_9122 {
0% { transform: scale(1) }
0.63291% { transform:scale(.9) rotate(-2deg) }
1.26582% { transform:scale(.9) rotate(-1deg) }
1.89873% { transform:scale(1.1) rotate(2deg) }
2.53165% { transform:scale(1.1) rotate(-1deg) }
3.16456% { transform:scale(1.1) rotate(2deg) }
3.79747% { transform:scale(1.1) rotate(-1deg) }
4.43038% { transform:scale(1.1) rotate(1deg) }
5.06329% { transform:scale(1) rotate(0) }
100% { transform:scale(1) rotate(0) }
}
.callToAction {
animation: tada_9122 10s ease infinite;
transform-origin: 50% 50%;
}
.parent_callToAction:hover{
animation: tada_9122 10s linear infinite;
transform-origin: 50% 50%;
}
.callToAction, .parent_callToAction{
width:100px;
height:100px;
background-color:red;
}
<div class="parent_callToAction">
<div class="callToAction"></div>
</div>

Cannot Move CSS Loader Container

I have a problem regarding the positioning of my container.
Keeping the styles whilst removing the position: absolute; on the .dot seems to be proving rather tricky and with each attempt the dots are going all over the place!
To clarify, I'm looking at being able to move the entire loader
.sampleContainer {
float: left;
height: 40px;
width: 60px;
background: white;
}
.loader {
display: inline-block;
float: left;
margin-left:100px;
}
.dot {
display: inline-block;
width: 8px;
height: 8px;
border-radius: 4px;
background: #888;
position: absolute;
}
.dot_1 {
animation: animateDot1 1.5s linear infinite;
left: 12px;
/**background: #e579b8;**/
}
.dot_2 {
animation: animateDot2 1.5s linear infinite;
animation-delay: 0.5s;
left: 24px;
}
.dot_3 {
animation: animateDot3 1.5s linear infinite;
left: 12px;
}
.dot_4 {
animation: animateDot4 1.5s linear infinite;
animation-delay: 0.5s;
left: 24px;
}
#keyframes animateDot1 {
0% { transform: rotate(0deg) translateX(-12px); }
25% { transform: rotate(180deg) translateX(-12px); }
75% { transform: rotate(180deg) translateX(-12px); }
100% { transform: rotate(360deg) translateX(-12px); }
}
#keyframes animateDot2 {
0% { transform: rotate(0deg) translateX(-12px); }
25% { transform: rotate(-180deg) translateX(-12px); }
75% { transform: rotate(-180deg) translateX(-12px); }
100% { transform: rotate(-360deg) translateX(-12px); }
}
#keyframes animateDot3 {
0% { transform: rotate(0deg) translateX(12px); }
25% { transform: rotate(180deg) translateX(12px); }
75% { transform: rotate(180deg) translateX(12px); }
100% { transform: rotate(360deg) translateX(12px); }
}
#keyframes animateDot4 {
0% { transform: rotate(0deg) translateX(12px); }
25% { transform: rotate(-180deg) translateX(12px); }
75% { transform: rotate(-180deg) translateX(12px); }
100% { transform: rotate(-360deg) translateX(12px); }
}
<div class="sampleContainer">
<div class="loader">
<span class="dot dot_1"></span>
<span class="dot dot_2"></span>
<span class="dot dot_3"></span>
<span class="dot dot_4"></span>
</div>
</div>
you need to set position:relative to parent, otherwise it will be out of the DOM flow.
As for my tests you don't need the .loader CSS
.sampleContainer {
float: left;
height: 40px;
width: 60px;
background: white;
position: relative;
background: lightblue;
}
.dot {
display: inline-block;
width: 8px;
height: 8px;
border-radius: 4px;
background: #888;
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
margin: 15px 8px
}
.dot_1 {
animation: animateDot1 1.5s linear infinite;
left: 12px;
/**background: #e579b8;**/
}
.dot_2 {
animation: animateDot2 1.5s linear infinite;
animation-delay: 0.5s;
left: 24px;
}
.dot_3 {
animation: animateDot3 1.5s linear infinite;
left: 12px;
}
.dot_4 {
animation: animateDot4 1.5s linear infinite;
animation-delay: 0.5s;
left: 24px;
}
#keyframes animateDot1 {
0% {
transform: rotate(0deg) translateX(-12px);
}
25% {
transform: rotate(180deg) translateX(-12px);
}
75% {
transform: rotate(180deg) translateX(-12px);
}
100% {
transform: rotate(360deg) translateX(-12px);
}
}
#keyframes animateDot2 {
0% {
transform: rotate(0deg) translateX(-12px);
}
25% {
transform: rotate(-180deg) translateX(-12px);
}
75% {
transform: rotate(-180deg) translateX(-12px);
}
100% {
transform: rotate(-360deg) translateX(-12px);
}
}
#keyframes animateDot3 {
0% {
transform: rotate(0deg) translateX(12px);
}
25% {
transform: rotate(180deg) translateX(12px);
}
75% {
transform: rotate(180deg) translateX(12px);
}
100% {
transform: rotate(360deg) translateX(12px);
}
}
#keyframes animateDot4 {
0% {
transform: rotate(0deg) translateX(12px);
}
25% {
transform: rotate(-180deg) translateX(12px);
}
75% {
transform: rotate(-180deg) translateX(12px);
}
100% {
transform: rotate(-360deg) translateX(12px);
}
}
<div style="float:left">Deleting 'Folder Name' folder</div>
<div class="sampleContainer">
<div class="loader">
<span class="dot dot_1"></span>
<span class="dot dot_2"></span>
<span class="dot dot_3"></span>
<span class="dot dot_4"></span>
</div>
</div>

Sass/CSS folding triangles in hexagon

I'm trying to create a folding effect in a hexagon composed of triangles. So far I've only managed to make the triangles translate instead of folding over. I want to make
this http://jsfiddle.net/zn6jbhr6/
Relevant SCSS
#mixin hexTranslateKeyFrames($name, $degree) {
#keyframes #{$name} {
#content;
}
}
$hex-degree: 0deg;
#for $idx from 1 through 6 {
$hex-degree: $hex-degree + 60;
#include hexTranslateKeyFrames(hexTranslate#{$idx}, $hex-degree) {
0% { transform: rotateZ(0deg) rotate($hex-degree); }
54.55%, 100% { transform: rotateZ(360deg) rotate($hex-degree); }
}
}
$order2: (0s, 0.2s, 0.4s, 0.6s, 0.8s, 1s);
.folding-hex {
#include hexagon();
#for $i from 1 through 6 {
.triangle:nth-child(#{$i}) {
animation: hexTranslate#{$i} 2.2s infinite #{nth($order2, $i)} linear;
}
}
}
more like this http://jsfiddle.net/wvm15yL4/
Relevant CSS
.sk-folding-cube .sk-cube {
float: left;
width: 50%;
height: 50%;
position: relative;
-webkit-transform: scale(1.1);
-ms-transform: scale(1.1);
transform: scale(1.1);
}
.sk-folding-cube .sk-cube:before {
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: #333;
-webkit-animation: sk-foldCubeAngle 2.4s infinite linear both;
animation: sk-foldCubeAngle 2.4s infinite linear both;
-webkit-transform-origin: 100% 100%;
-ms-transform-origin: 100% 100%;
transform-origin: 100% 100%;
}
.sk-folding-cube .sk-cube2 {
-webkit-transform: scale(1.1) rotateZ(90deg);
transform: scale(1.1) rotateZ(90deg);
}
.sk-folding-cube .sk-cube3 {
-webkit-transform: scale(1.1) rotateZ(180deg);
transform: scale(1.1) rotateZ(180deg);
}
.sk-folding-cube .sk-cube4 {
-webkit-transform: scale(1.1) rotateZ(270deg);
transform: scale(1.1) rotateZ(270deg);
}
.sk-folding-cube .sk-cube2:before {
-webkit-animation-delay: 0.3s;
animation-delay: 0.3s;
}
.sk-folding-cube .sk-cube3:before {
-webkit-animation-delay: 0.6s;
animation-delay: 0.6s;
}
.sk-folding-cube .sk-cube4:before {
-webkit-animation-delay: 0.9s;
animation-delay: 0.9s;
}
#-webkit-keyframes sk-foldCubeAngle {
0%, 10% {
-webkit-transform: perspective(140px) rotateX(-180deg);
transform: perspective(140px) rotateX(-180deg);
opacity: 0;
} 25%, 75% {
-webkit-transform: perspective(140px) rotateX(0deg);
transform: perspective(140px) rotateX(0deg);
opacity: 1;
} 90%, 100% {
-webkit-transform: perspective(140px) rotateY(180deg);
transform: perspective(140px) rotateY(180deg);
opacity: 0;
}
}
#keyframes sk-foldCubeAngle {
0%, 10% {
-webkit-transform: perspective(140px) rotateX(-180deg);
transform: perspective(140px) rotateX(-180deg);
opacity: 0;
} 25%, 75% {
-webkit-transform: perspective(140px) rotateX(0deg);
transform: perspective(140px) rotateX(0deg);
opacity: 1;
} 90%, 100% {
-webkit-transform: perspective(140px) rotateY(180deg);
transform: perspective(140px) rotateY(180deg);
opacity: 0;
}
}
You need to create an animation that rotates in 3D.
Since it is a little hard, I have done it only once, and reused it for the other elements setting an intermediate element in the DOM that does the rotation in the plane
The first 2 parameters in the rotate3D are sin(60deg) and cos(60deg), to make the rotation axis be at 60 deg
#keyframes flip {
0% { transform: rotate3d( 0.5, 0.866, 0, 90deg);
opacity: 0;}
0.1% { transform: rotate3d( 0.5, 0.866, 0, 90deg);
opacity: 1;}
14% { transform: rotate3d( 0.5, 0.866, 0, 0deg); }
50% { transform: rotate3d(-0.5, 0.866, 0, 0deg); }
63.99% { transform: rotate3d(-0.5, 0.866, 0, -90deg);
opacity: 1;}
64%, 100% { transform: rotate3d(-0.5, 0.866, 0, -90deg);
opacity: 0}
}
.folding-hex {
height: 69.28px;
width: 80px;
position: relative;
margin: 0 auto;
transform-origin: 0 0;
transform: translateX(40px) rotate(30deg); }
.rotator {
transform-origin: 20px 37.64px;
}
.rotator:nth-child(1) {
transform: rotate(0deg);
}
.rotator:nth-child(2) {
transform: rotate(60deg);
}
.rotator:nth-child(3) {
transform: rotate(120deg);
}
.rotator:nth-child(4) {
transform: rotate(180deg);
}
.rotator:nth-child(5) {
transform: rotate(240deg);
}
.rotator:nth-child(6) {
transform: rotate(300deg);
}
.triangle {
position: absolute;
width: 0;
height: 0;
border-style: solid;
border-width: 34.64px 20px 0;
transform-origin: 20px 37.64px;
border-color: #E50C4E transparent;
animation: flip 3s linear infinite;
}
.rotator:nth-child(2) .triangle {
border-color: #b5093d transparent;
animation-delay: -2.5s;
}
.rotator:nth-child(3) .triangle {
border-color: #b5093d transparent;
animation-delay: -2.0s;
}
.rotator:nth-child(4) .triangle {
animation-delay: -1.5s;
}
.rotator:nth-child(5) .triangle {
border-color: #f8799f transparent;
animation-delay: -1.0s;
}
.rotator:nth-child(6) .triangle {
border-color: #f8799f transparent;
animation-delay: -0.5s;
}
<div class="folding-hex">
<div class="rotator">
<div class="triangle"></div>
</div>
<div class="rotator">
<div class="triangle"></div>
</div>
<div class="rotator">
<div class="triangle"></div>
</div>
<div class="rotator">
<div class="triangle"></div>
</div>
<div class="rotator">
<div class="triangle"></div>
</div>
<div class="rotator">
<div class="triangle"></div>
</div>
</div>

CSS bounceInDown effect not working

I'm trying to achieve a "bounceInDown" effect like on this webpage, but nothing happens. Would you know what is wrong? See jsfiddle: http://jsfiddle.net/N2Yx9/
HTML:
<div id="box" class="bounceInDown">test</div>
CSS:
#box {
position: absolute;
top: 317px;
left: 295px;
padding: 20px 20px 20px 55px;
text-decoration: none;
background:#0F6
}
/*
Animate.css - http://daneden.me/animate
*/
.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 fadeIn {
0% {opacity: 0;} 100% {opacity: 1;}
}
#-moz-keyframes fadeIn {
0% {opacity: 0;}
100% {opacity: 1;}
}
#-o-keyframes fadeIn {
0% {opacity: 0;}
100% {opacity: 1;}
}
#keyframes fadeIn {
0% {opacity: 0;}
100% {opacity: 1;}
}
.fadeIn {
-webkit-animation-name: fadeIn;
-moz-animation-name: fadeIn;
-o-animation-name: fadeIn;
animation-name: fadeIn;
}
#-webkit-keyframes fadeInDownBig {
0% {
opacity: 0;
-webkit-transform: translateY(-2000px);
}
100% {
opacity: 1;
-webkit-transform: translateY(0);
}
}
#-moz-keyframes fadeInDownBig {
0% {
opacity: 0;
-moz-transform: translateY(-2000px);
}
100% {
opacity: 1;
-moz-transform: translateY(0);
}
}
#-o-keyframes fadeInDownBig {
0% {
opacity: 0;
-o-transform: translateY(-2000px);
}
100% {
opacity: 1;
-o-transform: translateY(0);
}
}
#keyframes fadeInDownBig {
0% {
opacity: 0;
transform: translateY(-2000px);
}
100% {
opacity: 1;
transform: translateY(0);
}
}
.fadeInDownBig {
-webkit-animation-name: fadeInDownBig;
-moz-animation-name: fadeInDownBig;
-o-animation-name: fadeInDownBig;
animation-name: fadeInDownBig;
}
#-webkit-keyframes bounceInDown {
0% {
opacity: 0;
-webkit-transform: translateY(-2000px);
}
60% {
opacity: 1;
-webkit-transform: translateY(30px);
}
80% {
-webkit-transform: translateY(-10px);
}
100% {
-webkit-transform: translateY(0);
}
}
#-moz-keyframes bounceInDown {
0% {
opacity: 0;
-moz-transform: translateY(-2000px);
}
60% {
opacity: 1;
-moz-transform: translateY(30px);
}
80% {
-moz-transform: translateY(-10px);
}
100% {
-moz-transform: translateY(0);
}
}
#-o-keyframes bounceInDown {
0% {
opacity: 0;
-o-transform: translateY(-2000px);
}
60% {
opacity: 1;
-o-transform: translateY(30px);
}
80% {
-o-transform: translateY(-10px);
}
100% {
-o-transform: translateY(0);
}
}
#keyframes bounceInDown {
0% {
opacity: 0;
transform: translateY(-2000px);
}
60% {
opacity: 1;
transform: translateY(30px);
}
80% {
transform: translateY(-10px);
}
100% {
transform: translateY(0);
}
}
.bounceInDown {
-webkit-animation-name: bounceInDown;
-moz-animation-name: bounceInDown;
-o-animation-name: bounceInDown;
animation-name: bounceInDown;
}
You have to add two classes. The animated class to designate the item as being animated. Then the bounceInDown to define what type of animation.
<div id="box" class="animated bounceInDown">test</div>
Updated Fiddle here
Here is a simple solution by using animate.css:
First create a css class myAnimation.
Then use it in HTML:
.myAnimation {
-webkit-animation: bounceInDown 1s ease-in-out 200ms both;
animation: bounceInDown 1s ease-in-out 200ms both;
}
<h3 class="myAnimation"><span>Animation Using animate.css</span></h3>