p5实现特鲁谢阴影背景效果代码
代码语言:html
所属分类:背景
代码描述:p5实现特鲁谢阴影背景效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <style> html, body { margin: 0; padding: 0; } canvas { display: block; } </style> </head> <body> <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/p5.1.4.0.js"></script> <script> let cellsize = 40; function setup() { createCanvas(innerWidth, innerHeight); angleMode(DEGREES); let context = drawingContext; // or p5.drawingContext context.shadowOffsetX = 5; context.shadowOffsetY = -5; context.shadowBlur = 10; context.shadowColor = '#000'; noLoop(); } function draw() { background(220); // drawCellA(40, 40); // drawCellB(80, 40); for (let i = 0; i < innerWidth; i += cellsize) { for (let j = 0; j < innerHeight.........完整代码请登录后点击上方下载按钮下载查看
网友评论0