3 Creating a responsive animated loading screen

 

This chapter covers

  • Creating basic shapes using Scalable Vector Graphics (SVGs)
  • Finding out the difference between viewboxes and viewports in SVGs
  • Understanding keyframes and animating SVGs
  • Using animation properties
  • Styling SVGs with CSS
  • Styling an HTML progress bar element with appearance properties

We see loaders in most applications today. These loaders communicate to the user that something is loading, uploading, or waiting. They give the user confidence that something is happening.

Without some sort of indicator to tell the user that something is happening, they may try reloading, click the link again, or give up and leave. We should be using some sort of progress indicator when an action takes longer than 1 second, which is when users tend to lose focus and question whether there’s a problem. As well as having a graphic showing that something is happening, the loader should be accompanied by text that tells the user what is happening to improve the accessibility of the web page for screen readers and other assistive technologies.

For our animation, we’ll be looking into the CSS Animation Module, understanding the animation property, keyframes, and transitions, as well as accessibility and respect for user preferences.

3.1 Setup

In this project, we’ll be creating rectangles within an SVG. We’ll see what SVGs offer and understand the slight differences between styling HTML elements and SVG elements.

3.2 SVG basics

 
 

3.2.1 Positions of SVG elements

 

3.2.2 Viewport

 
 
 
 

3.2.3 Viewbox

 

3.2.4 Shapes in SVG

 
 

3.3 Applying styles to SVGs

 
 
 

3.4 Animating elements in CSS

 
 
 

3.4.1 Keyframe and animation-name

 
 
 

3.4.2 The duration property

 

3.4.3 The iteration-count property

 
 

3.4.4 The animation shorthand property

 
 
sitemap

Unable to load book!

The book could not be loaded.

(try again in a couple of minutes)

manning.com homepage