DEV Community

Pavol Ďuďák
Pavol Ďuďák

Posted on

26 4

Simple CSS animated loading icon

Hello!
I've recently got my first real programming job as a junior programmer and I'm still learning various thing along the way. Also, some time ago I have started thinking about writing some blog post to this site so here is my first attempt :)

For my first post, I've wanted to write about something simple so there is less space for me to make mistake :) so I've made a simple animated loading icon with CSS.

Here is codepen:

The animation is based on keyframes as you can see.
Basically,I'm just scaling and rotating html element and infinitely looping animation with alternating direction with means that keyframe animation is played forwards and then backward with ease-in-out timing function that sets the speed of the animation. The ease-in-out timing function plays animation starting and ending slowly. For example, if I've used ease-in function the animation will start slowly.

Any feedback positive or negative is highly appreciated! :) I'm looking forward to write about more stuff I've learned (including Spring, React and maybe Angular)

Thank you for reading :)

SurveyJS custom survey software

JavaScript UI Libraries for Surveys and Forms

SurveyJS lets you build a JSON-based form management system that integrates with any backend, giving you full control over your data and no user limits. Includes support for custom question types, skip logic, integrated CCS editor, PDF export, real-time analytics & more.

Learn more

Top comments (4)

Collapse
 
alexparra profile image
Alex Parra

Hi Pavol!
Nice work.

Have you noticed these types of animations freeze when the browser gets busy on some http request? I’ve seen it with animated SVGs and the only way I got over it was with a GIF instead.
If anyone has faces this and has a better solution than an GIF I’d like to know.
Best

Collapse
 
dudakp profile image
Pavol Ďuďák

Thank you, Alex :) I didn't experience any issues with animation freezing when I make Http request, but when I tested this I tested it with a simple GET request to jsonplaceholder.typicode.com. I will look out for this in the future. Have a nice day :)

Collapse
 
nilo profile image
Nick

very cool

Collapse
 
duythoai profile image
Trần Duy Thoại

thanks ! i really like it !

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more