Why transition is not working in Safari browser? - html

<style>
* {
margin: 0;
padding: 0;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
.main-cube-wrapper {
height: 80px;
position: relative;
margin-top: 2rem;
}
.wrap {
-webkit-perspective: 1000px;
perspective: 1000px;
-webkit-perspective-origin: 50% 50%;
perspective-origin: 50% 50%;
}
.cube {
-webkit-transform-style: preserve-3d;
transform-style: preserve-3d;
width: 80px;
height: 80px;
margin: auto;
-webkit-animation-name: rotate;
animation-name: rotate;
-webkit-animation-duration: 30s;
animation-duration: 30s;
-webkit-animation-timing-function: linear;
animation-timing-function: linear;
-webkit-animation-iteration-count: infinite;
animation-iteration-count: infinite;
}
.cube div {
position: absolute;
opacity: 0.7;
width: 80px;
height: 80px;
}
.face-1 {
background: red;
-webkit-transform: rotateY(0deg) translateZ(40px);
transform: rotateY(0deg) translateZ(40px);
}
.face-2 {
background: green;
-webkit-transform: rotateY(90deg) translateZ(40px);
transform: rotateY(90deg) translateZ(40px);
}
.face-3 {
background: blue;
-webkit-transform: rotateY(180deg) translateZ(40px);
transform: rotateY(180deg) translateZ(40px);
}
.face-4 {
background: yellow;
-webkit-transform: rotateY(-90deg) translateZ(40px);
transform: rotateY(-90deg) translateZ(40px);
}
.face-5 {
background: purple;
-webkit-transform: rotateX(90deg) translateZ(40px);
transform: rotateX(90deg) translateZ(40px);
}
.face-6 {
background: orange;
-webkit-transform: rotateX(-90deg) translateZ(40px);
transform: rotateX(-90deg) translateZ(40px);
}
#-webkit-keyframes rotate {
0% {
-webkit-transform: rotate3d(0, 0, 0, 0);
transform: rotate3d(0, 0, 0, 0);
}
100% {
-webkit-transform: rotate3d(0, 1, 0, 360deg);
transform: rotate3d(0, 1, 0, 360deg);
}
}
#keyframes rotate {
0% {
-webkit-transform: rotate3d(0, 0, 0, 0);
transform: rotate3d(0, 0, 0, 0);
}
100% {
-webkit-transform: rotate3d(0, 1, 0, 360deg);
transform: rotate3d(0, 1, 0, 360deg);
}
}
</style>
<div class="main-cube-wrapper">
<div class="wrap">
<div class="cube">
<div class="face-1"></div>
<div class="face-2"></div>
<div class="face-3"></div>
<div class="face-4"></div>
<div class="face-5"></div>
<div class="face-6"></div>
</div>
</div>
</div>
I am learning and working on some project I have created the rotating cube using SCSS, and I have already checked that the cube translates or rotates in every browser except 'Safari browser'. Can anybody please help me solving this issue so the cube can also rotate and work properly in the safari browser.

