rotate around object smoothly in CSS - html

I have two images moving around a DOM element. But their rotation is wrong and the movement is not smooth.
My fiddle
#mainPage {
width: 400px;
height: 165px;
margin: 10% auto;
}
#mainPage>p {
text-align: center;
}
.bicycle {
width: 48px;
height: 30px;
background: red;
}
#bicycleOriginal {
animation: moveBicycleOriginal 20s infinite;
}
#bicycleFlipped {
animation: moveBicycleFlipped 20s infinite;
}
#mainTxt {
letter-spacing: 7px;
font-size: 30px;
margin-bottom: 30px;
}
#keyframes moveBicycleOriginal {
from {
transform: translate(0, 0);
}
1% {
transform: translate(0, 0) rotate(0deg);
}
25% {
transform: translate(350px, 0);
}
26% {
transform: translate(350px, 0) rotate(90deg);
}
50% {
transform: translate(350px, 150px);
}
51% {
transform: translate(350px, 150px) rotate(180deg);
}
75% {
transform: translate(0, 150px);
}
76% {
transform: translate(0, 150px) rotate(270deg);
}
to {
transform: translate(0, 0);
}
}
#keyframes moveBicycleFlipped {
from {
transform: translate(350px, 0);
}
1% {
transform: translate(350px, 0) rotate(0deg);
}
25% {
transform: translate(0, 0);
}
26% {
transform: translate(0, 0) rotate(90deg);
}
50% {
transform: translate(0, -150px);
}
51% {
transform: translate(0, -150px) rotate(180deg);
}
75% {
transform: translate(350px, -150px);
}
76% {
transform: translate(350px, -150px) rotate(270deg);
}
to {
transform: translate(350px, 0);
}
}
<div id="mainPage">
<div class="bicycle" id="bicycleOriginal"></div>
<p class="txt" id="mainTxt">DRAHTESEL</p>
<div class="bicycle" id="bicycleFlipped"></div>
</div>
So what I want is something like this
After passing the first keyframe the boxes get into a wrong rotation. Also they don't move smoothly, the get faster in the middle and slower when reaching the end.
Could someone help me with the keyframes?

You need to always keep the rotate defined within the transform because each transform will override the previous one and removing the rotation means rotate(0).
And to make the animation more accurate, the last state should be similar to the first state to avoid the jump when restarting the animation. So you should go to 360deg of rotation which is equivalent to 0deg. (like you did with the translation where you come back to the initial value).
Then you may adjust the animation-timing-function to control the animation progress if needed.
#mainPage {
width: 400px;
height: 165px;
margin: 10% auto;
}
#mainPage>p {
text-align: center;
}
.bicycle {
width: 48px;
height: 30px;
background: red;
}
#bicycleOriginal {
animation: moveBicycleOriginal 20s infinite;
}
#bicycleFlipped {
animation: moveBicycleFlipped 20s infinite;
}
#mainTxt {
letter-spacing: 7px;
font-size: 30px;
margin-bottom: 30px;
}
#keyframes moveBicycleOriginal {
from {
transform: translate(0, 0) rotate(0deg);
}
25% {
transform: translate(350px, 0) rotate(0deg);
}
26% {
transform: translate(350px, 0) rotate(90deg);
}
50% {
transform: translate(350px, 150px) rotate(90deg);
}
51% {
transform: translate(350px, 150px) rotate(180deg);
}
75% {
transform: translate(0, 150px) rotate(180deg);
}
76% {
transform: translate(0, 150px) rotate(270deg);
}
98% {
transform: translate(0, 0) rotate(270deg);
}
to {
transform: translate(0, 0) rotate(360deg);
}
}
#keyframes moveBicycleFlipped {
from {
transform: translate(350px, 0) rotate(0deg);
}
25% {
transform: translate(0, 0) rotate(0deg);
}
26% {
transform: translate(0, 0) rotate(90deg);
}
50% {
transform: translate(0, -150px) rotate(90deg);
}
51% {
transform: translate(0, -150px) rotate(180deg);
}
75% {
transform: translate(350px, -150px) rotate(180deg);
}
76% {
transform: translate(350px, -150px) rotate(270deg);
}
97% {
transform: translate(350px, 0) rotate(270deg);
}
to {
transform: translate(350px, 0) rotate(360deg);
}
}
<div id="mainPage">
<div class="bicycle" id="bicycleOriginal"></div>
<p class="txt" id="mainTxt">DRAHTESEL</p>
<div class="bicycle" id="bicycleFlipped"></div>
</div>

