Home > front end >  Website background effects is how to do
Website background effects is how to do

Time:09-18

http://cprs.patentstar.com.cn/Account/Login? Backurl=aHR0cDovL2NwcnMucGF0ZW50c3Rhci5jb20uY24vU2VhcmNoL1Jlc3VsdExpc3Q/Q3VycmVudFF1ZXJ5PVZWTkNNeTlaV1E9PSZ0eXBlPWNu


Who know the background of this site effects, call what name? Is how to implement?

CodePudding user response:

Made of canvas

 
<script>

! The function () {

The function n (n, e, t) {

Return n.g etAttribute (e) | | t

}

The function of e (n) {

Return the document. The getElementsByTagName (n)

}

The function of t () {

Var t=e (" script "), o=t.l ength, I=t [o - 1);

Return {

L: o, z: n (I, "zIndex", 1), o, n (I, "opacity", 5), c: n (I, "color", "0, 0), n, n (I," count ", 99)

}

}

The function o () {

A=m. idth=window. InnerWidth | | document. The documentElement. ClientWidth | | document. Body. ClientWidth,

C=m.h eight=window. The innerHeight | | document. The documentElement. ClientHeight | | document. Body. ClientHeight

}

The function () {I

R.c learRect (0, 0, a, c);

Var n, e, t, o, m, l;

S. orEach (function (I, x) {

For (i.x +=i.x a, i.y +=i.y a, i.x a *=i.x & gt; A | | i.x & lt; 0? - 1:1, i.y a *=i.y & gt; C | | i.y & lt; 0? - 1:1, r.f illRect (i.x -. 5, i.y - 5,1,1), e=x + 1; E
null!==n.x & amp; & null!==n.y & amp; & (o=i.x - n.x, m=i.y, n.y.,

L=o * o + m * m, l=n.m ax/2 & amp; & (i.x -=.03 * o, i.y -=. 03 * m),

T=(n.m ax - l)/n.m ax, r. eginPath (), r.l ineWidth=t/2, r.s trokeStyle="rgba (" +, dc +", "+ (t + 2) +") ", r.m oveTo (i.x, i.y), r.l ineTo (n.x, n.y., r.s troke ()))

}),

X (I)

}

Var a, c, u, m=document createElement method (" canvas "),

D=(t), l="c_n" + d.l, r=m.g etContext (" 2 d "),
X=window. RequestAnimationFrame | | window. WebkitRequestAnimationFrame | | window. MozRequestAnimationFrame | | window. ORequestAnimationFrame | | window. MsRequestAnimationFrame | |

The function (n) {

Window. The setTimeout (n, 1 e3/45)

},

W=Math. The random, y={x: null, y: null, Max: 2 e4}; M.i d=l, Margaret spellings tyle. CssText="position: fixed; top:0; left:0; Z - index: "+ d.z +"; Opacity: "+ d.o, e (" body") [0]. The appendChild (m), o (), the window. The onresize=o,

Window. The onm ousemove=function (n) {

N=n | | window. The event, y.x=n.c lientX, y.y=n.c lientY

},

Window. The onm ouseout=function () {

Y.x=null, y.y=null

};

For (var s=[], f=0; D.n & gt; f; F++) {

Var () * h=w a, g=w () * c, v=2 * w () - 1, p=2 * w () - 1; Supachai panitchpakdi ush ({x, h, y, g, xa: v, ya: p, Max: 6 e3})

}

U=s.c oncat ([y]),

SetTimeout (function () {(I)}, 100)

} ();

</script>

CodePudding user response:

references between 1/f, g 1 response:
made of canvas

 
<script>

! The function () {

The function n (n, e, t) {

Return n.g etAttribute (e) | | t

}

The function of e (n) {

Return the document. The getElementsByTagName (n)

}

The function of t () {

Var t=e (" script "), o=t.l ength, I=t [o - 1);

Return {

L: o, z: n (I, "zIndex", 1), o, n (I, "opacity", 5), c: n (I, "color", "0, 0), n, n (I," count ", 99)

}

}

The function o () {

A=m. idth=window. InnerWidth | | document. The documentElement. ClientWidth | | document. Body. ClientWidth,

C=m.h eight=window. The innerHeight | | document. The documentElement. ClientHeight | | document. Body. ClientHeight

}

The function () {I

R.c learRect (0, 0, a, c);

Var n, e, t, o, m, l;

S. orEach (function (I, x) {

For (i.x +=i.x a, i.y +=i.y a, i.x a *=i.x & gt; A | | i.x & lt; 0? - 1:1, i.y a *=i.y & gt; C | | i.y & lt; 0? - 1:1, r.f illRect (i.x -. 5, i.y - 5,1,1), e=x + 1; E
null!==n.x & amp; & null!==n.y & amp; & (o=i.x - n.x, m=i.y, n.y.,

L=o * o + m * m, l=n.m ax/2 & amp; & (i.x -=.03 * o, i.y -=. 03 * m),

T=(n.m ax - l)/n.m ax, r. eginPath (), r.l ineWidth=t/2, r.s trokeStyle="rgba (" +, dc +", "+ (t + 2) +") ", r.m oveTo (i.x, i.y), r.l ineTo (n.x, n.y., r.s troke ()))

}),

X (I)

}

Var a, c, u, m=document createElement method (" canvas "),

D=(t), l="c_n" + d.l, r=m.g etContext (" 2 d "),
X=window. RequestAnimationFrame | | window. WebkitRequestAnimationFrame | | window. MozRequestAnimationFrame | | window. ORequestAnimationFrame | | window. MsRequestAnimationFrame | |

The function (n) {

Window. The setTimeout (n, 1 e3/45)

},

W=Math. The random, y={x: null, y: null, Max: 2 e4}; M.i d=l, Margaret spellings tyle. CssText="position: fixed; top:0; left:0; Z - index: "+ d.z +"; Opacity: "+ d.o, e (" body") [0]. The appendChild (m), o (), the window. The onresize=o,

Window. The onm ousemove=function (n) {

N=n | | window. The event, y.x=n.c lientX, y.y=n.c lientY

},

Window. The onm ouseout=function () {

Y.x=null, y.y=null

};

For (var s=[], f=0; D.n & gt; f; F++) {

Var () * h=w a, g=w () * c, v=2 * w () - 1, p=2 * w () - 1; Supachai panitchpakdi ush ({x, h, y, g, xa: v, ya: p, Max: 6 e3})

}

nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related