shader-doodle实现彩虹变换背景色

代码语言:html

所属分类:背景

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<style>
shader-doodle {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: 100vw;
}
</style>

</head>
<body translate="no">

<a href="https://github.com/halvves/shader-doodle" target="_blank">
<shader-doodle>
<script type="x-shader/x-fragment">
      #define TAU 6.28318530718

      //  by Iñigo Quiles
      //  https://www.shadertoy.com/view/MsS3Wc
      vec3 hsb2rgb(in vec3 c) {
        vec3 rgb = clamp(abs(mod(c.x * 6. + vec3(0., 4., 2.), 6.) - 3.) - 1., 0., 1.);
        rgb = rgb * rgb * (3. - 2. * rgb);
        return c.z * mix(vec3(1.), rgb, c.y);
      }

      vec2 polar(in vec2 st) {
        vec2 c = vec2(.5) - st;
        float angle = atan(c.y, c.x) / TAU + .5;
        float radius = length(c) * 2.;
        return vec2(angle, radius);
      }

      vec2 coverScreen(vec2 fragCoord, vec2 resolution, float aspect) {.........完整代码请登录后点击上方下载按钮下载查看

网友评论0