TweenMax+MorphSVGPlugin实现绿色小草生长随风摇摆动画效果代码
代码语言:html
所属分类:动画
代码描述:TweenMax+MorphSVGPlugin实现绿色小草生长随风摇摆动画效果代码
代码标签: TweenMax MorphSVGPlugin 绿色 小草 生长 随风 摇摆 动画
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> body { height: 100vh; overflow: hidden; } #stage { position: relative; width: 800px; height: 600px; top: 100%; left: 50%; transform: translate(-50%, -100%); } path { fill: none; stroke: green; } button { border: 1px solid rgba(0, 0, 0, 0.2); font-weight: bold; box-shadow: 0 1px 4px 0 rgba(0, 0, 0, 0.37); text-transform: uppercase; transition: all 0.5s ease; line-height: 1.6; padding: 8px 18px; background: #FFC107; color: #555; } button:focus { outline: none; } button:hover { border: 1px solid rgba(0, 0, 0, 0.5); color: #000; } .hud { position: absolute; top: 0; left: 0; padding: 15px; } </style> </head> <body> <!-- partial:index.partial.html --> <div class="hud"> <button id="rise">RISE UP</button> </div> <svg id="stage"></svg> <!-- partial --> <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/TweenMax.min.js"></script> <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/MorphSVGPlugin3.min.js"></script> <script > console.clear(); var log = console.log.bind(console); class Grass { constructor(path, offset, width, height, minHeight, maxHeight, maxAngle, startAngle) { this.path = path; this.width = random(4, 8); this.height = random(150, maxHeight); this.maxAngle = random(10, maxAngle); this.angle = Math.random() * randomSign() * startAngle * Math.PI / 180; var offsetX = 1.5; // Start position var sx = offset / 2 + random(width .........完整代码请登录后点击上方下载按钮下载查看
网友评论0