html庆祝六一烟花和字音效
时间: 2024-06-01 19:06:28 浏览: 165
HTML庆祝六一烟花和字音效可以通过CSS3动画来实现,以下是一个示例代码:
```
<!DOCTYPE html>
<html>
<head>
<style>
.textfx {
animation-name: celebratetext;
animation-duration: 3s;
animation-iteration-count: infinite;
}
@keyframes celebratetext {
0% {
color: #FFA07A;
text-shadow: 0 0 10px #FFA07A, 0 0 20px #FFA07A, 0 0 30px #FFA07A, 0 0 40px #FFA07A, 0 0 50px #FFA07A, 0 0 60px #FFA07A;
}
25% {
color: #FF4500;
text-shadow: 0 0 10px #FF4500, 0 0 20px #FF4500, 0 0 30px #FF4500, 0 0 40px #FF4500, 0 0 50px #FF4500, 0 0 60px #FF4500;
transform: rotateY(360deg);
transform-style: preserve-3d;
}
50% {
color: #FFD700;
text-shadow: 0 0 10px #FFD700, 0 0 20px #FFD700, 0 0 30px #FFD700, 0 0 40px #FFD700, 0 0 50px #FFD700, 0 0 60px #FFD700;
transform: rotateX(360deg);
transform-style: preserve-3d;
text-stroke: 1px #FFD700;
-webkit-text-stroke-width:1px;
-webkit-text-stroke-color:#000000;
animation-name: celebratetextshadow;
animation-duration: .5s;
animation-iteration-count: infinite;
animation-direction: alternate-reverse;
animation-timing-function: ease-in-out;
animation-fill-mode: forwards;
box-shadow: inset -10px -10px rgba(255,255,255,.5), inset -15px -15px rgba(255,255,255,.2), inset -5px -5px rgba(255,255,255,.2), inset -5px -5px rgba(255,255,255,.5),
inset -2px -2px rgba(255,255,255,.2), inset -2px -2px rgba(255,255,255,.5), inset -2px -2px rgba(255,255,255,.5), inset -2px -2px rgba(255,255,255,.2);
text-shadow: none;
outline: none;
background-image: radial-gradient(#FFE400,#FD8D00);
border-radius: .5em;
font-size: x-large;
filter: drop-shadow(-1px -1px #FBFBFB) drop-shadow(1px -1px #FBFBFB) drop-shadow(-1px 1px #FBFBFB) drop-shadow(1px 1px #FBFBFB);
transition: all .25s ease-in-out;
cursor: pointer;
user-select:none;
animation-name: celebratetextshadow;
animation-duration: .5s;
animation-iteration-count: infinite;
animation-direction: alternate-reverse;
animation-timing-function: ease-in-out;
animation-fill-mode: forwards;
box-shadow: inset -10px -10px rgba(255,255,255,.5), inset -15px -15px rgba(255,255,255,.2), inset -5px -5px rgba(255,255,255,.2), inset -5px -5px rgba(255,255,255,.5),
inset -2px -2px rgba(255,255,255,.2), inset -2px -2px rgba(255,255,255,.5), inset -2px -2px rgba(255,255,255,.5), inset -2px -2px rgba(255,255,255,.2);
text-shadow: none;
outline: none;
background-image: radial-gradient(#FFE400,#FD8D00);
border-radius: .5em;
font-1px 1px #FBFBFB) drop-shadow(1px 1px #FBFBFB);
transition: all .25s ease-in-out;
cursor: pointer;
user-select:none;
animation-name: celebratetextshadow;
animation-duration: .5s;
animation-iteration-count: infinite;
animation-direction: alternate-reverse;
animation-timing-function: ease-in-out;
animation-fill-mode: forwards;
box-shadow: inset -10px -10px rgba(255,255,255,.5), inset -15px -15px rgba(255,255,255,.2), inset -5px -5px rgba(255,255,255,.2), inset -5px -5px rgba(255,255,255,.5),
inset -2px -2px rgba(255,255,255,.2), inset -2px -2px rgba(255,255,255,.5), inset -2px -2px rgba(255,255,255,.5), inset -2px -2px rgba(255,255,255,.2);
text-shadow: none;
outline: none;
background-image: radial-gradient(#FFE400,#FD8D00);
border-radius: .5em;
font-size: x-large;
filter: drop-shadow(-1px -1px #FBFBFB) drop-shadow(1px -1px #FBFBFB) drop-shadow(-1px 1px #FBFBFB) drop-shadow(1px 1px #FBFBFB);
transition: all .25s ease-in-out;
cursor: pointer;
user-select:none;
}
.firework {
width :10em;height :10em;border-radius :50%;background :#fff;box-shadow :inset-3em-3em-4em-#ddd,inset3em3em4em-#ccc;position:absolute;left :50%;top :50%;animation-name :explode;animation-duration :.4s;animation-delay :.7s;animation-timing-function :ease-out}
@keyframes explode{to{opacity :0;transform :scale3d(15,15,15)}}
.firework:before,
.firework:after {
content :'';
width :3em;height :3em;border-radius :50%;position:absolute}
.firework:before{background:#f00;left:-4em;top:-4em}
.firework:before:hover {animation-name :explode;animation-duration :.8s;animation-timing-function :ease-out}
.firework:before:focus {outline:none}
.firework:before{background:#f00;left:-4em;top:-4em}
.firework:before:hover {animation-name :explode;animation-duration :.8s;animation-timing-function :ease-out}
.firework:before:focus {outline:none}
.firework2 {
width :10em;height :10em;border-radius :50%;background :#fff;box-shadow :inset-3em-3em-4em-#ddd,inset3em3em4em-#ccc;position:absolute;left :50%;top :50%;animation-name :explode;animation-duration :.4s;animation-delay :.7s;animation-timing-function :ease-out}
@keyframes explode{to{opacity :0;transform :scale3d(15,15,15)}}
.firework2:before,
.firework2:after {
content :'';
width :3em;height :3em;border-radius :50%;position:absolute}
.firework2:before{background:#f00;left:-4em;top:-4em}
.firework2:before:hover {animation-name :explode;animation-duration :.8s;animation-timing-function :ease-out}
.firework2:before:focus {outline:none}
.firework2:before{background:#f00;left:-4em;top:-4em}
.firework2:before:hover {animation-name :explode;animation-duration :.8s;animation-timing-function :ease-out}
.firework2:before:focus {outline:none}
</style>
</head>
<body>
<h1 class="textfx">六一快乐!</h1>
<div class="firework"></div>
<div class="firework"></div>
<div class="firework"></div>
<div class="firework"></div>
<div class="firework"></div>
<div class="firework2"></div>
<div class="firework2"></div>
<div class="firework2"></div>
<div class="firework2"></div>
<div class="firework2"></div>
</body>
</html>
```
该代码实现了一个文本特效和两种不同的烟花效果。您可以将代码复制到HTML文件中并在浏览器中查看效果。
相关问题:
1. 如何使用CSS3实现动画效果?
2. 如何在HTML中添加特效?
3. 如何使用CSS3制作烟花效果?
阅读全文