Skip to content

Instantly share code, notes, and snippets.

@sroucheray
sroucheray / README.md
Last active December 11, 2015 15:08
A requestAnimationFrame like API which makes its best to maintain a specific framerate
@patriciogonzalezvivo
patriciogonzalezvivo / GLSL-Noise.md
Last active May 5, 2024 09:04
GLSL Noise Algorithms

Please consider using http://lygia.xyz instead of copy/pasting this functions. It expand suport for voronoi, voronoise, fbm, noise, worley, noise, derivatives and much more, through simple file dependencies. Take a look to https://github.com/patriciogonzalezvivo/lygia/tree/main/generative

Generic 1,2,3 Noise

float rand(float n){return fract(sin(n) * 43758.5453123);}

float noise(float p){
	float fl = floor(p);
  float fc = fract(p);
@floz
floz / gist:53ad2765cc846187cdd3
Created December 18, 2014 18:47
PhotoshopMath.glsl
/*
** Copyright (c) 2012, Romain Dura romain@shazbits.com
**
** Permission to use, copy, modify, and/or distribute this software for any
** purpose with or without fee is hereby granted, provided that the above
** copyright notice and this permission notice appear in all copies.
**
** THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
** WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
** MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
<svg version="1.1" xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
<path id="svg" fill="#5DD7FC" d="M0.5,262.094c0,0,52.172,79.049,158.323,77.241c68.433-2.031,165.549-32.296,191.523-132.123
c0,0,27.893,4.742,47.654-16.939c-26.99,3.727-44.944-4.743-44.944-4.743s35.346-1.017,43.137-21.908
c-20.89,9.035-46.751,1.355-46.751,1.355S337.245,90.22,262.939,87.51c0,0,39.713-8.093,33.502-17.24
c-4.968-6.663-32.597,5.722-32.597,5.722s15.396-6.776,15.057-14.003c-15.584,1.806-29.888,13.325-29.888,13.325
s4.365-7.001,4.44-9.937c-37.114,20.628-62.334,97.455-62.334,97.455s-9.411-10.427-25.07-21.72
C128.257,118.829,58.544,92.479,58.544,92.479s-4.668,28.759,32.522,49.838c-15.207,1.205-22.886,3.162-22.886,3.162
@protrolium
protrolium / ffmpeg.md
Last active May 3, 2024 18:58
ffmpeg guide

ffmpeg

Converting Audio into Different Formats / Sample Rates

Minimal example: transcode from MP3 to WMA:
ffmpeg -i input.mp3 output.wma

You can get the list of supported formats with:
ffmpeg -formats

You can get the list of installed codecs with:

@gordonbrander
gordonbrander / boing.js
Last active November 6, 2022 09:20
boing.js - minimal 2D spring physics
export const Spring = (x, y, mass, stiffness, viscosity) => ({
prevX: x,
prevY: y,
currX: x,
currY: y,
mass, stiffness, viscosity
});
Spring.copy = (spring) => ({
prevX: spring.prevX,
@ayamflow
ayamflow / gist:b602ab436ac9f05660d9c15190f4fd7b
Created May 9, 2016 19:10
Safari border-radius + overflow: hidden + CSS transform fix
// Add on element with overflow
-webkit-mask-image: -webkit-radial-gradient(white, black);
@roboshoes
roboshoes / tween.js
Last active January 25, 2018 18:19
Small tweening function for the quick tween.
export function tween( time, update ) {
const start = Date.now();
var isCanceled = false;
var isComplete = false;
var chain = [];
function loop() {
if ( isCanceled ) return;
@dmnsgn
dmnsgn / WebGL-WebGPU-frameworks-libraries.md
Last active May 5, 2024 16:18
A collection of WebGL and WebGPU frameworks and libraries

A non-exhaustive list of WebGL and WebGPU frameworks and libraries. It is mostly for learning purposes as some of the libraries listed are wip/outdated/not maintained anymore.

Engines and libraries ⚙️

Name Stars Last Commit Description
three.js ![GitHub
@ayamflow
ayamflow / gist:96a1f554c3f88eef2f9d0024fc42940f
Last active March 20, 2024 02:48
Threejs Fit plane to screen
var cameraZ = camera.position.z;
var planeZ = 5;
var distance = cameraZ - planeZ;
var aspect = viewWidth / viewHeight;
var vFov = camera.fov * Math.PI / 180;
var planeHeightAtDistance = 2 * Math.tan(vFov / 2) * distance;
var planeWidthAtDistance = planeHeightAtDistance * aspect;
// or