three+webgl实现点击生长的荷花盛开动画效果代码
代码语言:html
所属分类:动画
代码描述:three+webgl实现点击生长的荷花盛开动画效果代码,任意位置点击,荷花会生长到指定位置绽放。
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> html, body { overflow: hidden; padding: 0; margin: 0; } .container { position: fixed; top: 0; left: 0; width: 100%; height: 100vh; display: flex; flex-direction: column-reverse; align-items: start; } .clean-btn { z-index: 1; font-family: sans-serif; font-size: 15px; color: white; text-shadow: 0 0 10px #000000; user-select: none; padding: 0 0 15px 25px; cursor: pointer; text-decoration: underline; opacity: .5; } canvas { position: absolute; top: 0; left: 0; display: block; } .name { position: fixed; top: 50%; left: 50%; width: 100%; transform: translate(-50%, -50%); color: white; text-align: center; font-size: 4vw; text-shadow: 0 0 5px #000000; user-select: none; pointer-events: none; } @media all and (min-width: 640px) { .name { font-size: 45px } } </style> </head> <body> <div class="container"> <canvas id="canvas"></canvas> <div class="clean-btn"> clean the screen </div> </div> <div class="name"> Click To Add Flowers </div> <script type="x-shader/x-fragment" id="fragmentShader"> #define PI 3.14159265359 uniform float u_ratio; uniform vec2 u_cursor; uniform float u_stop_time; uniform float u_clean; uniform vec2 u_stop_randomizer; uniform sampler2D u_texture; varying vec2 vUv; // -------------------------------- // 2D noise vec3 mod289(vec3 x) { return x - floor(x * (1.0.........完整代码请登录后点击上方下载按钮下载查看
网友评论0