Pure css and flutter realize the breathing light effect respectively

Last time, a very eager fan asked if the moon could be made as a breathing light effect, because the moon-sized picture was not found, so I used stars instead.
Today, this blogger uses pure css and flutter animations to achieve it, remember to collect and learn Oh
effect: I
Insert picture description here
want to test, the original picture is at the end of the article

Realization principle:
prepare two pictures and let the two pictures alternately appear.

The first, 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="底图" class="img1">
    <img src="images/star2.jpg" alt="上图" class="img2">
</div>

</body>
</html>

The second one is implemented with flutter, the code is as follows:

还在想

Insert picture description here
Insert picture description here

Guess you like

Origin blog.csdn.net/weixin_45425105/article/details/113938931