圆角三角形背景效果
代码语言:html
所属分类:背景
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<style>
body {
font-family: Arial, Helvetica, "Liberation Sans", FreeSans, sans-serif;
background-color: #000;
margin:0;
padding:0;
border-width:0;
}
</style>
</head>
<body translate="no">
<script >
"use strict";
window.addEventListener("load", function () {
/* constants to play with */
const limBiTri = 150;
const dHue = 40;
const halfMargin = 3; // px for space between triangles
const roundRadius = 10;
/* halfMargin and roundRadius should be kept positive and small with respect to limBiTri
or insconsistency issues may arise */
/* modifications beyond this line at your own risks */
let canv, ctx; // canvas and context : global variables (I know :( )
let maxx, maxy; // canvas sizes (in pixels)
let hueMono;
let monochrome;
let bt0, bt1, bt2;
let prevTri, currTri;
// shortcuts for Math.…
const mrandom = Math.random;
const mhypot = Math.hypot;
const matan2 = Math.atan2;
const mabs = Math.abs;
//-----------------------------------------------------------------------------
// miscellaneous functions
//-----------------------------------------------------------------.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0