The speed slowing/speeding is because of the animationTiming (default ease), that should be 'linear'.
The reason the animation is incorrect, it because you unset the rotation. This might come unexpected, you control transformation with css transform. You also control rotation with transform.
#example{
transform: rotate(10deg)
}
#example.changed{
transform: translateX(100px);
}
In this snippet, when you add the class changed you redefine transform, telling it to forget rotate and set translateX. In this example, to keep them both:
#example.changed{
transform: rotate(10deg) translateX(100px);
}

I have taken the answer from Temani Afif, and changed it a little bit.
I set an aditional transform, applied after the rotation. This makes the turn be smooth in the sense that the object rotates following a path and not in the same place
I have set the timing to linear, as suggested by Martijn
I have simplified it to use a single keyframes rule, setting a delay on the flipped div.
And made longer the time slice for the long sides and shoprter the other, so that the perceived speed is more constant
The result:
#mainPage {
width: 400px;
height: 165px;
margin: 10% auto;
}
#mainPage>p {
text-align: center;
}
.bicycle {
width: 48px;
height: 30px;
background: red;
}
#bicycleOriginal {
animation: moveBicycleOriginal 20s infinite linear;
}
#bicycleFlipped {
position: relative;
top: -120px;
animation: moveBicycleOriginal 20s -10s infinite linear;
}
#mainTxt {
letter-spacing: 7px;
font-size: 30px;
margin-bottom: 30px;
}
#keyframes moveBicycleOriginal {
from {
transform: translate(0, 0) rotate(0deg) translate(0, -50px);
}
26% {
transform: translate(350px, 0) rotate(0deg) translate(0, -50px);
}
30% {
transform: translate(350px, 0) rotate(90deg) translate(0, -50px);
}
46% {
transform: translate(350px, 150px) rotate(90deg) translate(0, -50px);
}
50% {
transform: translate(350px, 150px) rotate(180deg) translate(0, -50px);
}
76% {
transform: translate(0, 150px) rotate(180deg) translate(0, -50px);
}
80% {
transform: translate(0, 150px) rotate(270deg) translate(0, -50px);
}
96% {
transform: translate(0, 0) rotate(270deg) translate(0, -50px);
}
to {
transform: translate(0, 0) rotate(360deg) translate(0, -50px);
}
}
<div id="mainPage">
<div class="bicycle" id="bicycleOriginal"></div>
<p class="txt" id="mainTxt">DRAHTESEL</p>
<div class="bicycle" id="bicycleFlipped"></div>
</div>

Related

How can I move an element upside down while moving forward?

.anim-cat-2 img {
animation: animcats 10s infinite;
}
#keyframes animcats {
0% {
transform: translate(100px, 100px)rotate(-15deg);
}
10% {
transform: translate(150px, -100px) rotate(15deg);
}
20% {
transform: rotate(-15deg) translate(200px, 100px);
}
30% {
transform: rotate(15deg)translate(250px, -100px);
}
40% {
transform: rotate(-15deg)translate(300px, 100px);
}
50% {
transform: rotate(15deg)translate(350px, -100px);
}
60% {
transform: rotate(-15deg)translate(400px, 100px);
}
70% {
transform: rotate(15deg)translate(450px, -100px);
}
80% {
transform: rotate(-15deg)translate(500px, 100px);
}
90% {
transform: rotate(15deg)translate(550px, -100px);
}
100% {
transform: rotate(-15deg)translate(600 px, 100px);
}
}
<div class="anim-cat-2">
<img src="https://66.media.tumblr.com/95927edf9e85ece73dac69ade623432c/tumblr_otrmgaTiin1vxe4v6o1_400.png" style="height: 130px;width: 180px;margin-top: 20px;">
</div>
i cant make it go smoothly forward in right tilt, its suppossed to make the right angle and move up and down moving forward. i already tried to change the degree, x n y axis but it still didnt work,please help me
Run code snippet.
Although it makes the right angle, move up and down, it did'nt meets the expectation at the end of the animation.
.anim-cat-2 img {
animation: animcats 8s infinite;
}
#keyframes animcats {
0% {
transform: rotate(0deg) translate(0px,0px);
}
8% {
transform: rotate(9deg);
}
10% {
transform: translate(100px,150px);
}
20% {
transform:rotate(-9deg) translate(100px,150px);
}
30% {
transform: translate(200px,0px);
}
40% {
transform: rotate(9deg) translate(200px,0px);
}
50% {
transform: translate(300px,150px);
}
60% {
transform: rotate(-9deg) translate(300px,150px);
}
70% {
transform: translate(400px,0px);
}
80% {
transform: rotate(9deg) translate(400px,0px);
}
90% {
transform: translate(500px,150px);
}
100% {
transform: rotate(-9deg) translate(500px,150px);
}
}
<div class="anim-cat-2">
<img src="https://66.media.tumblr.com/95927edf9e85ece73dac69ade623432c/tumblr_otrmgaTiin1vxe4v6o1_400.png" style="height: 130px;width: 180px;margin-top: 20px;">
</div>

