Three Circle Object is not rotate 360degree - html

Please see the code below.
.nk-loader-c {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.nk-loader-circle {
transform-origin: bottom center;
animation: obj-rotate 3s linear infinite;
height: 36px;
}
.obj-circle {
display: inline-block;
background-color: #6540eb;
height: 20px;
width: 20px;
border-radius: 50%;
transform: scale(0);
animation: obj-grow 1.5s linear infinite;
margin: -5px;
}
.obj-circle:nth-child(1) {
background-color: #3766f3;
animation-delay: 1.5s;
}
.obj-circle:nth-child(2) {
background-color: #603aef;
animation-delay: .75s;
}
.obj-circle:nth-child(3) {
background-color: #2998f6;
animation-delay: .37s;
}
#keyframes obj-rotate {
to{
transform: rotate(360deg);
}
}
#keyframes obj-grow {
50% {
transform: scale(1);
}
}
<div class="nk-loader-c">
<div class="nk-loader-circle">
<div class="obj-circle"></div>
<div class="obj-circle"></div>
<div class="obj-circle"></div>
</div>
</div>
Can anyone help me with this? the rotation of the object circle is not
really 360degrees. Can anyone help me how can I make the rotation
360deg?
But when I tried using two circles the rotation if working on 360degress.

What about this?
.nk-loader-c {
padding-top: 50px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.nk-loader-circle {
position:absolute;
transform-origin: bottom center;
animation: obj-rotate 3s linear infinite;
height: 36px;
}
.obj-circle {
display: inline-block;
background-color: #6540eb;
height: 20px;
width: 20px;
border-radius: 50%;
transform: scale(0);
animation: obj-grow 1.5s linear infinite;
margin: -5px;
}
.nk-loader-circle:nth-child(1){
animation-delay: -0.5s;
}
.nk-loader-circle:nth-child(1) .obj-circle{
background-color: #3766f3;
animation-delay: 1.5s;
}
.nk-loader-circle:nth-child(2){
animation-delay: -.25s;
}
.nk-loader-circle:nth-child(2) .obj-circle{
background-color: #603aef;
animation-delay: .75s;
}
.nk-loader-circle:nth-child(3) {
animation-delay: 0s;
}
.nk-loader-circle:nth-child(3) .obj-circle{
background-color: #2998f6;
animation-delay: .37s;
}
#keyframes obj-rotate {
to {
transform: rotate(360deg);
}
}
#keyframes obj-grow {
50% {
transform: scale(1);
}
}
<div class="nk-loader-c">
<div class="nk-loader-circle">
<div class="obj-circle"></div>
</div>
<div class="nk-loader-circle">
<div class="obj-circle"></div>
</div>
<div class="nk-loader-circle">
<div class="obj-circle"></div>
</div>
</div>
</div>

Related

Spinner acting out

Any ideas of what is happening here? Why does the purple box position itself outside the spinner for a moment there?
This is my css and rotate animation:
.spinner {
display: flex;
align-items: center;
justify-content: center;
background-color: red;
}
.spinner-ball {
border: 2px solid blue;
border-bottom-color: transparent;
border-radius: 100%;
height: 26px;
width: 26px;
background: transparent !important;
display: inline-block;
animation-fill-mode: both;
-webkit-animation-fill-mode: both;
animation: rotate 1s linear infinite;
-webkit-animation: rotate 1s linear infinite;
}
#keyframes rotate {
from {
transform: rotate(0deg);
-webkit-transform: rotate(0deg);
}
to {
transform: rotate(360deg);
-webkit-transform: rotate(360deg);
}
}
<div class="spinner">
<div class="spinner-ball" />
</div>

Keyframes not animating height

