PageSourceSearch

https://uberviz.io/viz/splice/lib/shaders/ShakeShader.js

js uberviz.io collected 2026-10-04 21:56:03 UTC 960 bytes, 56 lines download raw bytes

1/**
2 * @author felixturner / http://airtight.cc/
3 *
4 *	That ol' shakey cam
5 */
6
7THREE.ShakeShader = {
8
9	uniforms: {
10
11		"tDiffuse": { type: "t", value: null },
12		"time":     { type: "f", value: 0.0 },
13		"amount":  { type: "f", value: 0.05 } //max shake amount as fraction of screen size
14
15	},
16
17	vertexShader: [
18
19		"varying vec2 vUv;",
20
21		"void main() {",
22
23			"vUv = uv;",
24			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
25
26		"}"
27
28	].join("\n"),
29
30	fragmentShader: [
31
32		"uniform sampler2D tDiffuse;",
33		"uniform float time;",
34		"uniform float amount;",
35
36		"varying vec2 vUv;",
37
38		"float rand(vec2 co){",
39			"return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);",
40		"}",
41
42
43		"void main() {",
44
45			"vec2 p = vUv;",
46			"vec2 offset = vec2((rand(vec2(time,time)) - 0.5)*amount,(rand(vec2(time + 999.0,time + 999.0))- 0.5) *amount);",
47			"p += offset;",
48			"gl_FragColor = texture2D(tDiffuse, p);",
49
50
51
52		"}"
53
54	].join("\n")
55
56};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.