爆炸的动画特效含倒计时

这段代码展示了如何使用jQuery创建一个包含倒计时的爆炸动画特效。点击按钮后,内容区域将隐藏并开始倒计时,从3秒开始递减,当倒计时结束时,内容中的某部分元素(如图片)会显示出来,营造出爆炸效果。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

<style>
.content{
width: 500px;
margin:0 auto;
}


.content .img1{
animation: zhazha 1s infinite;
}


.content .img2 {
animation: boom 1s 1;
}


@keyframes zhazha{
from{
                transform: scale(0.8);
}to{
                transform: scale(1.1);
}
}


@keyframes boom{
from{
                transform: scale(0);
}to{
   transform: scale(1);
  }
}


</style>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/boom.js"></script>
</head>
<body>
<input type="button" class="btn" value="炸了炸了" />
<div class="content">
<p class="boom"></p>
    <img class="img1" src="img/boom.jpg"/>
    <img class="img2" src="img/booms.jpg"/>

</div> 


<script>

$(function(){


$(".content").hide();


$(".btn").click(function(){
var time=3;


var set=setInterval(function(){
if(time>0){
$(".boom").text(time-- +"s");
$(".content").show();
$(".content .img2").hide();
}else{
$(".content .img1,p").hide();
$(".content .img2").show();
}
},1000);
})
})


</script>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值