CSS phone ringng animation

I want to have my font awesome icon "ring" each 1 seconds, by ring I mean having a css animation which makes the phone look like if it where ringing (maybe a brief rotation with transform origin center?), I'm a noob with css animations:
<div style="width:50px; height:50px; border-radius:50%; display:flex; align-items:center; justify-content:center; background-color:white;"><i class="LAYOUTnav7_links_button_icon fa fa-phone fs_bigger main"></i></div>
Any help?
You can use animation and keyframes to do this, here is an example:
.phone {
display:block;
width: 60px;
height: 60px;
font-size: 40px;
margin:50px auto 0;
color: #9e9e9e;
animation: ring 4s .7s ease-in-out infinite;
transform-origin: 50% 4px;
}
#keyframes ring {
0% { transform: rotate(0); }
5% { transform: rotate(30deg); }
10% { transform: rotate(-28deg); }
15% { transform: rotate(34deg); }
20% { transform: rotate(-32deg); }
25% { transform: rotate(30deg); }
30% { transform: rotate(-28deg); }
35% { transform: rotate(26deg); }
40% { transform: rotate(-24deg); }
45% { transform: rotate(22deg); }
50% { transform: rotate(-20deg); }
55% { transform: rotate(18deg); }
60% { transform: rotate(-16deg); }
65% { transform: rotate(14deg); }
70% { transform: rotate(-12deg); }
75% { transform: rotate(10deg); }
80% { transform: rotate(-8deg); }
85% { transform: rotate(6deg); }
90% { transform: rotate(-4deg); }
95% { transform: rotate(2deg); }
100% { transform: rotate(-1deg); }
}
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.2/css/all.css" integrity="sha384-oS3vJWv+0UjzBfQzYUhtDYW+Pj2yciDJxpsK1OYPAYjqT085Qq/1cq5FLXAZQ7Ay" crossorigin="anonymous">
<div>
<span class="phone fa fa-phone"></span>
</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.

CSS Animation Error

