sketch实现炫酷多彩粒子雨鼠标交互动画效果代码
代码语言:html
所属分类:粒子
代码描述:sketch实现炫酷多彩粒子雨鼠标交互动画效果代码,鼠标放上去会形成一个护盾。
代码标签: sketch 炫酷 多彩 粒子 雨 鼠标 交互 动画
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> </head> <body> <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/sketch.min.js"></script> <script > const $ = Sketch.create({ autoclear: false }); const { hypot } = Math; let objs = []; let hue = 200; $.mouse.x = $.width / 2; $.mouse.y = $.height / 2; document.body.style.backgroundColor = "black"; document.body.style.overflow = "hidden"; document.body.style.cursor = "none"; class O { constructor() { this.init(); } init() { this.x = random(0, $.width); this.y = 0; this.size = random(3, 8); this.a = .3; this.vx = random(-3, 3); this.vy = this.size; this.hue = hue; return this; } draw() { $.fillStyle = `hsla(.........完整代码请登录后点击上方下载按钮下载查看
网友评论0