Pure CSS and Flutter realize breathing light effect respectively (example code)

Pure CSS and Flutter realize breathing light effect respectively (example code)

Last time, a very studious fan asked if it was possible to make the moon a breathing light effect. Because I couldn't find a picture the size of the moon, I used stars instead. Today, this blogger used pure CSS and Flutter animation to implement it respectively. Remember to collect and learn
Effect:

insert image description here

If you want to test it, the original picture is at the end of the article

Implementation principle:
Prepare two pictures and let them appear alternately.

Pure CSS implementation, the code is as follows:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title></title>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        .wrap{
            width: 300px;
            height: 300px;
            position: relative;
            margin: 0 auto;
            overflow: hidden;
        }
        .img1,
        .img2{
            margin-top: 100px;
            width: 100px;
            position: absolute;
        }
        .img2{
            -webkit-animation: breath 3s infinite ease-in-out alternate;
            animation: breath 3s infinite ease-in-out alternate;
        }
        @-webkit-keyframes breath {
            0% {opacity: .2;}60% {opacity: 1;}to {opacity: .2;}
        }
        @keyframes breath {
            0% {opacity: .2;}60% {opacity: 1;}to {opacity: .2;}
        }
    </style>
</head>
<body>
<div class="wrap">
    <img src="images/star1.jpg" alt="Basemap" class="img1">
    <img src="images/star2.jpg" alt="Above" class="img2">
</div>

</body>
</html> 

insert image description here
insert image description here

This is the end of this article about how to achieve breathing light effects with pure CSS and Flutter (example code). For more information about how to achieve breathing light with CSS, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future!

<<:  Comprehensive understanding of HTML basic structure

>>:  Detailed explanation of Linux command unzip

Recommend

Introduction to the use of select optgroup tag in html

Occasionally, I need to group select contents. In ...

Use of Linux ifconfig command

1. Command Introduction The ifconfig (configure a...

mysql 5.7.17 winx64.zip installation and configuration method graphic tutorial

Preface: I reinstalled win10 and organized the fi...

CocosCreator classic entry project flappybird

Table of contents Development Environment Game en...

What is WML?

WML (Wireless Markup Language). It is a markup la...

Docker Compose practice and summary

Docker Compose can realize the orchestration of D...

Coexistence of python2 and python3 under centos7 system

The first step is to check the version number and...

HTML page jump passing parameter problem

The effect is as follows: a page After clicking t...

jQuery implements accordion small case

This article shares the specific code of jQuery t...

vue cli3 implements the steps of packaging by environment

The vue project built with cli3 is known as a zer...