See update below
It look like Safari has issues with rotate3d. Just test this example on your Safari browser. The last rotation using rotateZ should work.
div {
width: 100px;
height: 100px;
background: red;
margin: 20px;
}
.rotate-2d { -webkit-animation: rotate-2d 1s linear infinite; }
.rotate-3d { -webkit-animation: rotate-3d 1s linear infinite; }
.rotate-3d-v2 { -webkit-animation: rotate-3d-v2 1s linear infinite; }
div:after {
content: 'A';
display: inline-block;
width: 10px;
height: 20px;
color: green;
font-size: 100px;
}
#-webkit-keyframes rotate-2d {
0% {
-webkit-transform: rotate(0deg);
}
100% {
-webkit-transform: rotate(360deg);
}
}
#-webkit-keyframes rotate-3d {
0% {
-webkit-transform: rotate3d(0,0,1,0deg);
}
100% {
-webkit-transform: rotate3d(0,0,1,360deg);
}
}
#-webkit-keyframes rotate-3d-v2 {
0% {
-webkit-transform: rotateZ(0deg);
}
100% {
-webkit-transform: rotateZ(360deg);
}
}
<div class="rotate-2d"></div>
<div class="rotate-3d"></div>
<div class="rotate-3d-v2"></div>
Update
Seems Safari has an issue to recognise the change between two key frames. Adding an intermediate keyframe seem to solve the problem:
.main-cube-wrapper {
height: 180px;
position: relative;
margin-top: 2rem;
}
.wrap {
-webkit-perspective: 1000px;
perspective: 1000px;
-webkit-perspective-origin: 50% 50%;
perspective-origin: 50% 50%;
}
.cube {
-webkit-transform-style: preserve-3d;
transform-style: preserve-3d;
width: 80px;
height: 80px;
margin: auto;
-webkit-animation-name: rotate;
animation-name: rotate;
-webkit-animation-duration: 30s;
animation-duration: 30s;
-webkit-animation-timing-function: linear;
animation-timing-function: linear;
-webkit-animation-iteration-count: infinite;
animation-iteration-count: infinite;
}
.cube div {
position: absolute;
opacity: 0.7;
width: 80px;
height: 80px;
}
.face-1 {
background: red;
-webkit-transform: rotateY(0deg) translateZ(40px);
transform: rotateY(0deg) translateZ(40px);
}
.face-2 {
background: green;
-webkit-transform: rotateY(90deg) translateZ(40px);
transform: rotateY(90deg) translateZ(40px);
}
.face-3 {
background: blue;
-webkit-transform: rotateY(180deg) translateZ(40px);
transform: rotateY(180deg) translateZ(40px);
}
.face-4 {
background: yellow;
-webkit-transform: rotateY(-90deg) translateZ(40px);
transform: rotateY(-90deg) translateZ(40px);
}
.face-5 {
background: purple;
-webkit-transform: rotateX(90deg) translateZ(40px);
transform: rotateX(90deg) translateZ(40px);
}
.face-6 {
background: orange;
-webkit-transform: rotateX(-90deg) translateZ(40px);
transform: rotateX(-90deg) translateZ(40px);
}
#-webkit-keyframes rotate {
0% {
transform: rotate3d(0, 0, 0, 0);
}
50% {
transform: rotate3d(0, 1, 0, 180deg);
}
100% {
transform: rotate3d(0, 1, 0, 360deg);
}
}
<div class="main-cube-wrapper">
<div class="wrap">
<div class="cube">
<div class="face-1"></div>
<div class="face-2"></div>
<div class="face-3"></div>
<div class="face-4"></div>
<div class="face-5"></div>
<div class="face-6"></div>
</div>
</div>
</div>

Related

how to add pulse animation with one after other in css like traffic lights blinks continously

