Repository: akella/DistortedPixels
Branch: master
Commit: 807e5497d9da
Files: 13
Total size: 23.3 KB
Directory structure:
gitextract_av4_h_8l/
├── .gitignore
├── LICENSE
├── README.md
├── css/
│ └── base.css
├── index.html
├── index2.html
├── index3.html
├── index4.html
├── js/
│ ├── app.js
│ └── shader/
│ ├── fragment.glsl
│ ├── vertex.glsl
│ └── vertexParticles.glsl
└── package.json
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitignore
================================================
node_modules
.cache
.parcel-cache
package-lock.json
dist/
================================================
FILE: LICENSE
================================================
MIT License
Copyright (c) 2009 - 2021 [Codrops](https://tympanus.net/codrops)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
================================================
FILE: README.md
================================================
# Distorted Pixels
Distorting pixels with DataTexture, based on [Infinite Bad Guy website](https://billie.withyoutube.com/)

[Article on Codrops](https://tympanus.net/codrops/?p=)
[Demo](http://tympanus.net/Development/DistortedPixels/)
## Installation
Install dependencies:
```
npm install
```
Compile the code for development and start a local server:
```
npx parcel index.html
```
Create the build:
```
npx parcel build index.html
```
## Credits
- Images from [Unsplash](https://unsplash.com/)
## Misc
Follow Codrops: [Twitter](http://www.twitter.com/codrops), [Facebook](http://www.facebook.com/codrops), [GitHub](https://github.com/codrops), [Instagram](https://www.instagram.com/codropsss/)
## License
[MIT](LICENSE)
Made with :blue_heart: by [Codrops](http://www.codrops.com)
================================================
FILE: css/base.css
================================================
*,
*::after,
*::before {
box-sizing: border-box;
}
:root {
font-size: 18px;
}
body {
margin: 0;
--color-text: #fff;
--color-bg: #000;
--color-link: #c63643;
--color-link-hover: #fff;
color: var(--color-text);
background-color: var(--color-bg);
font-family: mono45-headline, monospace;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.demo-2 {
--color-link: #b95e5d;
}
.demo-3 {
--color-link: #f7bcac;
}
.demo-4 {
--color-link: #bf8b5b;
}
.lil-gui {
visibility: hidden;
}
.demo-4 .lil-gui {
visibility: visible;
}
/* Page Loader */
.js .loading::before,
.js .loading::after {
content: '';
position: fixed;
z-index: 1000;
}
.js .loading::before {
top: 0;
left: 0;
width: 100%;
height: 100%;
background: var(--color-bg);
}
.js .loading::after {
top: 50%;
left: 50%;
width: 60px;
height: 60px;
margin: -30px 0 0 -30px;
border-radius: 50%;
opacity: 0.4;
background: var(--color-link);
animation: loaderAnim 0.7s linear infinite alternate forwards;
}
@keyframes loaderAnim {
to {
opacity: 1;
transform: scale3d(0.5,0.5,1);
}
}
a {
text-decoration: none;
color: var(--color-link);
outline: none;
}
a:hover {
color: var(--color-link-hover);
outline: none;
}
/* Better focus styles from https://developer.mozilla.org/en-US/docs/Web/CSS/:focus-visible */
a:focus {
/* Provide a fallback style for browsers
that don't support :focus-visible */
outline: none;
background: lightgrey;
}
a:focus:not(:focus-visible) {
/* Remove the focus indicator on mouse-focus for browsers
that do support :focus-visible */
background: transparent;
}
a:focus-visible {
/* Draw a very noticeable focus style for
keyboard-focus on browsers that do support
:focus-visible */
outline: 2px solid red;
background: transparent;
}
.unbutton {
background: none;
border: 0;
padding: 0;
margin: 0;
font: inherit;
}
.unbutton:focus {
outline: none;
}
.frame {
padding: 3rem 5vw;
text-align: center;
position: relative;
z-index: 1000;
}
.frame__title {
font-size: 1rem;
margin: 0 0 1rem;
font-weight: normal;
}
.frame__links {
display: inline;
}
.frame__links a:not(:last-child),
.frame__demos a:not(:last-child) {
margin-right: 1rem;
}
.frame__demos {
margin: 1rem 0;
}
.frame__demo--current,
.frame__demo--current:hover {
color: var(--color-text);
}
.content {
display: grid;
width: 100vw;
height: calc(100vh - 13rem);
position: relative;
padding: 3rem;
}
.content__title {
font-family: mono45-headline, monospace;
font-size: 13vw;
line-height: 1;
color: #fff;
max-width: 50vw;
font-weight: 400;
margin: 0;
align-self: center;
pointer-events: none;
}
.content__title--centered {
text-align: center;
justify-self: center;
}
.content__title--style-1 {
font-family: new-order, sans-serif;
font-weight: 400;
font-size: 10vw;
line-height: 0.85;
background: linear-gradient(90deg, #e9a680 0%,#992d46 50%, #064cb5 100%);;
background-size: cover;
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
text-fill-color: transparent;
}
.content__title--style-2 {
font-family: bely-display, serif;
font-weight: 400;
font-size: 10vw;
opacity: 0.7;
line-height: 0.8;
}
@media screen and (min-width: 53em) {
.frame {
position: fixed;
text-align: left;
z-index: 100;
top: 0;
left: 0;
display: grid;
align-content: space-between;
width: 100%;
max-width: none;
height: 100vh;
padding: 1.5rem 3.35rem;
pointer-events: none;
grid-template-columns: auto 1fr;
grid-template-rows: auto auto auto;
grid-template-areas: 'title ...'
'... ...'
'links demos';
}
.frame__title-wrap {
grid-area: title;
display: flex;
}
.frame__title {
margin: 0;
}
.frame__tagline {
position: relative;
margin: 0 0 0 0.25rem;
padding: 0 0 0 1rem;
opacity: 0.5;
}
.frame__demos {
margin: 0;
grid-area: demos;
justify-self: end;
}
.frame__links {
grid-area: links;
padding: 0;
justify-self: start;
}
.frame a {
pointer-events: auto;
}
.content {
height: 100vh;
}
}
#canvasContainer{
position: fixed;
top: 0;
left: 0;
z-index: -1;
width: 100%;
height: 100%;
}
#canvasContainer img{
visibility: hidden;
pointer-events: none;
position: absolute;
}
================================================
FILE: index.html
================================================
<!DOCTYPE html>
<html lang="en" class="no-js">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Pixel Distortion with Three.js | Demo 1 | Codrops</title>
<meta name="description" content="An interactive pixel distortion effect made with Three.js " />
<meta name="keywords" content="webgl, three.js, pixel, distortion, pixelated, javascript" />
<meta name="author" content="Codrops" />
<link rel="shortcut icon" href="favicon.ico">
<link rel="stylesheet" href="https://use.typekit.net/oxr3hup.css">
<link rel="stylesheet" type="text/css" href="css/base.css" />
<script>document.documentElement.className="js";var supportsCssVars=function(){var e,t=document.createElement("style");return t.innerHTML="root: { --tmp-var: bold; }",document.head.appendChild(t),e=!!(window.CSS&&window.CSS.supports&&window.CSS.supports("font-weight","var(--tmp-var)")),t.parentNode.removeChild(t),e};supportsCssVars()||alert("Please view this demo in a modern browser that supports CSS Variables.");</script>
<script src="//tympanus.net/codrops/adpacks/analytics.js"></script>
</head>
<body class="demo-1">
<main>
<div class="frame">
<div class="frame__title-wrap">
<h1 class="frame__title">Pixel Distortion</h1>
<p class="frame__tagline">with Three.js</p>
</div>
<nav class="frame__links">
<a href="https://tympanus.net/Development/ColumnScroll/">Previous demo</a>
<a href="https://tympanus.net/codrops/?p=58318">Article</a>
<a href="https://github.com/akella/DistortedPixels">GitHub</a>
</nav>
<nav class="frame__demos">
<a href="index.html" class="frame__demo frame__demo--current">demo 1</a>
<a href="index2.html" class="frame__demo">demo 2</a>
<a href="index3.html" class="frame__demo">demo 3</a>
<a href="index4.html" class="frame__demo">demo 4</a>
</nav>
</div>
<div id="canvasContainer"
data-grid="50"
data-mouse="0.25"
data-strength="0.11"
>
<img src="img/1.jpg" alt="">
</div>
<div class="content">
<h2 class="content__title">We distort realities</h2>
</div>
</main>
<script src="https://tympanus.net/codrops/adpacks/cda.js"></script>
<script type="module" src="js/app.js"></script>
</body>
</html>
================================================
FILE: index2.html
================================================
<!DOCTYPE html>
<html lang="en" class="no-js">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Pixel Distortion with Three.js | Demo 2 | Codrops</title>
<meta name="description" content="An interactive pixel distortion effect made with Three.js " />
<meta name="keywords" content="webgl, three.js, pixel, distortion, pixelated, javascript" />
<meta name="author" content="Codrops" />
<link rel="shortcut icon" href="favicon.ico">
<link rel="stylesheet" href="https://use.typekit.net/oxr3hup.css">
<link rel="stylesheet" type="text/css" href="css/base.css" />
<script>document.documentElement.className="js";var supportsCssVars=function(){var e,t=document.createElement("style");return t.innerHTML="root: { --tmp-var: bold; }",document.head.appendChild(t),e=!!(window.CSS&&window.CSS.supports&&window.CSS.supports("font-weight","var(--tmp-var)")),t.parentNode.removeChild(t),e};supportsCssVars()||alert("Please view this demo in a modern browser that supports CSS Variables.");</script>
<script src="//tympanus.net/codrops/adpacks/analytics.js"></script>
</head>
<body class="demo-2">
<main>
<div class="frame">
<div class="frame__title-wrap">
<h1 class="frame__title">Pixel Distortion</h1>
<p class="frame__tagline">with Three.js</p>
</div>
<nav class="frame__links">
<a href="https://tympanus.net/Development/ColumnScroll/">Previous demo</a>
<a href="https://tympanus.net/codrops/?p=58318">Article</a>
<a href="https://github.com/akella/DistortedPixels">GitHub</a>
</nav>
<nav class="frame__demos">
<a href="index.html" class="frame__demo ">demo 1</a>
<a href="index2.html" class="frame__demo frame__demo--current">demo 2</a>
<a href="index3.html" class="frame__demo">demo 3</a>
<a href="index4.html" class="frame__demo">demo 4</a>
</nav>
</div>
<div id="canvasContainer"
data-grid="607"
data-mouse="0.11"
data-strength="0.36"
data-relaxation="0.96"
>
<img src="img/2.jpg" alt="">
</div>
<div class="content">
<h2 class="content__title content__title--centered content__title--style-1">Fungible Love</h2>
</div>
</main>
<script src="https://tympanus.net/codrops/adpacks/cda.js"></script>
<script type="module" src="js/app.js"></script>
</body>
</html>
================================================
FILE: index3.html
================================================
<!DOCTYPE html>
<html lang="en" class="no-js">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Pixel Distortion with Three.js | Demo 3 | Codrops</title>
<meta name="description" content="An interactive pixel distortion effect made with Three.js " />
<meta name="keywords" content="webgl, three.js, pixel, distortion, pixelated, javascript" />
<meta name="author" content="Codrops" />
<link rel="shortcut icon" href="favicon.ico">
<link rel="stylesheet" href="https://use.typekit.net/oxr3hup.css">
<link rel="stylesheet" type="text/css" href="css/base.css" />
<script>document.documentElement.className="js";var supportsCssVars=function(){var e,t=document.createElement("style");return t.innerHTML="root: { --tmp-var: bold; }",document.head.appendChild(t),e=!!(window.CSS&&window.CSS.supports&&window.CSS.supports("font-weight","var(--tmp-var)")),t.parentNode.removeChild(t),e};supportsCssVars()||alert("Please view this demo in a modern browser that supports CSS Variables.");</script>
<script src="//tympanus.net/codrops/adpacks/analytics.js"></script>
</head>
<body class="demo-3">
<main>
<div class="frame">
<div class="frame__title-wrap">
<h1 class="frame__title">Pixel Distortion</h1>
<p class="frame__tagline">with Three.js</p>
</div>
<nav class="frame__links">
<a href="https://tympanus.net/Development/ColumnScroll/">Previous demo</a>
<a href="https://tympanus.net/codrops/?p=58318">Article</a>
<a href="https://github.com/akella/DistortedPixels">GitHub</a>
</nav>
<nav class="frame__demos">
<a href="index.html" class="frame__demo ">demo 1</a>
<a href="index2.html" class="frame__demo">demo 2</a>
<a href="index3.html" class="frame__demo frame__demo--current">demo 3</a>
<a href="index4.html" class="frame__demo">demo 4</a>
</nav>
</div>
<div id="canvasContainer"
data-grid="15"
data-mouse="0.13"
data-strength="0.15"
>
<img src="img/3.jpg" alt="">
</div>
<div class="content">
<h2 class="content__title content__title--centered content__title--style-2">Cold Storage</h2>
</div>
</main>
<script src="https://tympanus.net/codrops/adpacks/cda.js"></script>
<script type="module" src="js/app.js"></script>
</body>
</html>
================================================
FILE: index4.html
================================================
<!DOCTYPE html>
<html lang="en" class="no-js">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Pixel Distortion with Three.js | Demo 4 | Codrops</title>
<meta name="description" content="An interactive pixel distortion effect made with Three.js " />
<meta name="keywords" content="webgl, three.js, pixel, distortion, pixelated, javascript" />
<meta name="author" content="Codrops" />
<link rel="shortcut icon" href="favicon.ico">
<link rel="stylesheet" href="https://use.typekit.net/oxr3hup.css">
<link rel="stylesheet" type="text/css" href="css/base.css" />
<script>document.documentElement.className="js";var supportsCssVars=function(){var e,t=document.createElement("style");return t.innerHTML="root: { --tmp-var: bold; }",document.head.appendChild(t),e=!!(window.CSS&&window.CSS.supports&&window.CSS.supports("font-weight","var(--tmp-var)")),t.parentNode.removeChild(t),e};supportsCssVars()||alert("Please view this demo in a modern browser that supports CSS Variables.");</script>
<script src="//tympanus.net/codrops/adpacks/analytics.js"></script>
</head>
<body class="demo-4">
<main>
<div class="frame">
<div class="frame__title-wrap">
<h1 class="frame__title">Pixel Distortion</h1>
<p class="frame__tagline">with Three.js</p>
</div>
<nav class="frame__links">
<a href="https://tympanus.net/Development/ColumnScroll/">Previous demo</a>
<a href="https://tympanus.net/codrops/?p=58318">Article</a>
<a href="https://github.com/akella/DistortedPixels">GitHub</a>
</nav>
<nav class="frame__demos">
<a href="index.html" class="frame__demo ">demo 1</a>
<a href="index2.html" class="frame__demo">demo 2</a>
<a href="index3.html" class="frame__demo">demo 3</a>
<a href="index4.html" class="frame__demo frame__demo--current">demo 4</a>
</nav>
</div>
<div id="canvasContainer"
data-grid="15"
data-mouse="0.13"
data-strength="0.15"
>
<img src="img/4.jpg" alt="">
</div>
</main>
<script src="https://tympanus.net/codrops/adpacks/cda.js"></script>
<script type="module" src="js/app.js"></script>
</body>
</html>
================================================
FILE: js/app.js
================================================
import * as THREE from "three";
import fragment from "./shader/fragment.glsl";
import vertex from "./shader/vertex.glsl";
import GUI from "lil-gui";
function clamp(number, min, max) {
return Math.max(min, Math.min(number, max));
}
export default class Sketch {
constructor(options) {
this.scene = new THREE.Scene();
this.container = options.dom;
this.img = this.container.querySelector('img')
this.width = this.container.offsetWidth;
this.height = this.container.offsetHeight;
this.renderer = new THREE.WebGLRenderer();
this.renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2))
this.renderer.setSize(this.width, this.height);
this.renderer.setClearColor(0xeeeeee, 1);
this.renderer.physicallyCorrectLights = true;
this.renderer.outputEncoding = THREE.sRGBEncoding;
this.container.appendChild(this.renderer.domElement);
this.camera = new THREE.PerspectiveCamera(
70,
window.innerWidth / window.innerHeight,
0.1,
100
);
var frustumSize = 1;
var aspect = window.innerWidth / window.innerHeight;
this.camera = new THREE.OrthographicCamera(frustumSize / -2, frustumSize / 2, frustumSize / 2, frustumSize / -2, -1000, 1000);
this.camera.position.set(0, 0, 2);
this.time = 0;
this.mouse = {
x: 0,
y: 0,
prevX: 0,
prevY: 0,
vX: 0,
vY: 0
}
this.isPlaying = true;
this.settings();
this.addObjects();
this.resize();
this.render();
this.setupResize();
this.mouseEvents()
}
getValue(val){
return parseFloat(this.container.getAttribute('data-'+val))
}
mouseEvents() {
window.addEventListener('mousemove', (e) => {
this.mouse.x = e.clientX / this.width;
this.mouse.y = e.clientY / this.height;
// console.log(this.mouse.x,this.mouse.y)
this.mouse.vX = this.mouse.x - this.mouse.prevX;
this.mouse.vY = this.mouse.y - this.mouse.prevY;
this.mouse.prevX = this.mouse.x
this.mouse.prevY = this.mouse.y;
// console.log(this.mouse.vX,'vx')
})
}
settings() {
let that = this;
this.settings = {
grid: this.getValue('grid')||34,
mouse: this.getValue('mouse')||0.25,
strength: this.getValue('strength')||1,
relaxation: this.getValue('relaxation')||0.9,
};
this.gui = new GUI();
this.gui.add(this.settings, "grid", 2, 1000, 1).onFinishChange(() => {
this.regenerateGrid()
});
this.gui.add(this.settings, "mouse", 0, 1, 0.01);
this.gui.add(this.settings, "strength", 0, 1, 0.01);
this.gui.add(this.settings, "relaxation", 0, 1, 0.01);
}
setupResize() {
window.addEventListener("resize", this.resize.bind(this));
}
resize() {
this.width = this.container.offsetWidth;
this.height = this.container.offsetHeight;
this.renderer.setSize(this.width, this.height);
this.camera.aspect = this.width / this.height;
// image cover
this.imageAspect = 1. / 1.5;
let a1;
let a2;
if (this.height / this.width > this.imageAspect) {
a1 = (this.width / this.height) * this.imageAspect;
a2 = 1;
} else {
a1 = 1;
a2 = (this.height / this.width) / this.imageAspect;
}
this.material.uniforms.resolution.value.x = this.width;
this.material.uniforms.resolution.value.y = this.height;
this.material.uniforms.resolution.value.z = a1;
this.material.uniforms.resolution.value.w = a2;
this.camera.updateProjectionMatrix();
this.regenerateGrid()
}
regenerateGrid() {
this.size = this.settings.grid;
const width = this.size;
const height = this.size;
const size = width * height;
const data = new Float32Array(3 * size);
const color = new THREE.Color(0xffffff);
const r = Math.floor(color.r * 255);
const g = Math.floor(color.g * 255);
const b = Math.floor(color.b * 255);
for (let i = 0; i < size; i++) {
let r = Math.random() * 255 - 125;
let r1 = Math.random() * 255 - 125;
const stride = i * 3;
data[stride] = r;
data[stride + 1] = r1;
data[stride + 2] = r;
}
// used the buffer to create a DataTexture
this.texture = new THREE.DataTexture(data, width, height, THREE.RGBFormat, THREE.FloatType);
this.texture.magFilter = this.texture.minFilter = THREE.NearestFilter;
if (this.material) {
this.material.uniforms.uDataTexture.value = this.texture;
this.material.uniforms.uDataTexture.value.needsUpdate = true;
}
}
addObjects() {
this.regenerateGrid()
let texture = new THREE.Texture(this.img)
texture.needsUpdate = true;
this.material = new THREE.ShaderMaterial({
extensions: {
derivatives: "#extension GL_OES_standard_derivatives : enable"
},
side: THREE.DoubleSide,
uniforms: {
time: {
value: 0
},
resolution: {
value: new THREE.Vector4()
},
uTexture: {
value: texture
},
uDataTexture: {
value: this.texture
},
},
vertexShader: vertex,
fragmentShader: fragment
});
this.geometry = new THREE.PlaneGeometry(1, 1, 1, 1);
this.plane = new THREE.Mesh(this.geometry, this.material);
this.scene.add(this.plane);
}
updateDataTexture() {
let data = this.texture.image.data;
for (let i = 0; i < data.length; i += 3) {
data[i] *= this.settings.relaxation
data[i + 1] *= this.settings.relaxation
}
let gridMouseX = this.size * this.mouse.x;
let gridMouseY = this.size * (1 - this.mouse.y);
let maxDist = this.size * this.settings.mouse;
let aspect = this.height / this.width
for (let i = 0; i < this.size; i++) {
for (let j = 0; j < this.size; j++) {
let distance = ((gridMouseX - i) ** 2) / aspect + (gridMouseY - j) ** 2
let maxDistSq = maxDist ** 2;
if (distance < maxDistSq) {
let index = 3 * (i + this.size * j);
let power = maxDist / Math.sqrt(distance);
power = clamp(power, 0, 10)
// if(distance <this.size/32) power = 1;
// power = 1;
data[index] += this.settings.strength * 100 * this.mouse.vX * power;
data[index + 1] -= this.settings.strength * 100 * this.mouse.vY * power;
}
}
}
this.mouse.vX *= 0.9;
this.mouse.vY *= 0.9;
this.texture.needsUpdate = true
}
render() {
if (!this.isPlaying) return;
this.time += 0.05;
this.updateDataTexture()
this.material.uniforms.time.value = this.time;
requestAnimationFrame(this.render.bind(this));
this.renderer.render(this.scene, this.camera);
}
}
new Sketch({
dom: document.getElementById("canvasContainer")
});
================================================
FILE: js/shader/fragment.glsl
================================================
uniform float time;
uniform float progress;
uniform sampler2D uDataTexture;
uniform sampler2D uTexture;
uniform vec4 resolution;
varying vec2 vUv;
varying vec3 vPosition;
float PI = 3.141592653589793238;
void main() {
vec2 newUV = (vUv - vec2(0.5))*resolution.zw + vec2(0.5);
vec4 color = texture2D(uTexture,newUV);
vec4 offset = texture2D(uDataTexture,vUv);
gl_FragColor = vec4(vUv,0.0,1.);
gl_FragColor = vec4(offset.r,0.,0.,1.);
gl_FragColor = color;
gl_FragColor = texture2D(uTexture,newUV - 0.02*offset.rg);
// gl_FragColor = offset;
}
================================================
FILE: js/shader/vertex.glsl
================================================
uniform float time;
varying vec2 vUv;
varying vec3 vPosition;
uniform vec2 pixels;
float PI = 3.141592653589793238;
void main() {
vUv = uv;
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
}
================================================
FILE: js/shader/vertexParticles.glsl
================================================
uniform float time;
varying vec2 vUv;
varying vec3 vPosition;
uniform sampler2D texture1;
float PI = 3.141592653589793238;
void main() {
vUv = uv;
vec4 mvPosition = modelViewMatrix * vec4( position, 1. );
gl_PointSize = 1000. * ( 1. / - mvPosition.z );
gl_Position = projectionMatrix * mvPosition;
}
================================================
FILE: package.json
================================================
{
"dependencies": {
"dat.gui": "^0.7.7",
"lil-gui": "^0.16.0",
"three": "^0.136.0"
},
"devDependencies": {
"@parcel/transformer-glsl": "^2.1.1",
"glslify-bundle": "^5.1.1",
"glslify-deps": "^1.3.2"
}
}
gitextract_av4_h_8l/ ├── .gitignore ├── LICENSE ├── README.md ├── css/ │ └── base.css ├── index.html ├── index2.html ├── index3.html ├── index4.html ├── js/ │ ├── app.js │ └── shader/ │ ├── fragment.glsl │ ├── vertex.glsl │ └── vertexParticles.glsl └── package.json
SYMBOL INDEX (12 symbols across 1 files)
FILE: js/app.js
function clamp (line 6) | function clamp(number, min, max) {
class Sketch (line 10) | class Sketch {
method constructor (line 11) | constructor(options) {
method getValue (line 61) | getValue(val){
method mouseEvents (line 66) | mouseEvents() {
method settings (line 85) | settings() {
method setupResize (line 105) | setupResize() {
method resize (line 109) | resize() {
method regenerateGrid (line 139) | regenerateGrid() {
method addObjects (line 177) | addObjects() {
method updateDataTexture (line 212) | updateDataTexture() {
method render (line 252) | render() {
Condensed preview — 13 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (27K chars).
[
{
"path": ".gitignore",
"chars": 58,
"preview": "node_modules\n.cache\n.parcel-cache\npackage-lock.json\ndist/\n"
},
{
"path": "LICENSE",
"chars": 1103,
"preview": "MIT License\n\nCopyright (c) 2009 - 2021 [Codrops](https://tympanus.net/codrops)\n\nPermission is hereby granted, free of ch"
},
{
"path": "README.md",
"chars": 903,
"preview": "# Distorted Pixels\n\nDistorting pixels with DataTexture, based on [Infinite Bad Guy website](https://billie.withyoutube.c"
},
{
"path": "css/base.css",
"chars": 4542,
"preview": "*,\r\n*::after,\r\n*::before {\r\n\tbox-sizing: border-box;\r\n}\r\n\r\n:root {\r\n\tfont-size: 18px;\r\n}\r\n\r\nbody {\r\n\tmargin: 0;\r\n\t--colo"
},
{
"path": "index.html",
"chars": 2290,
"preview": "<!DOCTYPE html>\n<html lang=\"en\" class=\"no-js\">\n\t<head>\n\t\t<meta charset=\"UTF-8\" />\n\t\t<meta name=\"viewport\" content=\"width"
},
{
"path": "index2.html",
"chars": 2361,
"preview": "<!DOCTYPE html>\n<html lang=\"en\" class=\"no-js\">\n\t<head>\n\t\t<meta charset=\"UTF-8\" />\n\t\t<meta name=\"viewport\" content=\"width"
},
{
"path": "index3.html",
"chars": 2332,
"preview": "<!DOCTYPE html>\n<html lang=\"en\" class=\"no-js\">\n\t<head>\n\t\t<meta charset=\"UTF-8\" />\n\t\t<meta name=\"viewport\" content=\"width"
},
{
"path": "index4.html",
"chars": 2199,
"preview": "<!DOCTYPE html>\n<html lang=\"en\" class=\"no-js\">\n\t<head>\n\t\t<meta charset=\"UTF-8\" />\n\t\t<meta name=\"viewport\" content=\"width"
},
{
"path": "js/app.js",
"chars": 6800,
"preview": "import * as THREE from \"three\";\nimport fragment from \"./shader/fragment.glsl\";\nimport vertex from \"./shader/vertex.glsl\""
},
{
"path": "js/shader/fragment.glsl",
"chars": 551,
"preview": "uniform float time;\nuniform float progress;\nuniform sampler2D uDataTexture;\nuniform sampler2D uTexture;\n\n\nuniform vec4 r"
},
{
"path": "js/shader/vertex.glsl",
"chars": 219,
"preview": "uniform float time;\nvarying vec2 vUv;\nvarying vec3 vPosition;\nuniform vec2 pixels;\nfloat PI = 3.141592653589793238;\nvoid"
},
{
"path": "js/shader/vertexParticles.glsl",
"chars": 307,
"preview": "uniform float time;\nvarying vec2 vUv;\nvarying vec3 vPosition;\nuniform sampler2D texture1;\nfloat PI = 3.14159265358979323"
},
{
"path": "package.json",
"chars": 234,
"preview": "{\n \"dependencies\": {\n \"dat.gui\": \"^0.7.7\",\n \"lil-gui\": \"^0.16.0\",\n \"three\": \"^0.136.0\"\n },\n \"devDependencies"
}
]
About this extraction
This page contains the full source code of the akella/DistortedPixels GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 13 files (23.3 KB), approximately 7.2k tokens, and a symbol index with 12 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.