Skip to content

Instantly share code, notes, and snippets.

View baptistebriel's full-sized avatar

Baptiste Briel baptistebriel

View GitHub Profile
@mattdesl
mattdesl / color-glsl.js
Created March 2, 2015 03:18
ES6 tagged template strings for GLSL hex-to-vec3 http://tc39wiki.calculist.org/es6/template-strings/
import { getRgb } from 'color-string'
function glsl(strings, ...variables) {
variables = variables.map(v => {
var rgb = getRgb(v)
.map(x => x/255)
.slice(0, 3)
.join(', ')
return `vec3(${rgb})`
})
@lukehedger
lukehedger / ffmpeg-compress-mp4
Last active August 22, 2025 11:37
Compress mp4 using FFMPEG
$ ffmpeg -i input.mp4 -vcodec h264 -acodec mp2 output.mp4
@paulirish
paulirish / bling.js
Last active July 23, 2025 07:08
bling dot js
/* bling.js */
window.$ = document.querySelector.bind(document);
window.$$ = document.querySelectorAll.bind(document);
Node.prototype.on = window.on = function(name, fn) { this.addEventListener(name, fn); };
NodeList.prototype.__proto__ = Array.prototype;
NodeList.prototype.on = function(name, fn) { this.forEach((elem) => elem.on(name, fn)); };
@paulirish
paulirish / what-forces-layout.md
Last active August 21, 2025 20:11
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
fire();
setInterval(fire, 300);
setInterval(unfire, 500);
function fire() {
$('#can').trigger(TRUMP.main.events[0]);
}
@dmnsgn
dmnsgn / WebGL-WebGPU-frameworks-libraries.md
Last active August 20, 2025 11:34
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
@bendc
bendc / raf-boilerplate.js
Created August 28, 2017 13:52
rAF tutorial: boilerplate code
"use strict";
// animation utils
// ===============
const trackTime = id => {
const [entry] = performance.getEntriesByName(id);
if (!entry) {
performance.mark(id);
@mattdesl
mattdesl / about.md
Last active February 27, 2018 04:46
Texel + Saving Canvas PNG

Saving GIF/MP4 Frames with Texel

The above GIF was rendered with Canvas2D and JavaScript. I used texel, a tool I am developing but have not yet released.

If you want to try this very experimental tool, install the latest working version like so:

npm install [email protected] --global
@mattdesl
mattdesl / index.html
Created July 12, 2018 01:30
paint worklet + generative art (brute force circle packing demo)
<!doctype html>
<div id="sketch"></div>
<style>
body {
margin: 0;
overflow: hidden;
background: #383838;
}
#sketch {
@RenaudRohlinger
RenaudRohlinger / GsapTicker.jsx
Created September 8, 2022 06:15
Synchronize gsap and r3f raf loop
import React, { useEffect } from 'react'
import gsap from 'gsap'
import { useFrame } from '@react-three/fiber'
// sync gsap raf to r3f raf
gsap.ticker.remove(gsap.updateRoot)
export const GsapTicker = () => {
const pg = React.useRef(0)
gsap.ticker.remove(gsap.updateRoot)