HTML5+Canvas? ??? ?? ??
<html>
<??>
<meta charset="utf-8">
<title>不要失去你的彩虹</title>
<???>
??? {
? ??: ??;
? ??: 0;
? ??: 0;
}
</???>
</??>
<?>
<??? id=c></canvas>
<????>
w = c.width = window.innerWidth;
h = c.height = window.innerHeight;
const ctx = c.getContext('2d');
const ?? = {
? ? 16?? ??: 30,
? ? lenFn: ({ len, t }) =>
? ? ? len + Math.sin(t),
? ? radFn: ({ rad, len, t, ?? }) =>
? ? ? rad + (?? + opts.propFn({ len, t }))*2 / 4,
? ? propFn: ({ len, t }) =>?
? ? ? len / opts.hexLength / 10 - t,
? ? ??Fn: ({ len, t }) =>
? ? ? ?Math.sin(opts.propFn({ len, t }))**2,
? ? colorFn: ({ rad, ??, t }) =>?
? ? ? `hsl(${rad / Math.TAU * 360 + t}, ${?? * 100}%, ${20 + ?? * 50}%)`,
? ? ?? ??: .01,
? ? ????: 8,
??
? ? repaintColor: 'rgba(0,0,0,.1)'
? };
? = 0;
??.TAU = 6.28318530717958647692;
const ?? = [];
??? ?? {
? ???({ x, y }) {
? ? this.len = Math.sqrt(x*x + y*y);
? ? this.rad = Math.acos(x / this.len) * (y > 0 ? 1 : -1) + .13;
? ? this.prevPoint = { x, y };
? }
??
? ??() {
? ? const ?? = opts.excitementFn({ len: this.len, t: ??? });
? ? const ???? = {?
? ? ? ?: this.len,
? ? ? rad: this.rad,
? ? ? t: ?,
? ? ? ??
? ? };
? ? const nextLen = opts.lenFn(param);
? ? const nextRad = opts.radFn(param);
? ? const ?? = opts.colorFn(param);
? ??
? ? ctx.StrokeStyle = ??;
? ? ctx.lineWidth = ?? + .2;
? ? ctx.beginPath();
? ? ctx.moveTo(this.prevPoint.x, this.prevPoint.y);
? ? this.prevPoint.x = nextLen * Math.cos(nextRad) +?
? ? ? Math.random() * (1-??)**2 * opts.randomJig * 2 - opts.randomJig;
? ? this.prevPoint.y = nextLen * Math.sin(nextRad) +
? ? ? Math.random() * (1-??)**2 * opts.randomJig * 2 - opts.randomJig;
? ? ctx.lineTo(this.prevPoint.x, this.prevPoint.y);
? ? ctx.????();
? }
??
? ?? ??() {
? ? ??.?? = 0;?
? ? const hexCos = Math.cos(Math.TAU / 12) * opts.hexLength;
? ? const hexSin = Math.sin(Math.TAU / 12) * opts.hexLength;
??
? ? alternanceX = false? ??;
? ? for(let x = 0; x < w; x += hexCos) {
? ? ? Alternance = alternanceX = !alternanceX;
? ? ? for(let y = 0; y < h; y += hexSin + opts.hexLength) {
? ? ? ? ?? = !alternance;
? ? ? ? vertices.push(? ??({
? ? ? ? ? x: x - w / 2,
? ? ? ? ? y: y + ?? * hexSin - h / 2
? ? ? ? }))
? ? ? }
? ? }
? ??
? }
}
Vertex.gen();
ctx.fillStyle = '#222';
ctx.fillRect(0, 0, w, h);
const ????? = () => {
? window.requestAnimationFrame(anim);
??
? ? += opts.timeStep;
??
? ctx.fillStyle = opts.repaintColor;
? ctx.fillRect(0, 0, w, h);
??
? ctx.translate(w/2, h/2);
? vertices.forEach((vertex) => vertex.step());
? ctx.translate(-w/2, -h/2);
}
?????();
window.addEventListener('resize', () => {
? w = c.width = window.innerWidth;
? h = c.height = window.innerHeight;
??
? Vertex.gen();
? ? = 0;
? ctx.fillStyle = '#222';
? ctx.fillRect(0, 0, w, h);
})
</??>
</html>
這是一個HTML5+Canvas? 黑洞特效, 需要的朋友可以直接下載使??, 更多特效代碼盡??PHP中文網(wǎng)。
? ???? ?? ???? ???? ????? ?? ???? ????? ????????. ?????? ???? ?? ??????! ? ???? ?? ???? ?? ?????? ?????. ??? ???? ???? ??? ????. ??? ??? ?? ??? ?? ??? ???? ????! ??? ?? ?? ??? ???? ????? ????. ???: admin@php.cn
?? ??

