微信视频号点赞动画CSS3实现
【摘要】
大家好!今天分享一个动画,起初实在微信刷视频号时看到的,之前还没有,第一眼我就爱了,动画设计很大胆,于是我就使用CSS3的动画浅浅防了一下,看效果😎
html
<!DOCTYPE html&...
大家好!今天分享一个动画,起初实在微信刷视频号时看到的,之前还没有,第一眼我就爱了,动画设计很大胆,于是我就使用CSS3的动画浅浅防了一下,看效果😎
html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>点赞动画</title>
<link rel="stylesheet" href="./index.css">
</head>
<body>
<div class="contianer">
<video src="./你的名字.mp4" autoplay muted loop>
你的浏览器不支持哦
</video>
<svg onclick="fabulous()" t="1652849998021" class="love" viewBox="0 0 1024 1024" version="1.1"
xmlns="http://www.w3.org/2000/svg" p-id="1958">
<path
d="M32 407.584a279.584 279.584 0 0 1 480-194.944 279.584 279.584 0 0 1 480 194.944 278.144 278.144 0 0 1-113.024 224.512L562.592 892.8a96 96 0 0 1-124.416-1.952l-308.16-270.688A278.976 278.976 0 0 1 32 407.584z"
p-id="1959"></path>
</svg>
<svg onclick="fabulous()" t="1652849998021" class="love1" viewBox="0 0 1024 1024" version="1.1"
xmlns="http://www.w3.org/2000/svg" p-id="1958">
<path
d="M32 407.584a279.584 279.584 0 0 1 480-194.944 279.584 279.584 0 0 1 480 194.944 278.144 278.144 0 0 1-113.024 224.512L562.592 892.8a96 96 0 0 1-124.416-1.952l-308.16-270.688A278.976 278.976 0 0 1 32 407.584z"
p-id="1959"></path>
</svg>
<img src="./tou.jpg" alt="">
<span>周棋洛♥</span>
<p>世间最美的文字 就是你的名字</p>
</div>
<script>
let love = document.querySelector(".love");
let img = document.querySelector("img");
let span = document.querySelector("span");
let love1 = document.querySelector(".love1");
let flag = 1;
function fabulous() {
if (flag == 1) {
love.style.fill = "red";
love.style.stroke = "red";
img.style.animation = "touflash linear .5s forwards";
span.style.animation = "ziflash ease-in .5s forwards";
love1.style.animation = "love1 1.3s";
flag = 0;
} else {
love.style.fill = "transparent";
love.style.stroke = "#FFF";
flag = 1;
img.style.animation = "";
span.style.animation = "";
love1.style.animation = "";
}
}
</script>
</body>
</html>
- 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
css
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
background-color: #000;
}
.contianer {
display: flex;
align-items: center;
justify-content: center;
min-height: 100vh;
}
video {
width: 40vw;
}
.love {
position: absolute;
width: 30px;
height: 30px;
fill: transparent;
stroke: rgb(180, 180, 180);
stroke-width: 30px;
bottom: 130px;
right: 500px;
cursor: pointer;
}
.love1 {
position: absolute;
width: 80px;
height: 80px;
fill: transparent;
}
img {
position: absolute;
bottom: 130px;
right: 500px;
width: 0px;
height: 0px;
user-select: none;
border-radius: 5px;
}
span {
color: rgb(242, 242, 242);
position: absolute;
left: 521px;
top: 455px;
font-weight: bold;
user-select: none;
opacity: 0;
}
p {
position: absolute;
color: rgb(176, 176, 176);
left: 458px;
top: 550px;
letter-spacing: .3em;
}
@keyframes touflash {
0% {
transform: translate(0px, 0px);
}
30% {
transform: translate(-156px, -90px);
}
50% {
transform: translate(-270px, -125px);
width: 38px;
height: 38px;
}
85% {
transform: translate(-450px, -140px);
}
90% {
transform: translate(-480px, -135px);
width: 40px;
height: 40px;
}
100% {
transform: translate(-520px, -100px);
width: 40px;
height: 40px;
}
}
@keyframes ziflash {
0% {
opacity: 0;
}
80% {
opacity: .1;
}
100% {
opacity: 1;
}
}
@keyframes love1 {
0% {
width: 0px;
height: 0px;
opacity: .4;
}
25% {
width: 90px;
height: 90px;
fill: rgb(148, 0, 0);
}
50% {
width: 80px;
height: 80px;
fill: rgb(148, 0, 0);
opacity: 1;
}
60% {
fill: rgb(148, 0, 0);
opacity: .5;
}
100% {
opacity: 1;
width: 80px;
height: 80px;
}
}
- 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
- 116
- 117
- 118
- 119
- 120
- 121
- 122
- 123
- 124
- 125
- 126
- 127
- 128
- 129
- 130
- 131
- 132
- 133
- 134
- 135
- 136
- 137
- 138
- 139
- 140
- 141
- 142
- 143
- 144
- 145
文章来源: blog.csdn.net,作者:周棋洛ყ ᥱ ᥉,版权归原作者所有,如需转载,请联系作者。
原文链接:blog.csdn.net/m0_53321320/article/details/124873037
【版权声明】本文为华为云社区用户转载文章,如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱:
cloudbbs@huaweicloud.com
- 点赞
- 收藏
- 关注作者
评论(0)