您现在的位置是:网站首页 > JavaScript>漂亮的动态气泡背景效果bubbly-bg.js
漂亮的动态气泡背景效果bubbly-bg.js
- JavaScript
- 2019-03-28
- 413人已阅读
简介bubbly-bg.js是一款漂亮的动态气泡背景js插件。它是基于HTML5 canvas,压缩后的版本小于1kb,但是它能制作出各种漂亮的动态气泡背景效果,非常强大。
1、引入 bubbly-bg.js 插件
<script src="js/bubbly-bg.js"></script>
2、配置参数
bubbly({
animate: false, // default is true
blur: 1, // default is 4
bubbleFunc: () => `hsla(${Math.random() * 360}, 100%, 50%, ${Math.random() * 0.25})`, // default is () => `hsla(0, 0%, 100%, ${r() * 0.1})`)
bubbles: 100, // default is Math.floor((canvas.width + canvas.height) * 0.02);
canvas: document.querySelector("#background"), // default is created and attached
colorStart: "#4c004c", // default is blue-ish
colorStop: "#1a001a",// default is blue-ish
compose: "lighter", // default is "lighter"
shadowColor: "#0ff", // default is #fff
});
示例,黄色/粉色带红色/橙色/黄色气泡效果:
bubbly({
colorStart: "#fff4e6",
colorStop: "#ffe9e4",
blur: 1,
compose: "source-over",
bubbleFunc: () => `hsla(${Math.random() * 50}, 100%, 50%, .3)`
});
该项目github地址:https://github.com/tipsy/bubbly-bg
版权声明:本文为博主原创文章,欢迎大家转载。 https://itxwzj.com/technology/17/beautiful-dynamic-bubble-background-effect-bubbly-bgjs
上一篇:GitLab安装配置
最新评论
站长大王来回复你了,长点心吧!