I am trying to create a CSS3 only animation that makes a span (one letter) look like it swings back and forth and then falls off the screen while turning. Here is my CSS:
#-webkit-keyframes swing {
10% { -webkit-transform: rotate(15deg); }
15% { -webkit-transform: rotate(-10deg); }
20% { -webkit-transform: rotate(5deg); }
25% { -webkit-transform: rotate(-5deg); }
30% { -webkit-transform: rotate(2deg); }
35% { -webkit-transform: rotate(-1deg); }
40% { -webkit-transform: rotate(0deg); }
75% { -webkit-transform: rotate(15deg); -webkit-transform: translate(0, 1500px); }
100% { -webkit-transform: rotate(15deg); -webkit-transform:translate(0, 1500px); }
}
#keyframes swing {
10% { transform: rotate(15deg); }
15% { transform: rotate(-10deg); }
20% { transform: rotate(5deg); }
25% { transform: rotate(-5deg); }
30% { transform: rotate(2deg); }
35% { transform: rotate(-1deg); }
40% { transform: rotate(0deg); }
75% { transform: rotate(15deg); -webkit-transform: translate(0, 1500px); }
100% { transform: rotate(15deg); -webkit-transform: translate(0, 1500px); }
}
.animateone {
display: inline-block;
-webkit-animation-name: swing;
animation-name: swing;
-webkit-transform-origin: top center;
transform-origin: top center;
-webkit-animation-duration: 3s;
animation-duration: 3s;
-webkit-animation-fill-mode: both;
animation-fill-mode: both;
}
And here is the result: Result
Why isn't the 'A' rotating as it falls?
You should write your transforms into a single statement:
#keyframes swing {
75% { transform: rotate(700deg) translate(0, 1500px); }
100% { transform: rotate(700deg) translate(0, 1500px); }
}
UPDATED
If you want rotate when falling, you should use two animations separately:
#keyframes translate {
10% { transform: translate(0, 0); }
15% { transform: translate(0, 0); }
20% { transform: translate(0, 0); }
25% { transform: translate(0, 0); }
30% { transform: translate(0, 0); }
35% { transform: translate(0, 0); }
40% { transform: translate(0, 0); }
75% { transform: translate(0, 1500px); }
100% { transform: translate(0, 1500px); }
}
#keyframes rotate {
10% { transform: rotate(15deg); }
15% { transform: rotate(-10deg); }
20% { transform: rotate(5deg); }
25% { transform: rotate(-5deg); }
30% { transform: rotate(2deg); }
35% { transform: rotate(-1deg); }
40% { transform: rotate(0deg); }
75% { transform: rotate(700deg); }
100% { transform: rotate(700deg); }
}
.rotate {
display: inline-block;
animation-name: rotate;
transform-origin: top center;
animation-duration: 5s;
animation-fill-mode: both;
}
.translate {
display: inline-block;
animation-name: translate;
transform-origin: top center;
animation-duration: 5s;
animation-fill-mode: both;
}
<header>
<h1>W.I.P.<?h1>
<h2>
A Text
<span class="translate">
<span class="rotate">A</span>
</span>
dventure
</h2>
</header>
In first place, you can only set a transform property at a time. If you want to combine 2, set them in a comma separate list. (ROX was right about this).
In the second place, order of the transforms is important. If you want the span to move while rotating, the order must be the one that you see in the snippet.
I have also changed the transform origin, to make it visually more smooth, and changed the animation to linear for the same reason. Nut of course you can adjust it as you want
#-webkit-keyframes swing {
10% { transform: translate(0, 0px) rotate(15deg); transform-origin: top center;}
15% { transform: translate(0, 0px) rotate(-10deg); }
20% { transform: translate(0, 0px) rotate(5deg); }
25% { transform: translate(0, 0px) rotate(-5deg); }
30% { transform: translate(0, 0px) rotate(2deg); }
35% { transform: translate(0, 0px) rotate(-1deg); }
40% { transform: translate(0, 0px) rotate(0deg); transform-origin: top center;}
40% { transform: translate(0, 0px) rotate(0deg); transform-origin: center center;}
75% { transform: translate(0, 150px) rotate(375deg); }
100% { transform: translate(0, 150px) rotate(375deg); transform-origin: top center;}
}
#keyframes swing {
10% { transform: translate(0, 0px) rotate(15deg); transform-origin: top center;}
15% { transform: translate(0, 0px) rotate(-10deg); }
20% { transform: translate(0, 0px) rotate(5deg); }
25% { transform: translate(0, 0px) rotate(-5deg); }
30% { transform: translate(0, 0px) rotate(2deg); }
35% { transform: translate(0, 0px) rotate(-1deg); }
40% { transform: translate(0, 0px) rotate(0deg); transform-origin: top center;}
40% { transform: translate(0, 0px) rotate(0deg); transform-origin: center center;}
75% { transform: translate(0, 150px) rotate(375deg); }
100% { transform: translate(0, 150px) rotate(375deg); transform-origin: top center;}
}
.animateone {
display: inline-block;
-webkit-animation: swing 3s infinite linear;
animation: swing 3s infinite linear;
transform-origin: top center;
}
<span class="animateone">A</a>

CSS3 Arrow animation is not working [duplicate]