04 Jun 2025
CSGO (Coun ?? ??? ??? ??? ?? ?? ???? ?? ????? ??? ? ??????. ?? ??? ?? ???? ?? ???? ?? ?? ????, ???? ??? ?? ??? ??? ??? ? ????. ? ??? CSGO ?? ?? ?????? ?? ???? ??? ??? ???? ??? ??? ???? ??? ? ??????.

13 Mar 2025
ASUS ?? ?? ??? ??? ?? : ?? ?? ?? ??? ??? ASUS? ?? ??? ? ???? ?? ?????? ?? ?? ???? ???? ?? ??? ????? ?? ??? ?? ??? ?????. ??? ? ??

05 Apr 2025
? ????? ?? ?? ???? ????? ??? ???? ??? ??? ?? ????? ?? ??? ????? ??? ???? ??? ?????? ? ?? ...

01 Mar 2025
? ??? ??? ??? ????? ?? 10 Cool JQuery ?? ?? ?? ????! ??? ?? jQuery Navigation ?? ????? ????? ?? 10 ?? ??? JQuery ?? ?? ????? ?????. ????! ?? ?? ? : -10 ??? jQuery Navigation MENUS -15 ??? jQuery Navigation MENUS ??? ??? ??? ???? ?????? ? ????? ????? ?? ?? ????? ??? ??? ?? ??? ?? ? ????. ?? ?? ?? 2. jQuery ??? ??-Submenu??? FX CSS ?? 100% CSS ??, jQuery? ???? ?? ??. JavaScript ? ???? ?? ??? ??????. ??? ????, ???? ??? ?????

05 Apr 2025
CSS ?? ?? ? ?? ?? ??? ??? CSS? ???? ?? ?? ??? ??? ??? ???? ?? ???? ?? ???? ??? ???? ??? ?? ?? ? ???? ...

14 Jul 2025
Andrew Hammelbrowse? ?? ??? Rimworld? ???? Rimworld Odyssey DLC? ??? ??, ?? ?? ? ??? ? ??? ?? ??? ?? ??? ?????. ???? ??? ? ????. ???? ?? ???????.

21 Mar 2025
Avowed 's Best Sight Bows : ??? ?? ???. ???? ?? ??? Avowed? ?, ?? ??? ??? ?? ?????. ??? ??? ??, ? ?? ??? ? ?? ??? ?????. ? ???? ?? UN? ??? ?????

12 Mar 2025
Deepseek ??? ?? ??? ????? ?? ???? ?? ?? ? ????! ? ??? ?? ?? ???? ?? ??? ????? Deepseek ??? ?? ??? ????? ????? ???? ??? ? ????. ?? DeepSeek ?????? ?? ?? ?????? ?? ????? ??????. ?? ?? ?? DeepSeek, "??"???? "?? ??"??? ???? ???, ??? ? ??? ??? ??????. ??? ??? ??? ?? ???? ?? ?? ??? ???? ??? ??? ???? ?? ??? ???? ??? ??? ???? ????? ????. ?? ?? ? ??? DeepSeek ?? ?? ?? ?????? ???? ???? ??? ??? ???? ??? ???? ??? ???? ??? ??????.

29 Nov 2024
Douyin? ??? ??, ??? ?? ??, ?? ??, ?? ?? ? ?? ?? ??? ??? ???? ???? ???? ?? ??, ?? ? ??? ? ??? ?? ??? ?? AI ??? ?????. ??? ??, ??? ?? ? ?? ?? ??? ??? ??? ?? ???? ??????. ?? ??? ?? ???? ??? ?????.


??? ??

HTML5 Canvas ?? ???? ????? ?? ??
HTML5 Canvas ?? ???? ????? ?? ??? ?????? ?? ?? ??? ? ? ?? ??? ????????.

H5 ?? ?? ?? ?? ??
HTML5 Mobile Panda? ?? ?? ?? ?? ?????. ?? ??: ??? ?? ?? ?? ???? ??? ???? ????? ?????. ?? ??? ??? ?????.

HTML5 ???? ?? ?? ????? ?? ??
svg? ???? ??????? ??? ?? ??? ?? ?????? ??? ?? ?????? ????? ?????.

H5 3D ?? ? ?? ?? ??
HTML5 ?? 3D ? ?? ??? ?? ?? ????. ?? ??: ?? ?? ?? ????, ?? ?? ?? ?? ??? ???? ???? ?? ????? ????? ?????. ???? ???? ?? ??? ?? ???????.