I have two circles with pulse animation infinite times. Now I need animating the circle one after another continuously with infinite times. I tried pulsation the circle infinite times. I have added delay animation but it is not working I don't why. Please kindly refer the code and help to achieve that functionality:
HTML:
<div class="inner">one</div>
<div class="inner1">two</div>
Css:
.inner {
width: 74px;
height: 74px;
background: #fff;
border:1px solid #000;
position: relative;
text-align:center;
border-radius: 50%;
margin-bottom:20px;
text-align: center;
-webkit-animation: pulse 1s infinite;
}
.inner1 {
width: 74px;
height: 74px;
background: #fff;
border:1px solid #000;
position: relative;
border-radius: 50%;
text-align: center;
-webkit-animation: pulse 2s infinite;
}
#-webkit-keyframes pulse {
0% {
-webkit-transform: scaleX(1);
transform: scaleX(1)
}
50% {
-webkit-transform: scale3d(1.05, 1.05, 1.05);
transform: scale3d(1.05, 1.05, 1.05)
}
to {
-webkit-transform: scaleX(1);
transform: scaleX(1)
}
}
#keyframes pulse {
0% {
-webkit-transform: scaleX(1);
transform: scaleX(1)
}
50% {
-webkit-transform: scale3d(1.05, 1.05, 1.05);
transform: scale3d(1.05, 1.05, 1.05)
}
to {
-webkit-transform: scaleX(1);
transform: scaleX(1)
}
}
.pulse {
-webkit-animation-name: pulse;
animation-name: pulse
}
thanks in advance
You can add the same class to all circles for common properties. The only properties you need different for each is animation-delay.
You can use a small jQuery code to set that for any number of divs. I have created an example for 3 divs, but feel free to extend it.
let els = $(".inner"),
length = $(".inner").length
els.each(function(index) {
$(this).css('animation-delay', (index / length) + 's')
})
.inner {
display: inline-block;
vertical-align: top;
width: 74px;
height: 74px;
background: #fff;
border: 1px solid #000;
position: relative;
text-align: center;
border-radius: 50%;
margin-bottom: 20px;
text-align: center;
margin: 10px;
animation: pulse 1s infinite linear;
}
#keyframes pulse {
0% {
transform: scaleX(1)
}
50% {
transform: scale3d(1.05, 1.05, 1.05)
}
to {
transform: scaleX(1)
}
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="inner">one</div>
<div class="inner">two</div>
<div class="inner">three</div>
animation-delay is working:
.inner {
width: 74px;
height: 74px;
background: #fff;
border: 1px solid #000;
position: relative;
text-align: center;
border-radius: 50%;
margin-bottom: 20px;
text-align: center;
-webkit-animation: pulse 1s infinite;
}
.inner1 {
width: 74px;
height: 74px;
background: #fff;
border: 1px solid #000;
position: relative;
border-radius: 50%;
text-align: center;
-webkit-animation: pulse 2s infinite;
animation-delay: 5s
}
#-webkit-keyframes pulse {
0% {
-webkit-transform: scaleX(1);
transform: scaleX(1)
}
50% {
-webkit-transform: scale3d(1.05, 1.05, 1.05);
transform: scale3d(1.05, 1.05, 1.05)
}
to {
-webkit-transform: scaleX(1);
transform: scaleX(1)
}
}
#keyframes pulse {
0% {
-webkit-transform: scaleX(1);
transform: scaleX(1)
}
50% {
-webkit-transform: scale3d(1.05, 1.05, 1.05);
transform: scale3d(1.05, 1.05, 1.05)
}
to {
-webkit-transform: scaleX(1);
transform: scaleX(1)
}
}
.pulse {
-webkit-animation-name: pulse;
animation-name: pulse
}
<div class="inner">one
</div>
<div class="inner1">two
</div>
Only Add animation Delay= .5s; and reduce second animation time with 1s
HTML:
<div class="inner">one</div>
<div class="inner1">two</div>
CSS:
.inner {
width: 74px;
height: 74px;
background: #fff;
border:1px solid #000;
position: relative;
text-align:center;
border-radius: 50%;
margin-bottom:20px;
text-align: center;
-webkit-animation: pulse 1s infinite;
}
.inner1 {
width: 74px;
height: 74px;
background: #fff;
border:1px solid #000;
position: relative;
border-radius: 50%;
text-align: center;
-webkit-animation: pulse 1s infinite;
animation-delay: .5s;
}
#-webkit-keyframes pulse {
0% {
-webkit-transform: scaleX(1);
transform: scaleX(1)
}
50% {
-webkit-transform: scale3d(1.05, 1.05, 1.05);
transform: scale3d(1.05, 1.05, 1.05)
}
to {
-webkit-transform: scaleX(1);
transform: scaleX(1)
}
}
#keyframes pulse {
0% {
-webkit-transform: scaleX(1);
transform: scaleX(1)
}
50% {
-webkit-transform: scale3d(1.05, 1.05, 1.05);
transform: scale3d(1.05, 1.05, 1.05)
}
to {
-webkit-transform: scaleX(1);
transform: scaleX(1)
}
}
.pulse {
-webkit-animation-name: pulse;
animation-name: pulse
}

