js实现鼠标跟随五颜六色泡泡canvas动画效果代码

代码语言:html

所属分类:粒子

代码描述:js实现鼠标跟随五颜六色泡泡canvas动画效果代码

代码标签: 跟随 五颜六色 泡泡 canvas 动画 效果

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

</head>

<body style="background:#000;overflow:hidden;">
    <div id="container">
     
    </div>
    <script type="text/javascript" >
        var Sketch = function() {
    function e(e) {
        e = n(e || {}, l);
        var t = "sketch-" + r++
          , o = e.hasOwnProperty("canvas")
          , u = o ? e.canvas : document.createElement("canvas");
        switch (e.type) {
        case m:
            try {
                s = u.getContext("webgl", e)
            } catch (d) {}
            try {
                s = s || u.getContext("experimental-webgl", e)
            } catch (d) {}
            if (!s)
                throw "WebGL not supported";
            break;
        case c:
            try {
                s = u.getContext("2d", e)
            } catch (d) {}
            if (!s)
                throw "Canvas not supported";
            break;
        default:
            u = s = document.createElement("div")
        }
        return s.canvas = u,
        u.className = "sketch",
        o ? e.autoresize = !1 : (e.container.appendChild(u),
        e.hasOwnProperty("autoresize") || (e.autoresize = l.autoresize),
        u.id = t),
        n(self, g),
        n(s, e),
        n(s, p),
        a(),
        e.autoresize && i(),
        w.push(s),
        s.autostart && setTimeout(s.start, 0),
        s
    }
    function n(e, n) {
        for (var t in n)
            e.hasOwnProperty(t) || (e[t] = n[t]);
        return e
    }
    function t(e) {
        function n(e, n) {
            return function() {
                e.call(n, arguments)
            }
        }
        var t = {};
        for (var o in e)
            t[o] = "function" == typeof e[o] ? n(e[o], e) : e[o];
        return t
    }
    function o(e, n) {
        e.length = 0;
        for (var t = 0, o = n.length; o > t; t++)
            e[t] = n[t];
        return e
    }
    function a() {
        function e(e) {
            return M[e] || String.fromCharCode(e)
        }
        function n(e) {
            s.mouse.ox = s.mouse.x,
            s.mouse.oy = s.mouse.y,
            s.mouse.x = e.x,
            s.mouse.y = e.y,
            s.mouse.dx = s.mouse.x - s.mouse.ox,
 .........完整代码请登录后点击上方下载按钮下载查看

网友评论0