html5背景 <br> *{margin:0;padding:0;list-style-type:none;}<br> a,img{border:0;}<br> <br>$(function () {<br> if (!window.ActiveXObject && !!document.createElement("canvas").getContext) {<br> $.getScript( "http://im-img.qq.com/pcqq/js/200/cav.js?_=1428576021379",<br> 함수 () {<br> var t = {<br> 너비: 1.5,<br> 높이: 1.5,<br> 깊이 : 10,<br> 세그먼트: 12,<br> 슬라이스: 6,<br> xRange: 0.8,<br> yRange: 0.1,<br> zRange: 1,<br> 주변: "#525252",<br> 확산: " #FFFFFF",<br> 속도: 0.0002<br> } ;<br> var G = {<br> 개수: 2,<br> xyScalar: 1,<br> z오프셋: 100,<br> 주변: "#002c4a",<br> 확산: "#005584",<br> 속도: 0.001 ,<br> 중력: 1200,<br> 감쇠: 0.95,<br> minLimit: 10,<br> maxLimit: null,<br> 최소 거리: 🜜 maxDistance: 400,<br> 자동 조종 장치: false,<br> 그리기: false,<br> 경계: CAV.Vector3.create( ),<br> 단계: CAV.Vector3.create(Math.randomInRange(0.2, 1), Math.randomInRange(0.2, 1), Math.randomInRange(0.2, 1))<br> };<br> var m = "캔버스";<br> var E = "svg";<br> var x = {<br> 렌더러: m<br> };<br> var i, n = Date.now ();<br> var L = CAV.Vector3.create();<br> var k = CAV.Vector3.create( );<br> var z = document.getElementById("container");<br> var w = document.getElementById("anitOut");<br> var D, I, h, , y;<br> var g;<br> var r;<br><br> 함수 C() {<br> F();<br> p();<br> s();<br> B();<br> v();<br> K(z.offsetWidth, z.offsetHeight);<br> o()<br> }<br><br> 함수 F() {<br> g = new CAV.CanvasRenderer();<br> H(x.renderer)<br> }<br><br> 기능 H(N) {<br> if (D) {<br> w.removeChild(D.element)<br> } <br> 스위치(N) {<br> 케이스 m:<br> D = g;<br> 브레이크<br> }<br> D.setSize(z.offsetWidth, z.offsetHeight);<br> w.appendChild(D.element)<br> }<br><br> 함수 p() {<br> I = 새로운 CAV. Scene()<br> }<br><br> 함수 s() {<br> I.remove(h);<br> D.clear();<br> q = new CAV.Plane(t.width * D.width, t.height * D.height , t.segments, t.slices);<br> y = 새 CAV.Material(t.ambient, t.diffuse);<br> h = 새 CAV.Mesh(q, y) I.add(h);<br> var N, O;<br> for (N = q.vertices.length - 1; N >= 0; N--) {<br> O = q.vertices[N];<br> O.anchor = CAV.Vector3.clone(O .position);<br> O.step = CAV.Vector3.create(Math.randomInRange(0.2, 1), Math.randomInRange(0.2, 1), Math.randomInRange(0.2, 1));<br> O.time = 수학. RandomInRange(0, Math.PIM2)<br> }<br> }<br><br> 함수 B() {<br> var O, N;<br> for (O = I.lights.length - 1; O >= 0; O--) {<br> N = I.lights[O];<br> I.remove(N)<br> }<br> D.clear();<br> for (O = 0; O < G.count; O++) {<br/> N = 새로운 CAV.Light(G.ambient, G.diffuse);<br/> N.ambientHex = N.ambient.format();<br/> N.diffuseHex = N.diffuse.format();<br/> I.add(N);<br/> N.mass = Math.randomInRange(0.5, 1);<br/> N. 속도 = CAV.Vector3.create();<br/> N.acceleration = CAV.Vector3.create();<br/> N.force = CAV.Vector3.create()<br/> }<br/> }<br/><br/> 함수 K(O, N) {<br/> D.setSize(O, N);<br/> CAV.Vector3.set(L, D.halfWidth, D.halfHeight);<br/> s()<br/> } <br/><br/> 기능 o() {<br/> i = Date.now() - n ;???? <br/><br/> 함수 u() {<br/> var Q, P, O, R, T, V, U, S = t.깊이 / 2;<br/> CAV.Vector3.copy(G.bounds, L);<br/> CAV.Vector3.multiplyScalar(G.bounds, G.xyScalar);<br/> CAV.Vector3.setZ(k, G.zOffset);<br/> for (R = I.lights.length - 1; R >= 0; R--) {<br> T = I.lights[R];<br> CAV. Vector3.setZ(T.position, G.zOffset);<br> var N = Math.clamp(CAV.Vector3.distanceSquared(T.position, k), G.minDistance, G.maxDistance);<br> var W = G.중력 * T.mass / N;<br> CAV.Vector3.subtractVectors(T.force, k, T.position);<br> CAV.Vector3.normalise(T.force);<br> CAV.Vector3.multiplyScalar(T.force, W) ;<br> CAV.Vector3.set(T.acceleration);<br> CAV.Vector3.add(T.acceleration, T.force);<br> CAV.Vector3.add(T.velocity, T.acceleration);<br> CAV.Vector3. MultipliScalar(T.velocity, G.dampening);<br> CAV.Vector3.limit(T.velocity, G.minLimit, G.maxLimit);<br> CAV.Vector3.add(T.veloc, ity)<br> }<br> 에 대해 (V = q.vertices.length - 1; V>= 0; V--) {<br> U = q.vertices[V];<br> Q = Math.sin(U.time + U.step[0] * i * t.speed);<br> P = Math.cos(U.time + U.step[1] * i * t.speed);<br> O = Math.sin(U.time + U.step[2] * i * t.speed);<br> CAV.Vector3.set(U.position , t.xRange * q.segmentWidth * Q, t.yRange * q.sliceHeight * P, t.zRange * S * O - S);<br> CAV.Vector3.add(U.position, U.anchor)<br> }<br> q.dirty = true<br> }<br><br> 기능 M() {<br> D.render(I)<br> } <br><br> 함수 J(O) {<br> var Q, N, S = O;<br> var P = 함수(T) { <br> for (Q = 0, l = I.lights.length; Q N = N.ambient.set(T);<br> N.ambientHex = N. ambient.format()<br> }<br> };<br> var R = 함수(T) {<br> for (Q = 0, l = I.lights.length; Q < l; Q++) {<br> N = I.lights[Q ];<br> N.diffuse.set(T);<br> N.diffuseHex = N.diffuse.format()<br> > P(S[0]);<br> R (S[1])<br> }<br> }<br> }<br><br> 기능 v( ) {<br> window.addEventListener("resize", j)<br> }<br><br> 함수 A(N) {<br> CAV.Vector3.set(k, N.x, D.height - N.y); <br> CAV.Vector3.subtract(k, L)<br> }<br><br> 함수 j(N) {<br> K(z.offsetWidth, z.offsetHeight);<br> M() + );<br> }<br>});<br>