the keyframes i created in my scss should be animating my height to make it a 2s animation but it has not done that instead the height is just transforming instantly but the width in the same keyframe is being animated.
#import url("https://fonts.googleapis.com/css2?family=Maven+Pro:wght#500&family=Roboto&display=swap");
* {
font-family: "Maven Pro", sans-serif;
color: white;
animation-delay: 1s;
}
body {
width: 100%;
height: 100vh;
margin: 0%;
background-color: green;
display: flex;
justify-content: center;
align-items: flex-end;
overflow: hidden;
position: absolute;
bottom: 5%;
}
.swipe {
animation-name: swipeWidthHeight, close;
animation-duration: 0.3s 2s;
animation-delay: 1s, 10s;
animation-fill-mode: forwards, forwards;
display: flex;
justify-content: center;
height: 179px;
width: 434px;
background-color: #fff;
}
.swipe .side {
width: 180px;
height: 100%;
background-color: #fff;
display: flex;
justify-content: center;
animation-name: imageSize;
animation-fill-mode: forwards;
animation-duration: 0.3s;
}
.swipe .side img {
width: 80%;
}
.swipe .center {
position: relative;
animation-name: centerExpand;
animation-fill-mode: forwards;
animation-duration: 0.3s;
width: 74px;
height: 100%;
background-color: #38003c;
display: flex;
justify-content: center;
align-items: center;
}
.swipe .center .popup.firstHalf {
opacity: 0;
position: absolute;
transform: translateX(-50%);
left: 50%;
width: 135px;
height: 35px;
background-color: white;
color: #38003c;
text-align: center;
font-family: "roboto";
font-size: 22px;
line-height: 35px;
font-weight: 500;
animation-name: firstHalf;
animation-delay: 2s;
animation-duration: 3s;
animation-fill-mode: forwards;
}
.swipe .center .popup.eaSports {
opacity: 0;
position: absolute;
transform: translateX(-50%);
left: 50%;
width: 110px;
height: 76px;
background-color: #38003c;
color: #38003c;
display: flex;
align-items: center;
justify-content: center;
animation-name: firstHalf;
animation-delay: 4.8s;
animation-duration: 3s;
animation-fill-mode: forwards;
}
.swipe .center .popup.eaSports img {
width: 61px;
}
.swipe .center .textContainer {
font-weight: 400;
opacity: 0;
margin: 0% 2% 0% 2%;
height: 100%;
width: 100%;
}
.swipe .center .textContainer.left {
text-align: right;
animation-delay: 1.15s;
animation-name: leftText;
animation-duration: 0.2s;
animation-fill-mode: forwards;
animation-timing-function: cubic-bezier(0.34, 0.58, 0.37, 1.48);
}
.swipe .center .textContainer.right {
animation-name: rightText;
animation-delay: 1.15s;
animation-duration: 0.2s;
animation-fill-mode: forwards;
animation-timing-function: cubic-bezier(0.34, 0.58, 0.37, 1.48);
}
.swipe .center img {
width: 44px;
}
#keyframes swipeWidthHeight {
0% {
height: 179px;
width: 434px;
}
100% {
height: 77px;
width: 1064px;
}
}
#keyframes centerExpand {
90% {
justify-content: space-between;
}
100% {
width: 1020px;
justify-content: space-between;
}
}
#keyframes rightText {
0% {
opacity: 1;
}
100% {
padding-left: 10%;
opacity: 1;
}
}
#keyframes leftText {
0% {
opacity: 1;
}
100% {
padding-right: 10%;
opacity: 1;
}
}
#keyframes imageSize {
100% {
height: 77px;
width: 77px;
}
}
#keyframes firstHalf {
0% {
opacity: 1;
bottom: 0%;
z-index: -1;
}
10% {
z-index: -1;
opacity: 1;
bottom: 100%;
}
90% {
z-index: -1;
opacity: 1;
bottom: 100%;
}
99% {
z-index: -1;
opacity: 1;
bottom: 0%;
}
100% {
z-index: -1;
opacity: 0;
bottom: 0%;
}
}
#keyframes close {
100% {
width: 1064px;
height: 77px;
bottom: -20%;
}
}
<body>
<div class="swipe">
<div class="left side">
<img src="https://cdn.discordapp.com/attachments/868038988437536768/918357217772732446/crest.svg" alt="">
</div>
<div class="center">
<div class="firstHalf popup">First Half</div>
<div class="eaSports popup">
<img src="https://cdn.discordapp.com/attachments/868038988437536768/918357218003415080/ea-sports-logo.png" alt="">
</div>
<div class="textContainer left">
<h1 class="text ">MANCHESTER CITY</h1>
</div>
<img src="https://cdn.discordapp.com/attachments/868038988437536768/918357218208907274/premier-league-icon.png" alt="">
<div class="textContainer right">
<h1 class="text ">MANCHESTER CITY</h1>
</div>
</div>
<div class="right side">
<img src="https://cdn.discordapp.com/attachments/868038988437536768/918357217772732446/crest.svg" alt="">
</div>
</div>
</body>
In the codepen the class "swipe" and key frame of 'swipeWidthHeight'is the element thats is having issues with the height not animating.
here is a codepen below if the whole project for a better understanding
https://codepen.io/charlieschuyler/pen/zYBZzZv
Comma Missing:
.swipe {
animation-name: swipeWidthHeight, close;
animation-duration: 0.3s, 2s; /* missing comma */
animation-delay: 1s, 10s;
animation-fill-mode: forwards, forwards;
display: flex;
justify-content: center;
height: 179px;
width: 434px;
background-color: #fff;
}