This question already has an answer here:
How do I make Sass work?
(1 answer)
Closed 7 years ago.
I am trying to animate an arrow downwards to indicate scroll down in a parallex site.
I have got this code from Codepen.
See working demo here : CodePen arrow animation
I am exactly using the same code on my site but it does not animate.
The arrow shows up but it does not animate.
What I am doing wrong?
HTML:
<div class="encircle bounce animated">
<div class="arrow">
</div>
</div>
CSS:
#mixin keyframes($name) {
#-webkit-keyframes #{$name} {
#content;
}
#-moz-keyframes #{$name} {
#content;
}
#-ms-keyframes #{$name} {
#content;
}
#keyframes #{$name} {
#content;
}
}
#mixin animation($animation) {
-webkit-animation: #{$animation};
-moz-animation: #{$animation};
-ms-animation: #{$animation};
animation: #{$animation};
}
#mixin transform($transform) {
-webkit-transform: $transform;
-moz-transform: $transform;
-ms-transform: $transform;
transform: $transform;
}
#include keyframes(bounce) {
0%, 20%, 50%, 80%, 100% {
#include transform(translateY(0));
}
40% {
#include transform(translateY(-20px));
}
60% {
#include transform(translateY(-10px));
}
}
body {
background: black;
}
.encircle {
width:60px;
height:60px;
border-radius:60px;
border: solid 2px white;
position: fixed;
bottom: 0;
left: 50%;
}
.arrow {
margin:0 auto;
margin-top: 13px;
width: 30px;
height: 30px;
background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAxNi4wLjAsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+DQo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IiB3aWR0aD0iNTEycHgiIGhlaWdodD0iNTEycHgiIHZpZXdCb3g9IjAgMCA1MTIgNTEyIiBlbmFibGUtYmFja2dyb3VuZD0ibmV3IDAgMCA1MTIgNTEyIiB4bWw6c3BhY2U9InByZXNlcnZlIj4NCjxwYXRoIGZpbGw9IiNGRkZGRkYiIGQ9Ik0yOTMuNzUxLDQ1NS44NjhjLTIwLjE4MSwyMC4xNzktNTMuMTY1LDE5LjkxMy03My42NzMtMC41OTVsMCwwYy0yMC41MDgtMjAuNTA4LTIwLjc3My01My40OTMtMC41OTQtNzMuNjcyICBsMTg5Ljk5OS0xOTBjMjAuMTc4LTIwLjE3OCw1My4xNjQtMTkuOTEzLDczLjY3MiwwLjU5NWwwLDBjMjAuNTA4LDIwLjUwOSwyMC43NzIsNTMuNDkyLDAuNTk1LDczLjY3MUwyOTMuNzUxLDQ1NS44Njh6Ii8+DQo8cGF0aCBmaWxsPSIjRkZGRkZGIiBkPSJNMjIwLjI0OSw0NTUuODY4YzIwLjE4LDIwLjE3OSw1My4xNjQsMTkuOTEzLDczLjY3Mi0wLjU5NWwwLDBjMjAuNTA5LTIwLjUwOCwyMC43NzQtNTMuNDkzLDAuNTk2LTczLjY3MiAgbC0xOTAtMTkwYy0yMC4xNzgtMjAuMTc4LTUzLjE2NC0xOS45MTMtNzMuNjcxLDAuNTk1bDAsMGMtMjAuNTA4LDIwLjUwOS0yMC43NzIsNTMuNDkyLTAuNTk1LDczLjY3MUwyMjAuMjQ5LDQ1NS44Njh6Ii8+DQo8L3N2Zz4=);
background-size: contain;
}
.bounce {
#include animation(bounce 2s infinite);
}
You have SASS source code and it'll not work for you if you just include it like a css file. you need a SASS pre-compiler or use directly the generated css
#-webkit-keyframes bounce {
0%, 20%, 50%, 80%, 100% {
-webkit-transform: translateY(0);
-moz-transform: translateY(0);
-ms-transform: translateY(0);
transform: translateY(0);
}
40% {
-webkit-transform: translateY(-20px);
-moz-transform: translateY(-20px);
-ms-transform: translateY(-20px);
transform: translateY(-20px);
}
60% {
-webkit-transform: translateY(-10px);
-moz-transform: translateY(-10px);
-ms-transform: translateY(-10px);
transform: translateY(-10px);
}
}
#-moz-keyframes bounce {
0%, 20%, 50%, 80%, 100% {
-webkit-transform: translateY(0);
-moz-transform: translateY(0);
-ms-transform: translateY(0);
transform: translateY(0);
}
40% {
-webkit-transform: translateY(-20px);
-moz-transform: translateY(-20px);
-ms-transform: translateY(-20px);
transform: translateY(-20px);
}
60% {
-webkit-transform: translateY(-10px);
-moz-transform: translateY(-10px);
-ms-transform: translateY(-10px);
transform: translateY(-10px);
}
}
#-ms-keyframes bounce {
0%, 20%, 50%, 80%, 100% {
-webkit-transform: translateY(0);
-moz-transform: translateY(0);
-ms-transform: translateY(0);
transform: translateY(0);
}
40% {
-webkit-transform: translateY(-20px);
-moz-transform: translateY(-20px);
-ms-transform: translateY(-20px);
transform: translateY(-20px);
}
60% {
-webkit-transform: translateY(-10px);
-moz-transform: translateY(-10px);
-ms-transform: translateY(-10px);
transform: translateY(-10px);
}
}
#keyframes bounce {
0%, 20%, 50%, 80%, 100% {
-webkit-transform: translateY(0);
-moz-transform: translateY(0);
-ms-transform: translateY(0);
transform: translateY(0);
}
40% {
-webkit-transform: translateY(-20px);
-moz-transform: translateY(-20px);
-ms-transform: translateY(-20px);
transform: translateY(-20px);
}
60% {
-webkit-transform: translateY(-10px);
-moz-transform: translateY(-10px);
-ms-transform: translateY(-10px);
transform: translateY(-10px);
}
}
body {
background: black;
}
.encircle {
width: 60px;
height: 60px;
border-radius: 60px;
border: solid 2px white;
position: fixed;
bottom: 0;
left: 50%;
}
.arrow {
margin: 0 auto;
margin-top: 13px;
width: 30px;
height: 30px;
background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAxNi4wLjAsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+DQo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IiB3aWR0aD0iNTEycHgiIGhlaWdodD0iNTEycHgiIHZpZXdCb3g9IjAgMCA1MTIgNTEyIiBlbmFibGUtYmFja2dyb3VuZD0ibmV3IDAgMCA1MTIgNTEyIiB4bWw6c3BhY2U9InByZXNlcnZlIj4NCjxwYXRoIGZpbGw9IiNGRkZGRkYiIGQ9Ik0yOTMuNzUxLDQ1NS44NjhjLTIwLjE4MSwyMC4xNzktNTMuMTY1LDE5LjkxMy03My42NzMtMC41OTVsMCwwYy0yMC41MDgtMjAuNTA4LTIwLjc3My01My40OTMtMC41OTQtNzMuNjcyICBsMTg5Ljk5OS0xOTBjMjAuMTc4LTIwLjE3OCw1My4xNjQtMTkuOTEzLDczLjY3MiwwLjU5NWwwLDBjMjAuNTA4LDIwLjUwOSwyMC43NzIsNTMuNDkyLDAuNTk1LDczLjY3MUwyOTMuNzUxLDQ1NS44Njh6Ii8+DQo8cGF0aCBmaWxsPSIjRkZGRkZGIiBkPSJNMjIwLjI0OSw0NTUuODY4YzIwLjE4LDIwLjE3OSw1My4xNjQsMTkuOTEzLDczLjY3Mi0wLjU5NWwwLDBjMjAuNTA5LTIwLjUwOCwyMC43NzQtNTMuNDkzLDAuNTk2LTczLjY3MiAgbC0xOTAtMTkwYy0yMC4xNzgtMjAuMTc4LTUzLjE2NC0xOS45MTMtNzMuNjcxLDAuNTk1bDAsMGMtMjAuNTA4LDIwLjUwOS0yMC43NzIsNTMuNDkyLTAuNTk1LDczLjY3MUwyMjAuMjQ5LDQ1NS44Njh6Ii8+DQo8L3N2Zz4=);
background-size: contain;
}
.bounce {
-webkit-animation: bounce 2s infinite;
-moz-animation: bounce 2s infinite;
-ms-animation: bounce 2s infinite;
animation: bounce 2s infinite;
}
to read more about SASS