css animation didnt work on ie

first i must Apology for my bad English, i made it like this below code:
CSS:
#charset "utf-8";
#media screen and (min-width: 320px) {
body {
font-family:'BebasRegular';
text-align:center;
background-color: #d0d2d0;
background-image:url(../Image/Back_pattern.png);
width: 95%;
height: 95%;
margin:auto;
}
div#main {
font-size: 3vw;
}
#content {
margin:auto;
height:100vh;
width:100vw;
}
}
#font-face {
font-family: 'BebasRegular';
src: url('../Fonts/BEBAS___-webfont.eot');
src: url('../Fonts/BEBAS___-webfont.eot?#iefix') format('embedded-opentype'),
url('../Fonts/BEBAS___-webfont.woff') format('woff'),
url('../Fonts/BEBAS___-webfont.ttf') format('truetype'),
url('../Fonts/BEBAS___-webfont.svg#BebasRegular') format('svg');
font-weight: normal;
font-style: normal;
}
#media only screen and (orientation: landscape) {
#item1_placeholder{
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 7%;
content: "";
display: block;
padding-bottom: 7%;
}
#AHCube div {
position: absolute;
width: 7vw;
height: 7vw;
border: 1px solid rgba(0,0,0,0.3);
background: rgba(255,255,255,1);
box-shadow: inset 0 0 20px rgba(0,0,0,0.3);
text-align: center;
line-height: 120px;
}
#AHCube .Front {
-webkit-transform: translateZ(3.5vw);
transform: translateZ(3.5vw);
-moz-transform: translateZ(3.5vw);
-o-transform: translateZ(3.5vw);
}
#AHCube .Right {
-webkit-transform: rotateY(90deg) translateZ(3.5vw);
transform: rotateY(90deg) translateZ(3.5vw);
-moz-transform: rotateY(90deg) translateZ(3.5vw);
-o-transform: rotateY(90deg) translateZ(3.5vw);
}
#AHCube .Top {
-webkit-transform: rotateY(90deg) rotateX(90deg) translateZ(3.5vw);
transform: rotateY(90deg) rotateX(90deg) translateZ(3.5vw);
-moz-transform: rotateY(90deg) rotateX(90deg) translateZ(3.5vw);
-o-transform: rotateY(90deg) rotateX(90deg) translateZ(3.5vw);
}
#AHCube .Back {
-webkit-transform: rotateY(180deg) rotateZ(90deg) translateZ(3.5vw);
transform: rotateY(180deg) rotateZ(90deg) translateZ(3.5vw);
-moz-transform: rotateY(180deg) rotateZ(90deg) translateZ(3.5vw);
-o-transform: rotateY(180deg) rotateZ(90deg) translateZ(3.5vw);
}
#AHCube .Left {
-webkit-transform: rotateY(-90deg) rotateZ(90deg) translateZ(3.5vw);
transform: rotateY(-90deg) rotateZ(90deg) translateZ(3.5vw);
-moz-transform: rotateY(-90deg) rotateZ(90deg) translateZ(3.5vw);
-o-transform: rotateY(-90deg) rotateZ(90deg) translateZ(3.5vw);
}
#AHCube .Below {
-webkit-transform: rotateX(-90deg) translateZ(3.5vw);
transform: rotateX(-90deg) translateZ(3.5vw);
-moz-transform: rotateX(-90deg) translateZ(3.5vw);
-o-transform: rotateX(-90deg) translateZ(3.5vw);
background:rgba(3,76,244,1.00);
}
.AH_Ani1 {
-webkit-animation-name: spin1;
-webkit-animation-timing-function: ease-in-out;
-webkit-animation-iteration-count: 1;
-webkit-animation-duration: 5s;
-webkit-animation-fill-mode: forwards;
-webkit-transform-style: preserve-3d;
-webkit-transform-origin: 3.5vw 3.5vw 0;
animation-name: spin1;
animation-timing-function: ease-in-out;
animation-iteration-count: 1;
animation-duration: 5s;
animation-fill-mode: forwards;
transform-style: preserve-3d;
transform-origin: 3.5vw 3.5vw 0;
-moz-animation-name: spin1;
-moz-animation-timing-function: ease-in-out;
-moz-animation-iteration-count: 1;
-moz-animation-duration: 5s;
-moz-animation-fill-mode: forwards;
-moz-transform-style: preserve-3d;
-moz-transform-origin: 3.5vw 3.5vw 0;
-o-animation-name: spin1;
-o-animation-timing-function: ease-in-out;
-o-animation-iteration-count: 1;
-o-animation-duration: 5s;
-o-animation-fill-mode: forwards;
-o-transform-style: preserve-3d;
-o-transform-origin: 3.5vw 3.5vw 0;
}
.ICO_Hold1 {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
filter: drop-shadow(5% 5% 5% #222);
width: 80%;
height: auto;
display:block;
}
#-webkit-keyframes spin1 {
from,to { -webkit-transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg); }
0% { -webkit-transform:scale(0,0); }
10% { -webkit-transform:scale(1,1); }
28% { -webkit-transform: rotateY(-90deg); }
46% { -webkit-transform: rotateY(-90deg) rotateZ(90deg); }
64% { -webkit-transform: rotateY(-180deg) rotateZ(90deg); }
82% { -webkit-transform: rotateY(90deg) rotateX(90deg); }
100% { -webkit-transform: rotateX(90deg); }
}
#keyframes spin1 {
from,to { transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg); }
0% { transform:scale(0,0); }
10% { transform:scale(1,1); }
28% { transform: rotateY(-90deg); }
46% { transform: rotateY(-90deg) rotateZ(90deg); }
64% { transform: rotateY(-180deg) rotateZ(90deg); }
82% { transform: rotateY(90deg) rotateX(90deg); }
100% { transform: rotateX(90deg); }
}
#-moz-keyframes spin1 {
from,to { -moz-transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg); }
0% { -moz-transform:scale(0,0); }
10% { -moz-transform:scale(1,1); }
28% { -moz-transform: rotateY(-90deg); }
46% { -moz-transform: rotateY(-90deg) rotateZ(90deg); }
64% { -moz-transform: rotateY(-180deg) rotateZ(90deg); }
82% { -moz-transform: rotateY(90deg) rotateX(90deg); }
100% { -moz-transform: rotateX(90deg); }
}
#-o-keyframes spin1 {
from,to { -o-transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg); }
0% { -o-transform:scale(0,0); }
10% { -o-transform:scale(1,1); }
28% { -o-transform: rotateY(-90deg); }
46% { -o-transform: rotateY(-90deg) rotateZ(90deg); }
64% { -o-transform: rotateY(-180deg) rotateZ(90deg); }
82% { -o-transform: rotateY(90deg) rotateX(90deg); }
100% { -o-transform: rotateX(90deg); }
}
}
#media only screen and (orientation: portrait) {
#item1_placeholder{
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 0%;
content: "";
display: block;
padding-bottom: 0%;
}
#AHCube div {
position: absolute;
width: 0vw;
height: 0vw;
border: 1px solid rgba(0,0,0,0.3);
background: rgba(255,255,255,1);
box-shadow: inset 0 0 20px rgba(0,0,0,0.3);
text-align: center;
line-height: 120px;
}
.ICO_Hold1 {
position: fixed;
top: 0%;
left: 0%;
transform: translate(-50%, -50%);
-webkit-filter: drop-shadow(50% 50% 50% #222 );
filter: drop-shadow(5% 5% 5% #222);
width: 0%;
height: auto;
display:none;
}
}
HTML:
<div id="item1_placeholder" >
<div id="AHCube" class="AH_Ani1">
<div class="Front"><img class="ICO_Hold1" src="Image/1-1.png" /></div>
<div class="Right"><img class="ICO_Hold1" src="Image/1-2.png" /></div>
<div class="Top"><img class="ICO_Hold1" src="Image/1-3.png" /></div>
<div class="Back"><img class="ICO_Hold1" src="Image/1-4.png" /></div>
<div class="Left"><img class="ICO_Hold1" src="Image/1-5.png" /></div>
<div class="Below"><img class="ICO_Hold1" src="Image/1-6.png" /></div>
</div>
</div>
it work fine in chrome and Mozilla but it is not fine IE or Microsoft Edge, and i didn't check it in portable device
another problem is in portrait view , the cube's image background didn't hide in portrait view.
can any one check this and hint me to correct/fix this please?

Why is the Content not aligned in the middle?

The Code attached consists of an animation CSS box with a <p>. It's working but the problem is that, why is it not vertical aligned? I will need to use flex function: "align-items = center" to make it aligned.
.LoaderBox {
width: 100%;
border: 1px solid rgba(255, 0, 0, 1.00);
display: flex;
justify-content: center;
}
.LoaderBox>p {
color: rgba(106, 106, 106, 1.00);
font-size: 15px;
margin-left: 20px;
display: block;
}
.LoaderBox_spinner {
width: 20px;
height: 20px;
background-color: #333;
-webkit-animation: sk-rotateplane 1.2s infinite ease-in-out;
animation: sk-rotateplane 1.2s infinite ease-in-out;
display: block;
}
#-webkit-keyframes sk-rotateplane {
0% {
-webkit-transform: perspective(120px)
}
50% {
-webkit-transform: perspective(120px) rotateY(180deg)
}
100% {
-webkit-transform: perspective(120px) rotateY(180deg) rotateX(180deg)
}
}
#keyframes sk-rotateplane {
0% {
transform: perspective(120px) rotateX(0deg) rotateY(0deg);
-webkit-transform: perspective(120px) rotateX(0deg) rotateY(0deg)
}
50% {
transform: perspective(120px) rotateX(-180.1deg) rotateY(0deg);
-webkit-transform: perspective(120px) rotateX(-180.1deg) rotateY(0deg)
}
100% {
transform: perspective(120px) rotateX(-180deg) rotateY(-179.9deg);
-webkit-transform: perspective(120px) rotateX(-180deg) rotateY(-179.9deg);
}
}
<div class="LoaderBox">
<div class="LoaderBox_spinner"></div>
<p>Verifying</p>
</div>
Just add align-items: center to your flex-container .LoaderBox.
By default all items are stretched (align-items: stretch).
p has equal vertical margins by default (margin-top and margin-bottom), and div doesn't. So in this case p determines flex-container's height. And also looks like it's centered vertically.
Demo:
.LoaderBox {
width: 100%;
border: 1px solid rgba(255, 0, 0, 1.00);
display: flex;
align-items: center; /* new */
justify-content: center;
}
.LoaderBox>p {
color: rgba(106, 106, 106, 1.00);
font-size: 15px;
margin-left: 20px;
display: block;
}
.LoaderBox_spinner {
width: 20px;
height: 20px;
background-color: #333;
-webkit-animation: sk-rotateplane 1.2s infinite ease-in-out;
animation: sk-rotateplane 1.2s infinite ease-in-out;
display: block;
}
#-webkit-keyframes sk-rotateplane {
0% {
-webkit-transform: perspective(120px)
}
50% {
-webkit-transform: perspective(120px) rotateY(180deg)
}
100% {
-webkit-transform: perspective(120px) rotateY(180deg) rotateX(180deg)
}
}
#keyframes sk-rotateplane {
0% {
transform: perspective(120px) rotateX(0deg) rotateY(0deg);
-webkit-transform: perspective(120px) rotateX(0deg) rotateY(0deg)
}
50% {
transform: perspective(120px) rotateX(-180.1deg) rotateY(0deg);
-webkit-transform: perspective(120px) rotateX(-180.1deg) rotateY(0deg)
}
100% {
transform: perspective(120px) rotateX(-180deg) rotateY(-179.9deg);
-webkit-transform: perspective(120px) rotateX(-180deg) rotateY(-179.9deg);
}
}
<div class="LoaderBox">
<div class="LoaderBox_spinner"></div>
<p>Verifying</p>
</div>
.LoaderBox {
width: 100%;
border: 1px solid rgba(255, 0, 0, 1.00);
display: flex;
justify-content: center;
padding:20px;
box-sizing:border-box;
}
.LoaderBox>p {
color: rgba(106, 106, 106, 1.00);
font-size: 15px;
display: block;
padding:0px;
margin:0px;
margin-left:20px;
}
.LoaderBox_spinner {
width: 20px;
height: 20px;
background-color: #333;
-webkit-animation: sk-rotateplane 1.2s infinite ease-in-out;
animation: sk-rotateplane 1.2s infinite ease-in-out;
display: block;
float:left;
}
#-webkit-keyframes sk-rotateplane {
0% {
-webkit-transform: perspective(120px)
}
50% {
-webkit-transform: perspective(120px) rotateY(180deg)
}
100% {
-webkit-transform: perspective(120px) rotateY(180deg) rotateX(180deg)
}
}
#keyframes sk-rotateplane {
0% {
transform: perspective(120px) rotateX(0deg) rotateY(0deg);
-webkit-transform: perspective(120px) rotateX(0deg) rotateY(0deg)
}
50% {
transform: perspective(120px) rotateX(-180.1deg) rotateY(0deg);
-webkit-transform: perspective(120px) rotateX(-180.1deg) rotateY(0deg)
}
100% {
transform: perspective(120px) rotateX(-180deg) rotateY(-179.9deg);
-webkit-transform: perspective(120px) rotateX(-180deg) rotateY(-179.9deg);
}
}
p{ float:left;}
<div class="LoaderBox">
<div class="LoaderBox_spinner"></div>
<p>Verifying</p>
</div>

