three+ccapture实现无限循环408超时时钟指针摆动动画效果代码
代码语言:html
所属分类:动画
代码描述:three+ccapture实现无限循环408超时时钟指针摆动动画效果代码,时钟指针放大无限嵌套摆动动画,有催眠效果。
代码标签: three ccapture 无限 循环 408 超时 时钟 指针 摆动 动画
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<style>
body {
margin: 0;
padding: 0;
}
#container {
position: fixed;
touch-action: none;
}
.message {
padding: 0 20px;
font-family: Helvetica, Arial;
position: fixed;
bottom: 0%;
left: 50%;
transform: translate(-50%, -50%);
}
p {
margin: 2px;
}
</style>
</head>
<body >
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/three.88.js"></script>
<script id="vertexShader" type="x-shader/x-vertex">
void main() {
gl_Position = vec4( position, 1.0 );
}
</script>
<script id="fragmentShader" type="x-shader/x-fragment">
uniform vec2 u_resolution;
uniform vec2 u_mouse;
uniform float u_time;
uniform sampler2D u_noise;
uniform sampler2D u_clockface;
#define PI 3.141592653589793
#define TAU 6.283185307179586
vec2 hash2(vec2 p)
{
vec2 o = texture2D( u_noise, (p+0.5)/256.0, -100.0 ).xy;
return o;
}
vec3 hsb2rgb( in vec3 c ){
vec3 rgb = clamp(abs(mod(c.x*6.0+vec3(0.0,4.0,2.0),
6.0)-3.0)-1.0,
0.0,
1.0 );
rgb = rgb*rgb*(3.0-2.0*rgb);
return c.z * mix( vec3(1.0), rgb, c.y);
}
vec3 domain(vec2 z){
return vec3(hsb2rgb(vec3(atan(z.y,z.x)/TAU,1.,1.)));
}
vec3 colour(vec2 z) {
return domain(z);
}
// These awesome complex Math functions curtesy of
// https://github.com/mkovacs/reim/blob/master/reim.glsl
vec2 cCis(float r);
vec2 cLog(vec2 c); // principal value
vec2 cInv(vec2 c);
float cArg(vec2 c);
float cAbs(vec2 c);
vec2 cMul(vec2 a, vec2 b);
vec2 cDiv(vec2 a, vec2 b);
vec2 cCis(float r)
{
return vec2( cos(r), sin(r) );
}
vec2 cExp(vec2 c)
{
return exp(c.x) * cCis(c.y);
}
vec2 cConj(vec2 c)
{
return vec2(c.x, -c.y);
}
vec2 cInv(vec2 c)
{
return cConj(c) / dot(c, c);
}
vec2 cLog(vec2 c)
{
return vec2( log( cAbs(c) ), cArg(c) );
}
float cArg(vec2 c)
{
return atan(c.y, c.x);
}
float cAbs(vec2 c)
{
return length(c);
}
vec2 cMul(vec2 a, vec2 b)
{
return vec2(a.x*b.x - a.y*b.y, a.x*b.y + a.y*b.x);
}
vec2 cDiv(vec2 a, vec2 b)
{
return cMul(a, cInv(b));
}
// float r1 = 0.1;
float r2 = 0.47;
vec2 Droste(vec2 uv, inout float id) {
float l = 1. - length(uv) * .5;
// float sint = sin(u_time*.001)*.5 + .5;
float sint = .025;
// sint = sin(u_time*.5)*.08;
float r1 = 0.1 + sint;
// 5. Take the tiled strips back to ordinary space.
uv = cLog(uv);
uv.x -= u_time;
// 4. Scale and rotate the strips
float scale = log(r2/r1);
float angle = atan(scale/(2.0*PI));
uv = cDiv(uv, cExp(vec2(0,angle))*cos(angle));
// 3. this simulates zooming in the tile
// uv -= u_time * 1.5;
uv.y -= u_time*0.5;
// uv.x -= u_time * .001;
// 2. Tile the strips
uv.x = mod(uv.x,log(r2/r1));
id = smoothstep(.15, .........完整代码请登录后点击上方下载按钮下载查看
网友评论0