webgl滤镜水彩过滤效果
代码语言:html
所属分类:动画
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <style> #container { width: 60vw; height: 33vw; display: block; position: absolute; top: 50%; left: 50%; -webkit-transform: translate(-50%, -50%); transform: translate(-50%, -50%); border: 7px solid rgba(255, 255, 255, 0.1); box-shadow: 0px 0px 10px #00000038; cursor: pointer; } .help { font-family: sans-serif; position: absolute; bottom: 10px; text-align: center; width: 100%; color: rgba(0, 0, 0, 0.4); } </style> </head> <body translate="no"> <script id="fragmentShader" type="x-shader/x-fragment"> varying vec2 vUv; uniform float dispFactor; uniform float dispFactor2; uniform float dispFactor3; uniform float dispFactor4; uniform float dispFactor5; uniform sampler2D map; uniform sampler2D map3; vec4 layer(vec4 foreground, vec4 background) { return foreground * foreground.a + background * (1.0 - foreground.a); } vec2 rotateUV(vec2 uv, float rotation) { float mid = 0.5; return vec2( cos(rotation) * (uv.x - mid) + sin(rotation) * (uv.y - mid) + mid, cos(rotation) * (uv.y - mid) - sin(rotation) * (uv.x - mid) + mid ); } void main() { vec4 color = vec4(0.0, 0.0, 0.0, 0.0); vec4 OG = texture2D(map, vUv); OG.a = 0.0; vec2 scaleCenter = vec2(0.5, 0.5); for(float i = 0.0; i < 10.0; i++) { // float rnd = random( st ); vec2 myUV = vUv; myUV = (myUV - scaleCenter) * ((i * 0.075)) + scaleCente.........完整代码请登录后点击上方下载按钮下载查看
网友评论0