Weird behaviour of CSS-Tesseract (Cube)

I successfully created a cube in a cube, a Tesseract. But for some reason I really can't explain, the cube is moving downwards while the Animation is going on.
If you watch the scrolling bar of your browser, the entire cube is moving downwards.
And yes, of course you can "ignore" this problem by changing the margin of the parent-div-element but that doesn't solve it.
#-webkit-keyframes cube-spin {
from {
-webkit-transform: rotateY(0deg);
transform: rotateY(0deg);
}
to {
-webkit-transform: rotateY(360deg);
transform: rotateY(360deg);
}
}
#keyframes cube-spin {
from {
-webkit-transform: rotateY(0deg);
transform: rotateY(0deg);
}
to {
-webkit-transform: rotateY(360deg);
transform: rotateY(360deg);
}
}
#-webkit-keyframes counter-rot {
from {
-webkit-transform: rotateY(0deg);
transform: rotateY(0deg);
}
to {
-webkit-transform: rotateY(-360deg);
transform: rotateY(-360deg);
}
}
#keyframes counter-rot {
from {
-webkit-transform: rotateY(0deg);
transform: rotateY(0deg);
}
to {
-webkit-transform: rotateY(-360deg);
transform: rotateY(-360deg);
}
}
.cube-wrap {
-webkit-perspective: 800px;
perspective: 800px;
-webkit-perspective-origin: 50% 0%;
perspective-origin: 50% 0%;
}
.outer {
width: 300px !important;
}
.cube {
position: relative;
width: 200px;
margin: 0 auto;
-webkit-transform-style: preserve-3d;
transform-style: preserve-3d;
-webkit-animation: cube-spin 8s infinite linear;
animation: cube-spin 8s infinite linear;
}
.backendtext {
position: absolute;
width: 200px;
font-size: 35px;
text-align: center;
font-family: sans-serif;
text-transform: uppercase;
-webkit-animation: counter-rot 8s infinite linear;
animation: counter-rot 8s infinite linear;
}
.outer div {
width: 300px;
height: 300px;
background: rgba(255, 116, 0, 0.1);
line-height: 530px;
}
.inner div {
width: 200px;
height: 200px;
background: rgba(153, 69, 0, 0.7);
}
.cube div {
position: absolute;
box-shadow: inset 0 0 30px rgba(125,125,125,0.8);
font-size: 35px;
text-align: center;
font-family: sans-serif;
text-transform: uppercase;
}
.depth div.front-pane {
-webkit-transform: translateY(-100px) translateZ(100px);
transform: translateY(-100px) translateZ(100px);
}
.outer.depth div.front-pane {
-webkit-transform: translateY(-150px) translateZ(150px);
transform: translateY(-150px) translateZ(150px);
}
.depth div.back-pane {
-webkit-transform: translateY(-100px) translateZ(-100px) rotateY(180deg);
transform: translateY(-100px) translateZ(-100px) rotateY(180deg);
}
.outer.depth div.back-pane {
-webkit-transform: translateY(-150px) translateZ(-150px) rotateY(180deg);
transform: translateY(-150px) translateZ(-150px) rotateY(180deg);
}
.depth div.left-pane {
-webkit-transform: translateY(-100px) translateX(100px) rotateY(-270deg);
transform: translateY(-100px) translateX(100px) rotateY(-270deg);
}
.outer.depth div.left-pane {
-webkit-transform: translateY(-150px) translateX(150px) rotateY(-270deg);
transform: translateY(-150px) translateX(150px) rotateY(-270deg);
}
.depth div.right-pane {
-webkit-transform: translateY(-100px) translateX(-100px) rotateY(270deg);
transform: translateY(-100px) translateX(-100px) rotateY(270deg);
}
.outer.depth div.right-pane {
-webkit-transform: translateY(-150px) translateX(-150px) rotateY(270deg);
transform: translateY(-150px) translateX(-150px) rotateY(270deg);
}
.depth div.top-pane {
-webkit-transform: translateY(-200px) rotateX(-90deg);
transform: translateY(-200px) rotateX(-90deg);
}
.outer.depth div.top-pane {
-webkit-transform: translateY(-300px) rotateX(-90deg);
transform: translateY(-300px) rotateX(-90deg);
}
.depth div.bottom-pane {
-webkit-transform: rotateX(90deg);
transform: rotateX(90deg);
}
<div style="height: 300px; margin-top: 400px;">
<div class="cube-wrap">
<div class="cube depth inner">
<a class="backendtext">Backend</a>
<div class="front-pane"></div>
<div class="back-pane"></div>
<div class="top-pane"></div>
<div class="bottom-pane"></div>
<div class="left-pane"></div>
<div class="right-pane"></div>
</div>
<div class="cube depth outer">
<div class="front-pane">Frontend</div>
<div class="back-pane">Frontend</div>
<div class="top-pane"></div>
<div class="bottom-pane"></div>
<div class="left-pane">Frontend</div>
<div class="right-pane">Frontend</div>
</div>
</div>
//EDIT: Works fine on Chrome and Edge. Will try to add prefixes to everything and see if it solves the problem.
//EDIT2: Added Prefixes, still doesn't work on Firefox but does properly on Chrome, Edge etc.
//EDIT3: Set Overflow of the cube-wrapper to hidden but I would still love to know the reason.

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>