js实现canvas三维文字发光重影鼠标交互效果代码
代码语言:html
所属分类:动画
代码描述:js实现canvas三维文字发光重影鼠标交互效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!doctype html> <html> <head> <meta charset="utf-8"> <style> body, html { margin: 0; background: -webkit-radial-gradient(center, ellipse cover, #111 10%, #333 90%); } canvas { display: block; cursor: crosshair; } h2 { position: absolute; bottom: 10px; width: 100%; letter-spacing: 4px; text-align: center; font-weight: bold; font-size: 1em; font-family: Arial, Helvetica, sans-serif; color: #AAA; } </style> </head> <body> <canvas id="canvas"></canvas> <h2>移动鼠标!</h2> <script> "use strict"; class Vector { constructor(x, y) { this.x = x; this.y = y; } add(v) { return new Vector( this.x + v.x, this.y + v.y); } addTo(v) { this.x += v.x; this.y += v.y; } sub(v) { return new Vector( this.x - v.x, this.y - v.y); } subFrom(v) { this.x -= v.x; this.y -= v.y; } mult(n) { return new Vector(this.x * n, this.y * n); } .........完整代码请登录后点击上方下载按钮下载查看
网友评论0