js实现canvas线条下落动画效果代码
代码语言:html
所属分类:动画
代码描述:js实现canvas线条下落动画效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!doctype html> <html> <head> <meta charset="utf-8"> <title></title> <style> body { margin:0; } canvas { background:#CFF09E; display:block; } </style> </head> <body> <canvas id="c"></canvas> <script> (function(){ var c = document.getElementById("c"), ctx = c.getContext("2d"); c.width = innerWidth; c.height = innerHeight; var lines = [], maxSpeed = 5, spacing = 5, xSpacing = 0, n = innerWidth / spacing, colors = ["#3B8686", "#79BD9A", "#A8DBA8", "#0B486B"], i; for (i = 0; i < n; i++){ xSpacing += sp.........完整代码请登录后点击上方下载按钮下载查看
网友评论0