博客园美化:canvas炫酷背景

话不多说,先上效果图:

image

yysy,这个当背景确实酷炫!!!😄

页脚HTML代码:

  1 <script src="https://files.cnblogs.com/files/zhangshuhao1116/vendors.js"></script>
  2 <script type="text/javascript" language="javascript">
  3 
  4   ! function (e) {
  5     function t(t) {
  6         for (var o, a, c = t[0], u = t[1], s = t[2], l = 0, p = []; l < c.length; l++) a = c[l], r[a] && p.push(r[a][0]), r[a] = 0;
  7         for (o in u) Object.prototype.hasOwnProperty.call(u, o) && (e[o] = u[o]);
  8         for (f && f(t); p.length;) p.shift()();
  9         return i.push.apply(i, s || []), n()
 10     }
 11 
 12     function n() {
 13         for (var e, t = 0; t < i.length; t++) {
 14             for (var n = i[t], o = !0, c = 1; c < n.length; c++) {
 15                 var u = n[c];
 16                 0 !== r[u] && (o = !1)
 17             }
 18             o && (i.splice(t--, 1), e = a(a.s = n[0]))
 19         }
 20         return e
 21     }
 22     var o = {},
 23         r = {
 24             4: 0
 25         },
 26         i = [];
 27 
 28     function a(t) {
 29         if (o[t]) return o[t].exports;
 30         var n = o[t] = {
 31             i: t,
 32             l: !1,
 33             exports: {}
 34         };
 35         return e[t].call(n.exports, n, n.exports, a), n.l = !0, n.exports
 36     }
 37     a.m = e, a.c = o, a.d = function (e, t, n) {
 38         a.o(e, t) || Object.defineProperty(e, t, {
 39             enumerable: !0,
 40             get: n
 41         })
 42     }, a.r = function (e) {
 43         "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(e, Symbol.toStringTag, {
 44             value: "Module"
 45         }), Object.defineProperty(e, "__esModule", {
 46             value: !0
 47         })
 48     }, a.t = function (e, t) {
 49         if (1 & t && (e = a(e)), 8 & t) return e;
 50         if (4 & t && "object" == typeof e && e && e.__esModule) return e;
 51         var n = Object.create(null);
 52         if (a.r(n), Object.defineProperty(n, "default", {
 53                 enumerable: !0,
 54                 value: e
 55             }), 2 & t && "string" != typeof e)
 56             for (var o in e) a.d(n, o, function (t) {
 57                 return e[t]
 58             }.bind(null, o));
 59         return n
 60     }, a.n = function (e) {
 61         var t = e && e.__esModule ? function () {
 62             return e.default
 63         } : function () {
 64             return e
 65         };
 66         return a.d(t, "a", t), t
 67     }, a.o = function (e, t) {
 68         return Object.prototype.hasOwnProperty.call(e, t)
 69     }, a.p = "";
 70     var c = window.webpackJsonp = window.webpackJsonp || [],
 71         u = c.push.bind(c);
 72     c.push = t, c = c.slice();
 73     for (var s = 0; s < c.length; s++) t(c[s]);
 74     var f = u;
 75     i.push([30, 0]), n()
 76 }({
 77     27: function (e, t, n) {},
 78     30: function (e, t, n) {
 79         "use strict";
 80         n.r(t);
 81         var o = n(1),
 82             r = n(6),
 83             i = n(15),
 84             a = n(10),
 85             c = n(9),
 86             u = n(2),
 87             s = n(11),
 88             f = n(7),
 89             l = n(8),
 90             p = n(34),
 91             y = n(37),
 92             h = n(35),
 93             b = n(36);
 94 
 95         function d(e) {
 96             return (d = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (e) {
 97                 return typeof e
 98             } : function (e) {
 99                 return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e
100             })(e)
101         }
102 
103         function v(e, t) {
104             for (var n = 0; n < t.length; n++) {
105                 var o = t[n];
106                 o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, o.key, o)
107             }
108         }
109 
110         function w(e, t) {
111             return !t || "object" !== d(t) && "function" != typeof t ? function (e) {
112                 if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
113                 return e
114             }(e) : t
115         }
116 
117         function m(e) {
118             return (m = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
119                 return e.__proto__ || Object.getPrototypeOf(e)
120             })(e)
121         }
122 
123         function O(e, t) {
124             return (O = Object.setPrototypeOf || function (e, t) {
125                 return e.__proto__ = t, e
126             })(e, t)
127         }
128         var g, j, P = n(4);
129         n(14), n(27);
130 
131         function S(e, t) {
132             for (var n = 0; n < t.length; n++) {
133                 var o = t[n];
134                 o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, o.key, o)
135             }
136         }
137 
138         function _(e, t, n) {
139             return (_ = "undefined" != typeof Reflect && Reflect.get ? Reflect.get : function (e, t, n) {
140                 var o = function (e, t) {
141                     for (; !Object.prototype.hasOwnProperty.call(e, t) && null !== (e = F(e)););
142                     return e
143                 }(e, t);
144                 if (o) {
145                     var r = Object.getOwnPropertyDescriptor(o, t);
146                     return r.get ? r.get.call(n) : r.value
147                 }
148             })(e, t, n || e)
149         }
150 
151         function k(e) {
152             return (k = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (e) {
153                 return typeof e
154             } : function (e) {
155                 return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e
156             })(e)
157         }
158 
159         function M(e, t) {
160             if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
161         }
162 
163         function x(e, t) {
164             return !t || "object" !== k(t) && "function" != typeof t ? function (e) {
165                 if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
166                 return e
167             }(e) : t
168         }
169 
170         function F(e) {
171             return (F = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
172                 return e.__proto__ || Object.getPrototypeOf(e)
173             })(e)
174         }
175 
176         function T(e, t) {
177             if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function");
178             e.prototype = Object.create(t && t.prototype, {
179                 constructor: {
180                     value: e,
181                     writable: !0,
182                     configurable: !0
183                 }
184             }), t && z(e, t)
185         }
186 
187         function z(e, t) {
188             return (z = Object.setPrototypeOf || function (e, t) {
189                 return e.__proto__ = t, e
190             })(e, t)
191         }
192         var E, L = new(g = Object(f.a)({
193             x: 1,
194             y: 1
195         }, .1), Object(l.a)((E = j = g(j = function (e) {
196             function t() {
197                 return M(this, t), x(this, F(t).apply(this, arguments))
198             }
199             return T(t, r["a"]), t
200         }()) || j, j = function (e) {
201             function t(e) {
202                 var n;
203                 return function (e, t) {
204                     if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
205                 }(this, t), (n = w(this, m(t).call(this, e))).clock = new o.Clock, n.currentPass = !1, n.effects = {}, n.passes = [], n.composer = new p.a(n.renderer, {}), n.effects.render = new y.a(n.scene, n.camera), n.addPass(n.effects.render), n
206             }
207             var n, r, i;
208             return function (e, t) {
209                 if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function");
210                 e.prototype = Object.create(t && t.prototype, {
211                     constructor: {
212                         value: e,
213                         writable: !0,
214                         configurable: !0
215                     }
216                 }), t && O(e, t)
217             }(t, E), n = t, (r = [{
218                 key: "addBloomEffect",
219                 value: function (e, t) {
220                     this.effects.bloom = new h.a(e), this.effects.bloom.blendMode.opacity.value = t, this.addPass(new b.a(this.camera, this.effects.bloom))
221                 }
222             }, {
223                 key: "addPass",
224                 value: function (e) {
225                     this.passes.length && (this.passes[this.passes.length - 1].renderToScreen = !1), this.passes.push(e), this.composer.addPass(e), this.passes[this.passes.length - 1].renderToScreen = !0
226                 }
227             }, {
228                 key: "render",
229                 value: function () {
230                     this.composer.render(this.clock.getDelta())
231                 }
232             }, {
233                 key: "resizeRender",
234                 value: function () {
235                     this.composer && this.composer.setSize(this.width, this.height)
236                 }
237             }]) && v(n.prototype, r), i && v(n, i), t
238         }() || j)) || j);
239         L.camera.position.z = 2, L.addBloomEffect({
240             resolutionScale: .5,
241             kernelSize: 4,
242             distinction: .01
243         }, 1);
244         var R = new i.a;
245         R.update = function () {
246             R.rotation.y -= 4e-4, R.rotation.x -= 2e-4
247         }, L.add(R);
248         var A = new o.Vector3,
249             B = new o.Vector3,
250             I = new o.Raycaster,
251             D = new o.SphereBufferGeometry(4, 32, 32, 0, 3.2, 4, 2.1),
252             J = new o.MeshBasicMaterial({
253                 wireframe: !0,
254                 visible: !1
255             }),
256             V = new o.Mesh(D, J);
257         L.add(V), V.position.z = 2;
258         var q = ["#FFFAFF", "#0A2463", "#3E92CC", "#723bb7", "#efd28e", "#3f9d8c"].map(function (e) {
259                 return new o.Color(e)
260             }),
261             G = new(function (e) {
262                 function t() {
263                     return M(this, t), x(this, F(t).apply(this, arguments))
264                 }
265                 var n, o, r;
266                 return T(t, c["a"]), n = t, (o = [{
267                     key: "addLine",
268                     value: function () {
269                         for (var e = Object(u.a)(-2.4, 7.2), n = -25 * Math.PI / 180, o = 200 * Math.PI / 180, r = []; n < o;) {
270                             n += .2, e -= .1, A.set(4 * Math.cos(n), e, 4 * Math.sin(n)), B.set(-A.x, 0, -A.z), B.normalize(), I.set(A, B);
271                             var i = I.intersectObject(V, !0);
272                             i.length && r.push(i[0].point.x, i[0].point.y, i[0].point.z)
273                         }
274                         0 !== r.length && (Math.random() > .5 ? _(F(t.prototype), "addLine", this).call(this, {
275                             visibleLength: Object(u.a)(.01, .2),
276                             points: r,
277                             speed: Object(u.a)(.003, .008),
278                             color: Object(s.a)(q),
279                             width: Object(u.a)(.01, .1)
280                         }) : _(F(t.prototype), "addLine", this).call(this, {
281                             visibleLength: Object(u.a)(.05, .2),
282                             points: r,
283                             speed: Object(u.a)(.01, .1),
284                             color: q[0],
285                             width: Object(u.a)(.01, .01)
286                         }))
287                     }
288                 }]) && S(n.prototype, o), r && S(n, r), t
289             }())({
290                 frequency: .99
291             }, {
292                 transformLineMethod: function (e) {
293                     return e
294                 }
295             });
296         L.add(G), L.start();
297         var H = new TimelineLite({
298             delay: .2,
299             onStart: function () {
300                 G.start()
301             }
302         });
303         H.to(".overlay", 2, {
304             autoAlpha: 0
305         }), H.fromTo(L.lookAt, 3, {
306             y: -4
307         }, {
308             y: 0,
309             ease: Power3.easeOut
310         }, "-=2"), H.add(C.show, "-=2"), P.a.onHide(function (e) {
311             var t = new TimelineLite;
312             t.to(L.lookAt, 2, {
313                 y: -6,
314                 ease: Power3.easeInOut
315             }), t.add(C.hide, 0), t.add(G.stop), t.to(".overlay", .5, {
316                 autoAlpha: 1,
317                 onComplete: e
318             }, "-=1.5")
319         })
320     }
321 });
322 </script>

 

posted @ 2024-05-18 17:34  Shu_HowZ  阅读(193)  评论(0编辑  收藏  举报
  • 首页
  • 关于
  • 友链
  • 留言板
  • Timeline
  • Mail
  • 发消息
  • 微信
  • QQ
  • 微博
  • Github
  • 百度
  • 宝藏网盘
  • 照片
  • 后台管理