Triggering a transition mid-animation CSS

Been trying to trigger a transition using :hover in a running animation using CSS, in the example below, only the background-color changes on :hover but the transform property is triggered only after an animation stops. How can I trigger the transform: rotate during the animation?
Also, my initial background-color: red seems to fade-in when I reload the page without me explicitly triggering it by :hover. I assume it's caused by the transition-duration, can this be avoided using only CSS?
.container {
height: 300px;
display: flex;
justify-content: center;
align-items: center;
}
.red {
width: 100px;
height: 100px;
background-color: red;
animation-name: animation;
animation-duration: 5s;
animation-delay: 0;
animation-timing-function: ease-in-out;
animation-direction: alternate;
transition-duration: 5s;
transition-property: all;
}
.red:hover {
transform: rotate(180deg);
background-color: teal;
}
#keyframes animation {
0% {
transform: scale(1);
}
50% {
transform: scale(1.5);
}
100% {
transform: scale(1);
}
}
<body>
<div class="container">
<div class="red"></div>
</div>
</body>
Transforms do not stack in this way. One way to work around this limitation could be to use a parent element for the rotation transform.
.container {
height: 300px;
display: flex;
justify-content: center;
align-items: center;
}
.red {
width: 100px;
height: 100px;
background-color: red;
animation-name: animation;
animation-duration: 5s;
animation-delay: 0;
animation-timing-function: ease-in-out;
animation-direction: alternate;
transition-duration: 5s;
transition-property: all;
}
.red:hover {
background-color: teal;
}
.wrap {
transition: all 5s;
}
.wrap:hover {
transform: rotate(180deg);
}
#keyframes animation {
0% {
transform: scale(1);
}
50% {
transform: scale(1.5);
}
100% {
transform: scale(1);
}
}
<body>
<div class="container">
<div class="wrap">
<div class="red"></div>
</div>
</div>
</body>

Making a wave animation

I am trying to make audio wave animation. What is wrong with this code?
I tried to change translate to scale but it didn't work. Could someone give me a link to some exercises of animation?
* {
-webkit-box-sizing: border-box;
box-sizing: border-box;
-webkit-perspective: 1000px;
perspective: 1000px;
}
div {
width: 400px;
height: 200px;
margin: 50px auto;
}
span {
display: inline-block;
background-color: green;
width: 20px;
height: 20px;
animation: wave 2s linear infinite;
}
.a1 {
animation-delay: 0s;
}
.a2 {
animation-delay: .2s;
}
.a3 {
animation-delay: .4s;
}
.a4 {
animation-delay: .6s;
}
.a5 {
animation-delay: .8s;
}
#keyframes wave {
0%, 50%, 75%, 100% {
height: 5px;
transform: translateY(0px);
}
25% {
height: 30px;
transform: translateY(15px);
background-color: palevioletred;
}
}
<div>
<span class="a1"></span>
<span class="a2"></span>
<span class="a3"></span>
<span class="a4"></span>
<span class="a5"></span>
</div>
wave , code is working but it does not appear as a wave
You can remove the up and down movement of the elements by animating the transform property instead of the height of the elements.
You can use the scaleY() function to make the elements grow on the Y axis (height).
Example :
* {
-webkit-box-sizing: border-box;
box-sizing: border-box;
-webkit-perspective: 1000px;
perspective: 1000px;
}
div {
width: 400px;
height: 200px;
margin: 50px auto;
}
span {
display: inline-block;
background-color: green;
width: 20px;
height: 20px;
animation: wave 2s linear infinite;
}
.a1 {
animation-delay: 0s;
}
.a2 {
animation-delay: .2s;
}
.a3 {
animation-delay: .4s;
}
.a4 {
animation-delay: .6s;
}
.a5 {
animation-delay: .8s;
}
#keyframes wave {
0%, 50%{
transform: scaleY(1);
}
25% {
transform: scaleY(4);
background-color: palevioletred;
}
}
<div>
<span class="a1"></span>
<span class="a2"></span>
<span class="a3"></span>
<span class="a4"></span>
<span class="a5"></span>
</div>

