canvas实现彩色三角形随机布局效果代码
代码语言:html
所属分类:布局界面
代码描述:canvas实现彩色三角形随机布局效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<style>
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
.container {
height: 100%;
overflow: hidden;
position: absolute;
width: 100%;
}
</style>
</head>
<body>
<div class="container">
<canvas></canvas>
</div>
<script >
// Find the canvas in the HTML document
const canvas = document.querySelector("canvas");
// Get the canvas 2D context
let ctx = canvas.getContext("2d");
// Add colours to an array, index 0 is the background
let colors = ["#f4f4f4", "#f8419b&quo.........完整代码请登录后点击上方下载按钮下载查看
网友评论0