Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 2 years ago.
Improve this question
I've made a mustache, I'll send a picture below, and I'm trying to animate it to give it a bit more life. But, for some reason this animate from css doesn't work... I'm not sure what I'm doing wrong.
This may be an outdated form of CSS? Or, maybe there's something I misspelled that I missed to check?
.mustache {
width: 180px;
height: 180px;
left: 100px;
border-radius: 50%;
position: absolute;
color: pink;
box-shadow: 150px 240px 0 0 currentColor, 300px 240px 0 0 currentColor
}
.mustache::before {
animation: shakeLeft 1s ease-in-out infinte;
content: "";
position: absolute;
left: 30px;
top: 120px;
width: 210px;
height: 120px;
border-bottom: solid 180px currentColor;
border-radius: 0 0 0 100%;
transform: rotate(-40deg);
transform-origin: right 210px;
}
.mustache::after {
content: "";
position: absolute;
left: 390px;
top: 120px;
width: 210px;
height: 120px;
border-bottom: solid 180px currentColor;
border-radius: 0 0 100% 0;
transform: rotate(40deg);
transform-origin: left 210px;
}
#keyframes shakeLeft {
0% {
transform: rotate(-50deg);
}
50% {
transform: rotate(-30deg);
}
100% {
transform: rotate(-50deg);
}
}
#keyframes shakeRight {
0% {
transform: rotate(-50deg);
}
50% {
transform: rotate(-30deg);
}
100% {
transform: rotate(-50deg);
}
}
.mustache:before {
animation: shakeLeft 1s ease-in-out infinte;
}
.mustache:after {
animation: shakeRight 1s ease-in-out infinte;
}
<div class="mustache">
</div>
Any help/comment is appreciated. Thank you!
You had a slight typo... You misspelled infinite. If you fix that, the code runs.
I also changed the shakeRight keyframe to have positive values to make it symmetrical.
.mustache {
width: 180px;
height: 180px;
left: 100px;
border-radius: 50%;
position: absolute;
color: pink;
box-shadow: 150px 240px 0 0 currentColor, 300px 240px 0 0 currentColor
}
.mustache::before {
animation: shakeLeft 1s ease-in-out infinite;
content: "";
position: absolute;
left: 30px;
top: 120px;
width: 210px;
height: 120px;
border-bottom: solid 180px currentColor;
border-radius: 0 0 0 100%;
transform: rotate(-40deg);
transform-origin: right 210px;
}
.mustache::after {
animation: shakeRight 1s ease-in-out infinite;
content: "";
position: absolute;
left: 390px;
top: 120px;
width: 210px;
height: 120px;
border-bottom: solid 180px currentColor;
border-radius: 0 0 100% 0;
transform: rotate(40deg);
transform-origin: left 210px;
}
#keyframes shakeLeft {
0% {
transform: rotate(-50deg);
}
50% {
transform: rotate(-30deg);
}
100% {
transform: rotate(-50deg);
}
}
#keyframes shakeRight {
0% {
transform: rotate(50deg);
}
50% {
transform: rotate(30deg);
}
100% {
transform: rotate(50deg);
}
}
<div class="mustache" />
You have to do some changes in your css >>>
Try with this Your animation is perfectly working now
Here's your HTML:
<div class="mustache"></div>
Here's your Edited CSS:
<style type="text/css">
#keyframes shakeLeft {
0% {
transform: rotate(-50deg);
}
50% {
transform: rotate(-30deg);
}
100% {
transform: rotate(-50deg);
}
}
#keyframes shakeRight {
0% {
transform: rotate(50deg);
}
50% {
transform: rotate(30deg);
}
100% {
transform: rotate(50deg);
}
}
.mustache {
width:180px;
height:180px;
left: 100px;
border-radius: 50%;
position: absolute;
color: pink;
box-shadow:
150px 240px 0 0 currentColor,
300px 240px 0 0 currentColor
}
.mustache::before {
animation-name: shakeLeft;
animation-duration: 4.5s;
animation-delay: 1.5s;
animation-iteration-count: infinite;
content: "";
position: absolute;
left: 30px;
top: 120px;
width: 210px;
height: 120px;
border-bottom: solid 180px currentColor;
border-radius: 0 0 0 100%;
transform: rotate(-40deg);
transform-origin: right 210px;
}
.mustache::after {
animation-name: shakeRight;
animation-duration: 4.5s;
animation-delay: 1.5s;
animation-iteration-count: infinite;
content: "";
position: absolute;
left: 390px;
top: 120px;
width: 210px;
height: 120px;
border-bottom: solid 180px currentColor;
border-radius: 0 0 100% 0;
transform: rotate(40deg);
transform-origin: left 210px;
}
</style>
Related
I would like to run my animation consisting of two keyframes to mimic the motion of a closing garage door, but the animation stops after one execution. Adding animation-iteration-count: 10; just flashes the 'door', doesn't rerun the whole animation. What could be the issue? Thank you in advance!
.house {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 200px;
height: 150px;
}
.house .front {
position: absolute;
bottom: 0;
left: 50%;
transform: translateX(-50%);
width: 5.2em;
height: 4em;
border-left: 0.5em solid grey;
border-right: 0.5em solid grey;
}
.house .front .gable {
position: absolute;
top: -3.5em;
left: 50%;
width: 0;
height: 0;
transform: translateX(-50%);
border-left: 3.1em solid transparent;
border-right: 3.1em solid transparent;
border-bottom: 3.5em solid grey;
}
.house .front .door {
position: absolute;
bottom: 0;
left: 50%;
transform: translateX(-50%);
width: 4.2em;
height: 0.4em;
background: grey;
border-radius: 2px 2px 0 0;
overflow: hidden;
}
.house .front .door:before {
content: '';
display: block;
width: 40%;
height: 100%;
position: absolute;
top: 0;
left: 0;
background: black;
}
.house .front #d1 {
transform: translateX(-50%) translateY(-80%);
}
.house .front #d2 {
transform: translateX(-50%) translateY(-300%);
}
.house .front #d3 {
transform: translateX(-50%) translateY(-540%);
}
.house .front #d4 {
transform: translateX(-50%) translateY(-800%);
}
.house .front .doors .door {
animation-name: hide, up;
animation-duration: 1.6s;
animation-timing-function: ease-in;
animation-iteration-count: 1;
opacity: 1;
}
.house .front .doors #d4 {
animation-delay: 0s, 0s;
}
.house .front .doors #d3 {
animation-delay: 0s, 0.3s;
}
.house .front .doors #d2 {
animation-delay: 0s, 0.6s;
}
.house .front .doors #d1 {
animation-delay: 0s, 0.9s;
}
#keyframes hide
{
from { opacity: 0; } to { opacity: 0 }
}
#keyframes up
{
0% { opacity: 0; }
1% { opacity: 1; }
100% { opacity: 1; }
}
<div class="house">
<div class="front">
<div class="gable"></div>
<div class="doors">
<div id="d1" class="door"></div>
<div id="d2" class="door"></div>
<div id="d3" class="door"></div>
<div id="d4"class="door"></div>
</div>
</div>
</div>
sorry about this part, but SO wouldn't let me post this question unless more text is added.
I'm playing round with CSS animation by trying to replicate the following new google ads logo - example.
What is the best way to add the bounce effect on the green ball?
My current animation:
#keyframes greenblock {
0% {
top: 0px;
}
50% {
top: 45px;
}
100% {
bottom: 0px;
}
}
My code (fiddle):
.wrap {
border: 1px solid red;
height: 300px;
width: 300px;
position: relative
}
.blue-shape {
position: absolute;
left: 100px;
top: 0px;
width: 45px;
height: 45px;
background: #4285F4;
display: block;
border-radius: 45px;
animation: blueblock 2s forwards;
transform-origin: top center;
}
.yellow-shape {
position: absolute;
left: 122px;
top: 0px;
width: 45px;
height: 45px;
background: #FBBC04;
display: block;
border-radius: 45px;
animation: yellowblock 2s forwards;
transform-origin: top center;
}
.green-ball {
position: absolute;
border-radius: 45px;
width: 45px;
height: 45px;
background: #34A853;
animation: greenblock 1.5s forwards;
}
#keyframes blueblock {
0% {
height: 45px;
}
25% {
height: 140px;
transform: rotate(0deg);
}
50% {
transform: rotate(-30deg);
}
100% {
height: 140px;
transform: rotate(-30deg);
}
}
#keyframes yellowblock {
0% {
height: 45px;
opacity: 0;
}
25% {
height: 140px;
transform: rotate(0deg);
opacity: 0;
}
50% {
transform: rotate(30deg);
}
100% {
height: 140px;
transform: rotate(30deg);
opacity: 100;
left: 122px;
}
}
#keyframes greenblock {
0% {
top: 0px;
}
50% {
top: 45px;
}
100% {
bottom: 0px;
}
}
<div class="wrap">
<div class="yellow-shape">
<div class="green-ball">
</div>
</div>
<div class="blue-shape">
</div>
</div>
I've tried with this animation
animation: greenblock .6s ease-in-out .5s forwards;
and this set of keyframes
#keyframes greenblock {
0% { top: 0px; }
75% { top: calc(100% - 55px); }
50%, 100% { top: calc(100% - 45px); }
}
Demo
.wrap {
border: 1px solid red;
height: 300px;
width: 300px;
position: relative
}
.blue-shape {
position: absolute;
left: 100px;
top: 0px;
width: 45px;
height: 45px;
background: #4285F4;
display: block;
border-radius: 45px;
animation: blueblock 2s forwards;
transform-origin: top center;
}
.yellow-shape {
position: absolute;
left: 122px;
top: 0px;
width: 45px;
height: 45px;
background: #FBBC04;
display: block;
border-radius: 45px;
animation: yellowblock 2s forwards;
transform-origin: top center;
}
.green-ball {
position: absolute;
border-radius: 45px;
width: 45px;
height: 45px;
background: #34A853;
animation: greenblock .6s ease-in-out .5s forwards;
}
#keyframes blueblock {
0% {
height: 45px;
}
25% {
height: 140px;
transform: rotate(0deg);
}
50% {
transform: rotate(-30deg);
}
100% {
height: 140px;
transform: rotate(-30deg);
}
}
#keyframes yellowblock {
0% {
height: 45px;
opacity: 0;
}
25% {
height: 140px;
transform: rotate(0deg);
opacity: 0;
}
50% {
transform: rotate(30deg);
}
100% {
height: 140px;
transform: rotate(30deg);
opacity: 100;
left: 122px;
}
}
#keyframes greenblock {
0% { top: 0px; }
75% { top: calc(100% - 55px); }
50%, 100% { top: calc(100% - 45px); }
}
<div class="wrap">
<div class="yellow-shape">
<div class="green-ball">
</div>
</div>
<div class="blue-shape">
</div>
</div>
My preloader image does not center inside the circle and on small screen the perloader is not center at all. I have tried re-calculating auto margins nothing seems to work. how can I get the image to stay inside without spinning with the circle and center the preloader all together.
#load_cover {
width: 100%;
height: 100%;
position: fixed;
top: 0;
bottom: 0;
left: 0;
right: 0;
margin: auto;
text-align: center;
background-color: rgba(0, 0, 0);
z-index: 10000;
}
.loaderInner {
position: absolute;
top: 50%;
left: 50%;
margin: -50px 0px 0px -50px;
}
.logo {
position: absolute;
background-image: url("https://placeholdit.imgix.net/~text?txtsize=5&txt=40%C3%9745&w=40&h=45");
background-repeat: no-repeat;
width: 60px;
height: 60px;
top: 50%;
left: 50%;
margin: -50px 0px 0px -50px;
}
.loader {
border: 4px solid #838383;
border-radius: 50%;
border-top: 4px solid #dddddd;
width: 60px;
height: 60px;
-webkit-animation: spin 0.6s linear infinite;
animation: spin 0.6s linear infinite;
box-shadow: 0 0 1px #999;
filter: blur(0.7px);
}
#-webkit-keyframes spin {
0% {
-webkit-transform: rotate(0deg);
transform: rotate(0deg);
}
100% {
-webkit-transform: rotate(360deg);
transform: rotate(360deg);
}
}
#keyframes spin {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
<div id="load_cover">
<div class="loaderInner">
<div class="loader"></div>
<div class="logo"></div>
</div>
</div>
You can do something like this.
I took the .logo out and placed the image as the background of .loaderInner and then you position the image center.
#load_cover {
width: 100%;
height: 100%;
position: fixed;
top: 0;
bottom: 0;
left: 0;
right: 0;
margin: auto;
text-align: center;
background-color: rgba(0, 0, 0);
z-index: 10000;
}
.loaderInner {
background-image: url("https://placeholdit.imgix.net/~text?txtsize=5&txt=40%C3%9745&w=40&h=45");
background-position: center;
background-repeat: no-repeat;
position: absolute;
top: 50%;
left: 50%;
/*margin: -50px 0px 0px -50px;*/
transform: translate(-50%, -50%);
}
.loader {
border: 4px solid #838383;
border-radius: 50%;
border-top: 4px solid #dddddd;
width: 60px;
height: 60px;
-webkit-animation: spin 0.6s linear infinite;
animation: spin 0.6s linear infinite;
box-shadow: 0 0 1px #999;
filter: blur(0.7px);
}
#-webkit-keyframes spin {
0% {
-webkit-transform: rotate(0deg);
transform: rotate(0deg);
}
100% {
-webkit-transform: rotate(360deg);
transform: rotate(360deg);
}
}
#keyframes spin {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
<div id="load_cover">
<div class="loaderInner">
<div class="loader"></div>
<div class="logo"></div>
</div>
</div>
Update - The pen below has been updated to show the end results.
I am trying to mimic signal animation using css animation but I cant seem to grasp the idea of animation delay. If you look here
http://codepen.io/anon/pen/YwZOmK?editors=110
.real-time-animation {
margin-top: 20px;
position: relative;
transform: scale(0.5) rotate(45deg);
transform-origin: 5% 0%;
}
.real-time-animation>div {
animation: sk-bouncedelay 3s infinite forwards;
}
.circle1 {
animation-delay: 2s;
}
.circle2 {
animation-delay: 1s;
}
#keyframes sk-bouncedelay {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
.circle {
position: relative;
width: 16em;
height: 16em;
border-radius: 50%;
background: transparent;
border: 20px solid transparent;
border-top-color: darkblue;
position: absolute;
top: 0;
left: 0;
opacity: 0;
}
.circle2 {
top: 40px;
width: 12em;
height: 12em;
left: 33px;
}
.circle3 {
top: 80px;
width: 8em;
height: 8em;
left: 66px;
}
<div class="real-time-animation">
<div class="circle circle1"> </div>
<div class="circle circle2"> </div>
<div class="circle circle3"> </div>
</div>
You should be able to understand what I am trying to accomplish. I want to start from showing nothing, then after 1 sec show the first bar, then after 1 sec, show the 2nd bar and finally after another 1 sec show the 3rd bar.
My solution:
http://codepen.io/anon/pen/JGWmJg?editors=110
.real-time-animation{
margin-top: 20px;
position: relative;
transform: scale(0.5) rotate(45deg);
transform-origin: 5% 0%;
}
.circle1, .circle2, .circle3{
animation: 4s infinite ease-in;
animation-delay: 1s;
}
.circle1{
animation-name: circle1;
}
.circle2{
animation-name: circle2;
}
.circle3{
animation-name: circle3;
}
#keyframes circle1 {
0%{
opacity: 0;
}
25%{
opacity: 0;
}
50%{
opacity: 0;
}
75%{
opacity: 1;
}
100% {
opacity: 0;
}
}
#keyframes circle2 {
0%{
opacity: 0;
}
25%{
opacity: 0;
}
50%{
opacity: 1;
}
75% {
opacity: 1;
}
100%{
opacity: 0;
}
}
#keyframes circle3 {
0%{
opacity: 0;
}
25%{
opacity: 1;
}
50%{
opacity: 1;
}
75% {
opacity: 1;
}
100%{
opacity: 0;
}
}
.circle {
position: relative;
width: 16em; height: 16em;
border-radius: 50%;
background: transparent;
border: 20px solid transparent;
border-top-color: darkblue;
position: absolute;
top: 0;
left: 0;
opacity: 0;
}
.circle2{
top: 40px;
width: 12em;
height: 12em;
left: 33px;
}
.circle3{
top: 80px;
width: 8em;
height: 8em;
left: 66px;
}
You can change the speed of the animation duration: "animation: 4s infinite ease-in;"
As I understand your question animated opacity needs to be like this:
Progress \ Element
.circle1
.circle2
.circle3
0%
0
0
0
25%
0
0
1
50%
0
1
1
75%
1
1
1
100%
0
0
0
The opacity property is clamped which means if you set negative values, it will have the same effect as setting it to 0. The same goes for values larger than 1.
Using this property, we can subtract a constant value from predefined CSS variables and use that as opacity.
.real-time-animation {
zoom: 10;
width: 8px;
height: 8px;
position: relative;
display: inline-block;
}
.real-time-animation>.circle {
animation: circle 4s infinite ease-in;
}
.circle1 {
--circle: 1;
}
.circle2 {
--circle: 2;
}
.circle3 {
--circle: 3;
}
#keyframes circle {
0%, 100% {
opacity: 0;
}
25% {
opacity: calc(var(--circle) - 2);
}
50% {
opacity: calc(var(--circle) - 1);
}
75% {
opacity: 1;
}
}
.circle {
border-radius: 50%;
background: transparent;
border: 1px solid transparent;
border-top-color: darkblue;
position: absolute;
margin: 0;
box-sizing: border-box;
top: 100%;
left: 0%;
width: calc(16px - (var(--circle) - 1)*4px);
height: calc(16px - (var(--circle) - 1)*4px);;
transform: rotate(45deg) translate(-50%, -50%);
transform-origin: 0 0;
}
<div class="real-time-animation">
<div class="circle circle1"> </div>
<div class="circle circle2"> </div>
<div class="circle circle3"> </div>
</div>
How do I make the below animation fully work in safari browser ? It is working fine in Chrome.
Open the below link in chrome to see its full functionality (bounce and pulse effect), and in Safari to see the issue. Pulse effect around the pin doesn't work in safari!!
How can I fix this ?
Here is the JS FIDDLE link
html code:
<div class='pin bounce'></div>
<div class='pulse'></div>
CSS code:
body {
background: #e6e6e6;
}
.pin {
width: 30px;
height: 30px;
border-radius: 50% 50% 50% 0;
background: #00cae9;
position: absolute;
-webkit-transform: rotate(-45deg);
left: 50%;
top: 50%;
margin: -20px 0 0 -20px;
}
.pin:after {
content: "";
width: 14px;
height: 14px;
margin: 8px 0 0 8px;
background: #e6e6e6;
position: absolute;
border-radius: 50%;
}
.bounce {
-webkit-animation-name: bounce;
-webkit-animation-fill-mode: both;
-webkit-animation-duration: 1s;
}
.pulse {
background: #d6d4d4;
border-radius: 50%;
height: 14px;
width: 14px;
position: absolute;
left: 50%;
top: 50%;
margin: 11px 0px 0px -12px;
-webkit-transform: rotateX(55deg);
z-index: -2;
}
.pulse:after {
content: "";
border-radius: 50%;
height: 40px;
width: 40px;
position: absolute;
margin: -13px 0 0 -13px;
-webkit-animation: pulsate 1s ease-out;
-webkit-animation-iteration-count: infinite;
opacity: 0;
box-shadow: 0 0 1px 2px #00cae9;
-webkit-animation-delay: 1.1s;
}
#-webkit-keyframes pulsate {
0% {
-webkit-transform: scale(0.1, 0.1);
opacity: 0;
}
50% {
opacity: 1;
}
100% {
-webkit-transform: scale(1.2, 1.2);
opacity: 0;
}
}
#-webkit-keyframes bounce {
0% {
opacity: 0;
-webkit-transform: translateY(-2000px) rotate(-45deg);
}
60% {
opacity: 1;
-webkit-transform: translateY(30px) rotate(-45deg);
}
80% {
-webkit-transform: translateY(-10px) rotate(-45deg);
}
100% {
-webkit-transform: translateY(0) rotate(-45deg);
}
}