webgl实现三维转轴时钟时间翻转动画效果代码

代码语言:html

所属分类:三维

代码描述:webgl实现三维转轴时钟时间翻转动画效果代码,显示的是当前的时间。

代码标签: webgl 三维 转轴 时钟 时间 翻转 动画

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

<!DOCTYPE html>
<html lang="en" >

<head>
  <meta charset="UTF-8">
  

  
  
  
<style>
html {
  height: 100%;
}
body {
  background: #333;
  overflow: hidden;
  padding: 0;
  margin: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
}
canvas {
  height: 100%;
  width: 100%;
}
</style>


  
  
</head>

<body translate="no">
  <canvas id="canvas"></canvas>
<!-- VertexShader code here -->
<script id="vertexShader" type="x-shader/x-vertex">#version 300 es
precision highp float;
  in vec4 position;
  void main() {
    gl_Position = vec4( position );
  }
</script>

<!-- FragmentShader code here -->
<script id="fragmentShader" type="x-shader/x-fragment">#version 300 es
#if __VERSION__ < 130
#define TEXTURE2D texture2D
#else
#define TEXTURE2D texture
#endif
precision highp float;
out vec4 fragColor;
uniform vec2 u_resolution;
uniform vec4 u_mouse;
uniform float u_time;
uniform float u_date;
  
#define R u_resolution
#define T u_time
#define M u_mouse

#define PI          3.14159265359
#define PI2         6.28318530718

#define MIN_DIST    1e-4
#define MAX_DIST    50.

/** 
    License: Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
    
    Dial Clock Concept
    
    Was kicking this around in my brain to make a clock shader. 
    The math is a little messy and there's some trick logic 
    around the hours to make the dials work.

*/

  // numbers from SDF Shape.........完整代码请登录后点击上方下载按钮下载查看

网友评论0