分形螺旋动画效果
代码语言:html
所属分类:背景
代码描述:分形螺旋动画效果
代码标签: 效果
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <style> body { margin: 0; height: 500vh; } /* scrollbar hide hacks */ body::-webkit-scrollbar { width:0; } canvas { display: block; position: fixed; top: 0; left: 0; width: 100%; height: 100%; width: 100vw; height: 100vh; } #warpSpeed { display: none; top: 16px; left: 16px; position: fixed; background: transparent; width: 150px; border: 1px solid #fff; color: #fff; font-family: monospace; } </style> </head> <body translate="no"> <canvas id="canv"></canvas> <input id="warpSpeed" value="0" /> <script type="text/javascript" src="http://repo.bfw.wiki/bfwrepo/js/glea.js"></script> <script type="text/javascript" src="http://repo.bfw.wiki/bfwrepo/js/gsap.3.3.1.js"></script> <script type="text/javascript" src="http://repo.bfw.wiki/bfwrepo/js/ScrollTrigger.min.js"></script> <script> const warpSpeed = document.querySelector('#warpSpeed'); gsap.registerPlugin(ScrollTrigger); gsap.to('#warpSpeed', { value: 100, ease: 'none', scrollTrigger: { scrub: 0.3 } }); const glsl = x => x; const frag = glsl` precision highp float; uniform float time; uniform float width; uniform float height; uniform float warpSpeed; const float PI = 3.141592654; const float DEG = PI / 180.0; vec2 coords() { float vmin = min(width, height); return vec2((gl_FragCoord.x - width * .5) / vmin, (gl_FragCoord.y - height * .5) / vmin); } vec2 rotate(vec2 p, float a) { return vec2(p.x * cos(a) - p.y * sin(a), p.x * sin(a) + p.y * cos(a)); } vec2 repeat(in vec2 p, in vec2 c) { return mod(p, c) - 0.5 * c; } // Distance functions by Inigo Quilez // https://iquilezles.org/www/articles/distfunctions2d/distfunctions2d.htm float circle(in vec2 p, in vec2 pos, float radius) { return length((p - pos)) - radius; } float distanceField(vec2 p) { flo.........完整代码请登录后点击上方下载按钮下载查看
网友评论0