Cookies Consent

This website uses cookies to ensure you get the best experience on our website.

Learn More

Animated Loader using HTML and CSS

5 min read

 






How to create an animated loading effect.

Hello Everyone 👋 Welcome to My New Blog. Today we'll create an animated loading effect using HTML and CSS only.😍

I am Aaditya, sharing interesting projects and codes daily. You can follow me up on my Instagram handle @_foxstack_

Where can we use it?

This effect can be shown to user when components of website are loading.

Preview of Project:





Now let's proceed towards development of the project. You can open the project in codepen also.


HTML (index.html):



 
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
<!DOCTYPE html>
<html lang="en" >
<head>
  <meta charset="UTF-8">
  <title>CodePen - Color Map Dot Loader</title>
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css">
<link rel="stylesheet" href="./style.css">

</head>
<body>
<!-- partial:index.partial.html -->
<div class="loader">
  <div class="dot"></div>
  <div class="dot"></div>
  <div class="dot"></div>
</div>
<!-- partial -->
  
</body>
</html>


CSS (style.css):




  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
* {
  box-sizing: border-box;
}

body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #ecf0f1;
}

.loader {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: -90px;
  margin: auto;
  transform: translate3d(0, 0, 0);
}

.dot {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  margin: auto;
  width: 18px;
  height: 18px;
  border-radius: 100%;
}
.dot:nth-child(1) {
  background-color: #f44336;
  -webkit-animation: jump--1 0.666s linear infinite;
          animation: jump--1 0.666s linear infinite;
  box-shadow: rgba(255, 255, 255, 0.6) 0 0 2px 2px, #f44336 0 0 12px 0;
}
.dot:nth-child(2) {
  background-color: #f1c40f;
  -webkit-animation: jump--2 0.666s linear infinite;
          animation: jump--2 0.666s linear infinite;
  box-shadow: rgba(255, 255, 255, 0.6) 0 0 2px 2px, #f1c40f 0 0 12px 0;
}
.dot:nth-child(3) {
  background-color: #03A9F4;
  -webkit-animation: jump--3 0.666s linear infinite;
          animation: jump--3 0.666s linear infinite;
  box-shadow: rgba(255, 255, 255, 0.6) 0 0 2px 2px, #03A9F4 0 0 12px 0;
}

@-webkit-keyframes jump--1 {
  0% {
    transform: translate3d(0, 0, 0) scale(2);
  }
  12.5% {
    transform: translate3d(41.6666666667%, -142.8571428571%, 0);
  }
  25% {
    transform: translate3d(250%, -250%, 0);
  }
  37.5% {
    transform: translate3d(500%, 250%, 0);
  }
  50% {
    transform: translate3d(500%, 0, 0);
  }
  100% {
    transform: translate3d(0, 0, 0) scale(2);
  }
}

@keyframes jump--1 {
  0% {
    transform: translate3d(0, 0, 0) scale(2);
  }
  12.5% {
    transform: translate3d(41.6666666667%, -142.8571428571%, 0);
  }
  25% {
    transform: translate3d(250%, -250%, 0);
  }
  37.5% {
    transform: translate3d(500%, 250%, 0);
  }
  50% {
    transform: translate3d(500%, 0, 0);
  }
  100% {
    transform: translate3d(0, 0, 0) scale(2);
  }
}
@-webkit-keyframes jump--2 {
  0% {
    transform: translate3d(250%, 0, 0);
  }
  25% {
    transform: translate3d(0, 0, 0) scale(2);
  }
  37.5% {
    transform: translate3d(41.6666666667%, -142.8571428571%, 0);
  }
  50% {
    transform: translate3d(250%, -250%, 0);
  }
  62.5% {
    transform: translate3d(500%, 250%, 0);
  }
  75% {
    transform: translate3d(500%, 0, 0);
  }
  100% {
    transform: translate3d(250%, 0, 0);
  }
}
@keyframes jump--2 {
  0% {
    transform: translate3d(250%, 0, 0);
  }
  25% {
    transform: translate3d(0, 0, 0) scale(2);
  }
  37.5% {
    transform: translate3d(41.6666666667%, -142.8571428571%, 0);
  }
  50% {
    transform: translate3d(250%, -250%, 0);
  }
  62.5% {
    transform: translate3d(500%, 250%, 0);
  }
  75% {
    transform: translate3d(500%, 0, 0);
  }
  100% {
    transform: translate3d(250%, 0, 0);
  }
}
@-webkit-keyframes jump--3 {
  0% {
    transform: translate3d(500%, 0, 0);
  }
  50% {
    transform: translate3d(0, 0, 0) scale(2);
  }
  62.5% {
    transform: translate3d(41.6666666667%, -142.8571428571%, 0);
  }
  75% {
    transform: translate3d(250%, -250%, 0);
  }
  87.5% {
    transform: translate3d(500%, 250%, 0);
  }
  100% {
    transform: translate3d(500%, 0, 0);
  }
}
@keyframes jump--3 {
  0% {
    transform: translate3d(500%, 0, 0);
  }
  50% {
    transform: translate3d(0, 0, 0) scale(2);
  }
  62.5% {
    transform: translate3d(41.6666666667%, -142.8571428571%, 0);
  }
  75% {
    transform: translate3d(250%, -250%, 0);
  }
  87.5% {
    transform: translate3d(500%, 250%, 0);
  }
  100% {
    transform: translate3d(500%, 0, 0);
  }
}



License:

___________________________________________________________________________

Copyright (c) 2022 by Aaditya1612 (https://codepen.io/aaditya1612/pen/LYeqNPa)
Fork of an original work Color Map Dot Loader (https://codepen.io/hexagoncircle/pen/eZawWv

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

___________________________________________________________________________

Labels : #css ,#frontend ,#html ,#web dev ,

Post a Comment