Skip to content

Instantly share code, notes, and snippets.

View patrickheng's full-sized avatar

Patrick HENG patrickheng

View GitHub Profile
@patrickheng
patrickheng / customease.glsl
Last active January 3, 2023 15:21
glsl snippets
// Tested on https://thebookofshaders.com/edit.php
// bezier function from https://www.shadertoy.com/view/sdjBRy
// if more control point needed : https://github.com/yiwenl/glsl-bezier-curve/blob/master/index.glsl
#ifdef GL_ES
precision mediump float;
#endif
uniform vec2 u_resolution;
@patrickheng
patrickheng / Damping
Last active November 19, 2019 11:27
Formula
current -= ( target + current ) * friction
current += ( target - current ) * friction
@patrickheng
patrickheng / fovProjection.js
Created December 29, 2018 23:47
Camera snippets
const frustumHeight = 2.0 * dist * Math.tan(camera.fov * 0.5 * (Math.PI / 180))
const frustumWidth = frustumHeight * aspect
@patrickheng
patrickheng / Angular spec
Created February 12, 2017 14:18
Github Release
feat: A new feature
fix: A bug fix
docs: Documentation only changes
style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
refactor: A code change that neither fixes a bug nor adds a feature
perf: A code change that improves performance
test: Adding missing or correcting existing tests
chore: Changes to the build process or auxiliary tools and libraries such as documentation generation
@patrickheng
patrickheng / bindFromArray.js
Created June 19, 2016 23:58
Javascript-class-snippets
[ 'method1', 'method2' ]
.forEach( ( fn ) => this[ fn ] = this[ fn ].bind( this ) );