Skip to content

Instantly share code, notes, and snippets.

export default class EventEmitter
{
constructor()
{
this.callbacks = {}
this.callbacks.base = {}
}
on(_names, callback)
{
@brunosimon
brunosimon / folio-2019-medium-article-floor.js
Last active November 13, 2019 18:00
Folio 2019 - Medium article - Floor
const topLeft = new THREE.Color(0x00ffff)
const topRight = new THREE.Color(0xffffff)
const bottomRight = new THREE.Color(0xff00ff)
const bottomLeft = new THREE.Color(0x0000ff)
const data = new Uint8Array([
Math.round(bottomLeft.r * 255), Math.round(bottomLeft.g * 255), Math.round(bottomLeft.b * 255),
Math.round(bottomRight.r * 255), Math.round(bottomRight.g * 255), Math.round(bottomRight.b * 255),
Math.round(topLeft.r * 255), Math.round(topLeft.g * 255), Math.round(topLeft.b * 255),
Math.round(topRight.r * 255), Math.round(topRight.g * 255), Math.round(topRight.b * 255)
@brunosimon
brunosimon / shader.glsl
Created October 1, 2019 08:52
Basic Three.js shaders
// Vertex
void main()
{
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
}
// Fragment
void main()
{
gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
# Unix (Terminal)
open -a "Google Chrome" --args --disable-gpu-vsync --disable-frame-rate-limit
# Windows (Command prompt)
start chrome --args --disable-gpu-vsync --disable-frame-rate-limit
@brunosimon
brunosimon / font-subset.txt
Last active May 29, 2019 09:32
Font subset
French:
!#$%&()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_abcdefghijklmnopqrstuvwxyz{|}~¢£¥¨©«®¸ÀÂÆÇÈÉÊËÎÏÔÙÛÜàâæçèéêëîïôùûüÿŒœŸˆ˚˜–—‚„…€™“”‘’ʼ`´'‹›«»"
English:
!#$%&()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_abcdefghijklmnopqrstuvwxyz{|}~¢£¥©®–—•…€™“”‘’ʼ`´'‹›«»"