推荐一个js+canvas的烟花特效,快快分享朋友一起学起来~

2018-09-18  本文已影响52人  hojun

废话不多说,先看下效果:


image

直接上代码:

<style type="text/css">
  .fireworks {
      position: absolute;
      top: 0;
      left: 0;
      widows: 100%;
      height: 100%;
  }
</style>
<canvas class="fireworks"></canvas>
<script src="./anime.min.js"></script>
<script src="./fireworks.js"></script>
<script type="text/javascript">
  fireworks.setCanvasSize();
</script>

{% raw %}
<style type="text/css">
.fireworks {
position: fixed;
top: 0;
left: 0;
widows: 100%;
height: 100%;
}
</style>
<canvas class="fireworks"></canvas>
<script src="/js/anime.min.js"></script>
<script src="/js/fireworks.js"></script>
<script type="text/javascript">
fireworks.setCanvasSize();
</script>
{% endraw %}
anime.min.js和fireworks.js都可以去anime官网上找到。或者关注公众号回复demo007获取@(献黄瓜)

上一篇 下一篇

猜你喜欢

热点阅读