How to fix a Div position from moving when another changes height dynamically

I have a 'bouncing loader' div, in which moves up and down on an infinite loop (see this jsfiddle
However, if I place a button below it, (or anything else for that matter), it will also move in time to the animation effect.
Is there anyway of stopping this button from moving?
I have tried adding margins/padding on both, but they didn't work so I removed them.
the loader html:
<div class="loader" style="float:initial;">
<span></span>
<span></span>
<span></span>
</div>
<br />
<div>
<button id="popupArea">Click here to invoke a popup window</button>
</div>
with the css being:
.loader {
text-align: center;
}
.loader span {
display: inline-block;
vertical-align: middle;
width: 10px;
height: 10px;
margin: 50px auto;
background: black;
border-radius: 50px;
-webkit-animation: loader 0.9s infinite alternate;
-moz-animation: loader 0.9s infinite alternate;
}
.loader span:nth-of-type(2) {
-webkit-animation-delay: 0.3s;
-moz-animation-delay: 0.3s;
}
.loader span:nth-of-type(3) {
-webkit-animation-delay: 0.6s;
-moz-animation-delay: 0.6s;
}
#-webkit-keyframes loader {
0% {
width: 10px;
height: 10px;
opacity: 0.9;
-webkit-transform: translateY(0);
}
100% {
width: 24px;
height: 24px;
opacity: 0.1;
-webkit-transform: translateY(-21px);
}
}
#-moz-keyframes loader {
0% {
width: 10px;
height: 10px;
opacity: 0.9;
-moz-transform: translateY(0);
}
100% {
width: 24px;
height: 24px;
opacity: 0.1;
-moz-transform: translateY(-21px);
}
}
As always, any help/advice is welcomed.
Please note, I'm don't know jquery, so would like to avoid it as much as possible (hence i'm using asp MVC)
Just add the following css attribute:
#popupArea {
position:fixed;
top:100px;//you can change the value as you wish
}
Example here.
try like this
.loader {
text-align: center;
}
.loader span {
display: inline-block;
vertical-align: middle;
width: 10px;
height: 10px;
margin: 50px auto;
background: black;
border-radius: 50px;
-webkit-animation: loader 0.9s infinite alternate;
-moz-animation: loader 0.9s infinite alternate;
}
.loader span:nth-of-type(2) {
-webkit-animation-delay: 0.3s;
-moz-animation-delay: 0.3s;
}
.loader span:nth-of-type(3) {
-webkit-animation-delay: 0.6s;
-moz-animation-delay: 0.6s;
}
#-webkit-keyframes loader {
0% {
width: 10px;
height: 10px;
opacity: 0.9;
-webkit-transform: translateY(0);
}
100% {
width: 24px;
height: 24px;
opacity: 0.1;
-webkit-transform: translateY(-21px);
}
}
#-moz-keyframes loader {
0% {
width: 10px;
height: 10px;
opacity: 0.9;
-moz-transform: translateY(0);
}
100% {
width: 24px;
height: 24px;
opacity: 0.1;
-moz-transform: translateY(-21px);
}
}
<div class="loader" style="height:100px;">
<span></span>
<span></span>
<span></span>
</div>
<br />
<div>
<button id="popupArea">Click here to invoke a popup window</button>
</div>
Try to put height at loader's div .
.loader {
text-align: center;
height:85px;
}
http://jsfiddle.net/csdtesting/9emc9so9/4/
Simple, just set the height for the span
Set height: 100px; in the loader
.loader {
text-align: center;
height:100px;
}
Here is a DEMO