Table of Contents
CSS animation
grammar
CSS Box-shadow Property
Example
The box-shadow property
Create call animation effects
The Chinese translation of Example
in conclusion
Home Web Front-end CSS Tutorial How to create a call animation effect using CSS?

How to create a call animation effect using CSS?

Sep 02, 2023 pm 04:01 PM

How to create a call animation effect using CSS?

Cascading Style Sheets (CSS) Enables developers to create visual effects for your web pages, making them attractive and user-friendly. CSS provides various properties such as colors, flexbox, grid, animations, shadows, etc. to style elements to form a website that is attractive and user-friendly to many users.

In this article, we discussed how to design animatronic effects using HTML and CSS. To create this effect, we will use CSS animation properties and the box-shadow property.

CSS animation

It enables developers to add animation effects, such as movement, vibration, etc., to our web pages to increase aesthetic value.

grammar

animation: animation-name | animation-duration | speed; 
Copy after login

CSS Box-shadow Property

It enables developers to provide dark shades on one side and light shades on the other side.

grammar

box-shadow: values;
Copy after login

The value of this attribute is -

  • None - No shadow is displayed on the element. It's the default value.

  • Offset-X − The distance of the shadow from the element in the horizontal direction. Positive values ​​for offset-X will cast a shadow on the right side of the element, while negative values ​​will cast a shadow on the left side of the element.

  • Offset-Y − Controls the vertical distance of the shadow from the element. Positive values ​​place the shadow above the element, negative values ​​place the shadow below the element.

  • Blur Radius - It specifies the sharpness of the shadow. The higher the number, the blurrier the shadow, meaning it will be larger and brighter

  • Spread- radius - It specifies the size of the shadow. If its value is positive, the size increases. If negative, the size is reduced.

  • Color - It specifies the color of the shadow.

  • Inset − It enables developers to create shadows so that the content of an element appears to be below the border. Therefore, a shadow is created within the border.

The Chinese translation of

Example

is:

Example

<!DOCTYPE html>
<html>
<head>
   <style>
      #demo {
         border: 5px solid;
         padding: 10px 15px;
         box-shadow: -5px -10px 0px 5px yellow;
      }
   </style>
</head>
<body>
   <h1 id="The-box-shadow-property">The box-shadow property</h1>
   <article id="demo">
      <p>This is an article element with a shadow. It contains four values that are offset-X (horizontal distance), offset-Y (vertical distance), spread radius and color. </p>
   </article>
</body>
</html>
Copy after login

Create call animation effects

In the example below, we try to display a phone ring icon using CSS Font Awesome icons.

Then, we have used the box-shadow property and CSS animations to create the ringing effect. In order to control the sequence of animation, we have used @keyframes

The Chinese translation of Example

is :

Example

<!DOCTYPE html>
<html>
<head>
   <title>Incoming Call Animation</title>
   <link rel="stylesheet" href= "https://pro.fontawesome.com/releases/v5.10.0/css/all.css">
   <style>
      body{
         height: 80%;
         margin: 10px;
         padding: 0;
         display: flex;
         align-items: center;
         justify-content: center;
         background: black;
      }
      section{
         position: absolute;
         top: 10%;
         display: flex;
         justify-content: center;
         align-items: center;
         border: 2px solid orange;
         height: 65%;
         width: 40%;
      }
      .call{
         position: relative;
         background: black;
         color: orange;
         font-size: 35px;
         font-weight: bold;
         width: 70px;
         height: 70px;
         border-radius: 100%;
         border: solid 5px black;
         animation: anim 2s ease-in infinite, vibration 2s ease-in infinite;
      }
      .img{
         position: absolute;
         top: 20px;
         left: 20px;
         height: 60px;
         width: 50px;
      }
      @keyframes anim {
         0% {
            box-shadow: 0 1px 0 4px #ffffff;
         }
         10%{
            box-shadow: 0 1px 0 8px rgba(255, 165, 0, 1);
         }
         25% {
            box-shadow: 0 1px 0 12px rgba(255, 210, 128, 1), 0 1px 0 16px rgba(255, 201, 102, 1);
         }
         50% {
            box-shadow: 0 2px 5px 10px rgba(255, 184, 51, 1),  0 2px 5px 23px rgba(248, 248, 255, 1);
         }
      }
      @keyframes vibration {
         0% { transform: rotate(0deg); }
         25% { transform: rotate(20deg); }
         50% { transform: rotate(0deg); }
         75% { transform: rotate(-15deg); }
         100% { transform: rotate(0deg); }
      }
   </style>
</head>
<body>
   <section>
      <div class= "call">
         <i class= "fas fa-solid fa-phone img"> </i>
      </div>
   </section>
</body>
</html>
Copy after login

The incoming call icon will be displayed on the web page and the ringing effect will be observed by the animation effect.

in conclusion

Customers in the modern technology market require more website participation. At this point, animation plays a vital role in improving communication. The interactive nature of animation encourages user interaction and improves user experience. If you want your website to stand out from the competition and be loved by your target audience at the same time, then hiring a top website development company to add animations to your website will be helpful.

The above is the detailed content of How to create a call animation effect using CSS?. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
Two Point Museum: All Exhibits And Where To Find Them
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Demystifying Screen Readers: Accessible Forms & Best Practices Demystifying Screen Readers: Accessible Forms & Best Practices Mar 08, 2025 am 09:45 AM

This is the 3rd post in a small series we did on form accessibility. If you missed the second post, check out "Managing User Focus with :focus-visible". In

Create a JavaScript Contact Form With the Smart Forms Framework Create a JavaScript Contact Form With the Smart Forms Framework Mar 07, 2025 am 11:33 AM

This tutorial demonstrates creating professional-looking JavaScript forms using the Smart Forms framework (note: no longer available). While the framework itself is unavailable, the principles and techniques remain relevant for other form builders.

Adding Box Shadows to WordPress Blocks and Elements Adding Box Shadows to WordPress Blocks and Elements Mar 09, 2025 pm 12:53 PM

The CSS box-shadow and outline properties gained theme.json support in WordPress 6.1. Let&#039;s look at a few examples of how it works in real themes, and what options we have to apply these styles to WordPress blocks and elements.

Working With GraphQL Caching Working With GraphQL Caching Mar 19, 2025 am 09:36 AM

If you’ve recently started working with GraphQL, or reviewed its pros and cons, you’ve no doubt heard things like “GraphQL doesn’t support caching” or

Making Your First Custom Svelte Transition Making Your First Custom Svelte Transition Mar 15, 2025 am 11:08 AM

The Svelte transition API provides a way to animate components when they enter or leave the document, including custom Svelte transitions.

Show, Don't Tell Show, Don't Tell Mar 16, 2025 am 11:49 AM

How much time do you spend designing the content presentation for your websites? When you write a new blog post or create a new page, are you thinking about

Classy and Cool Custom CSS Scrollbars: A Showcase Classy and Cool Custom CSS Scrollbars: A Showcase Mar 10, 2025 am 11:37 AM

In this article we will be diving into the world of scrollbars. I know, it doesn’t sound too glamorous, but trust me, a well-designed page goes hand-in-hand

What the Heck Are npm Commands? What the Heck Are npm Commands? Mar 15, 2025 am 11:36 AM

npm commands run various tasks for you, either as a one-off or a continuously running process for things like starting a server or compiling code.

See all articles