# 闪烁效果

<style>
.demo-blink {
  width: 100%;
  height: 300px;
  position: relative;
  transform: scale(0.5);
  transform-origin: 30% -100px;
}
.demo-blink .dengpao {
    position: absolute;
    top: 300px;
    left: 300px;
}
.demo-blink .guang {
    position: absolute;
    top: 235px;
    left: 222px;
    animation: ss 1s ease 0s infinite alternate;
}

@keyframes ss {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

.demo-blink .huojian {
    position: absolute;
    top: 300px;
    left: 800px;
    animation: blinkzd .4s linear 0s infinite alternate;
}

@keyframes blinkzd {
    from {
        transform: translateX(-20px) translateY(-20px);
    }
    to {
        transform: translateX(20px) translateY(20px);
    }
}

.demo-blink .line1 {
    width: 2px;
    height: 166px;
    background-color: blue;
    position: absolute;
    top: 300px;
    left: 800px;
    transform: rotate(45deg);
    animation: blikyd 1s linear 0s infinite;
    opacity: 0;
}
.demo-blink .line2 {
    width: 2px;
    height: 266px;
    background-color: blue;
    position: absolute;
    top: 340px;
    left: 850px;
    transform: rotate(45deg);
    animation: blikyd 1s linear .4s infinite;
    opacity: 0;
}
.demo-blink .line3 {
    width: 2px;
    height: 266px;
    background-color: blue;
    position: absolute;
    top: 390px;
    left: 890px;
    transform: rotate(45deg);
    animation: blikyd 1s linear .68s infinite;
    opacity: 0;
}
.demo-blink .line4 {
    width: 2px;
    height: 266px;
    background-color: blue;
    position: absolute;
    top: 390px;
    left: 920px;
    transform: rotate(45deg);
    animation: blikyd 1s linear .2s infinite;
    opacity: 0;
}
@keyframes blikyd {
    0% {
        transform: rotate(45deg) translateY(-300px);
        opacity: 0;
    }
    50% {
        opacity: 1;
    }
    100% {
        transform: rotate(45deg) translateY(300px);
        opacity: 0;
    }
}
</style>
<template>
  <div class="demo-blink">
    <img class="dengpao" src="https://cdn-static.learntech.cn/notes/20211107/0002-dengpao.png!min" alt="img">
    <img class="guang" src="https://cdn-static.learntech.cn/notes/20211107/0002-guang.png!min" alt="img">

    <img class="huojian" src="https://cdn-static.learntech.cn/notes/20211107/0002-huojian.png!min" alt="img">
    <div class="line1"></div>
    <div class="line2"></div>
    <div class="line3"></div>
    <div class="line4"></div>
  </div>
</template>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
显示代码 复制代码
<style>
  .main-blink {
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
  }
  .main-blink p, .main-blink span {
    width: 388px;
    padding: 3px 10px;
    border-radius: 5px;
    font-size: 14px;
  }
  .main-blink .one {
    background-color: #f4f4f5;
    color: #909399;
    animation: 1s blink-normal infinite step-end;
  }
  .main-blink .two {
    background-color: #fdf6ec;
    color: #e6a23c;
    animation: .5s blink-alternate infinite;
    animation-direction: alternate;
  }
  .main-blink .three {
    background: #fef0f0;
    color: #f56c6c;
    animation: .5s blink-alternate infinite;
    animation-direction: alternate-reverse;
  }
  @keyframes blink-normal {
    50% {
      color: transparent;
    }
  }
  @keyframes blink-alternate {
    to {
      color: transparent;
    }
  }
</style>
<template>
  <div class="main-blink">
    <span>animation-direction: default
    <code>normal</code></span><p class="one">info~</p>
    <span>animation-direction: Reverse
    <code>alternate</code></span><p class="two">warning~ warning~</p>
    <span>animation-direction: Reverse alternating
    <code>alternate-reverse</code></span><p class="three">error~ error~ error~</p>
  </div>
</template>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
显示代码 复制代码

一切的过度皆应该由动画来完成

上次更新: 2023-10-28