html5背景 <腳本類型=“text/javascript”>
$(function () {
if (!window.ActiveXObject && !!document.createElement("canvas" ) ).getContext) {
$.getScript("http://im-img.qq.com/pcqq/js/200/cav.js?_=1428576021379",
. # var t = {
寬度:1.5,且
深度:10,且
切片:6、
yRange : 0.1,
z範圍: 1,
52",
漫射: "#FFFFFF",
# };
{
計數:2,
xy標量:1,
z偏移:100,
環境: "#002c4a",
漫射: "#005584",
速度: 0.001,
重力: 1200,
5,
minLimit: 10,
minDistance: 20,
自動駕駛僱用: false,
繪圖: false,
ate(),
步驟: CAV.Vector3.create(Math.randomInRange(0.2, 1), Math.randomInRange(0.2, 1), Math.randomInRange(0.2, 1))
var m = "canvas";
var E = "svg";
var x = {
渲染器: m
};
var i, n = Date.now();
var L = CAV . Vector3.create();
var k = CAV.Vector3.create();
容器");
var w = document.getElementById("anitOut") ;
var D, I, h, q, y;
var r;
function C() {# # p( ) ;
s();
o()
。
function F() {
g = new CAV.CanvasRenderer();
H(x.renderer)
}
函數H(N) {
如果( D ) {
w.removeChildH ## 開關 (N) {
情況 m:
D = g;
break
}
D.setSize(z.offsetWidth, z.offsetHeight);
w.appendChild(D.element)
}
}
# I.remove(h);
D .clear();
q = new CAV.Plane(t.width * D.width, .height q = new CAV.Plane(t.width * D.width, .height q = new CAV.Plane(t.width * D.width, .height) y = new CAV.Material( t.ambient, t.diffuse);
h = new CAV.Mesh( I.add(h);
var N, O;
.vertices.length - 1; N >= 0; N--) {
O.anchor = CAV.Vector3.clone(O.position);
O.step = CAV.Vector3.create(Math.randomInRange(0.2, 1), Math.randomInRange(0.2, 1), Math.randomInRange(0.2, 1), Math.rand O.time = Math.randomInRange( 0 函數B() {
for (O = I.lights.length - 1; O>=0; O--) {
N = I.且有[O];
# I.remove(N)
}
為 (O = 0; O 環境,G.diffuse);
N.ambi N.diffuseHex = N.diffuse.format();
.mass = Math.randomInRange(0.5, 1);
N.acceleration = CAV.Vector3.create();
.Vector3.create()
}
函數K(O, N) {
CAV.Vector3.set( L }, D.halfWidth, D.halfHeight);
function o() {
u( ) ;
M();
}
# var Q、P、O、R、T、V、U、S = t.深度/2;
CAV.Vector3.copy(G.bounds, L CAV.Vector3.multiplyScalar(G.bounds, G.xyScalar);
CAV.Vector3.setZ(k, G.zOffset);
•) T = I.lights[R] ;
CAV.Vector3.setZ(T.position, var N = Math.clamp(CAV.Vector3.distanceSquared(T.position, k), G.minDistance, G.maxDistance) ;
var W = G.gravity * CAV.Vector3.subtractVectors(T.force, k, T.position);
CAV.Vector3.multip CAV.Vector3.set(T.acceleration);
# CAV.Vector3.add(T.vel CAV.Vector3.multiplyScalar(T.velocity, G.dampening);
, G.maxLimit);
CAV.Vector }
for (V = q.vertices.length - 1; V≥0; V--) {
U = q.vertices[ Q = Math.sin(U.time + U.step[0] * i * t.speed);
.cos(U.time + U.step[1] * i * t.speed);
# CAV.Vector3.set(U.position, t.xRange * q.segmentWidth * QR. CAV. Vector3.add (U.位置,U.錨)
}
q.dirty = true
}
function M() {
D.render(I)
}
函數 J(O) {
var Q var P = 函數(T) {
(Q = 0, l = I.lights.length; Q [Q];
N.ambient.set(T);
N.ambientHex = N.ambient.format()
}
};
var R = 函數(T) {
for (Q = 0, ) N = I.lights[Q];
# N.diffuseHex = N.diffuse.format()
}
};
return {
set: function () {
P(S[0]);
R (S[1])
,
}
# 函數v() {
window.addEventListener("resize", j)
}
CAV.Vector3.set(k, N.x, D.height - N.y);
.Vector3.subtract(k, L)
}
function j(N) {
K(z.offsetWidth, z.offsetHeight);
M()
}
## 在();
);
}
});
腳本> ;
以上是h5QQ登入cav demo的實例詳解的詳細內容。更多資訊請關注PHP中文網其他相關文章!