Skip to content

Instantly share code, notes, and snippets.

View marcbouchenoire's full-sized avatar

Marc Bouchenoire marcbouchenoire

View GitHub Profile
@rsms
rsms / imutil.ts
Created August 19, 2019 19:55
imutil
import { Vec, RGBA } from './util'
interface OffscreenCanvas extends EventTarget {
readonly width: number
readonly height: number
getContext(
contextId: "2d",
contextAttributes?: CanvasRenderingContext2DSettings
) :CanvasRenderingContext2D | null
@jonastreub
jonastreub / useGyro.ts
Created May 12, 2019 12:13
A hook making it fun to work with the gyroscope
import { useState, useEffect } from "react"
interface WorldOrientation {
/** A number representing the motion of the device around the z axis, expressed in degrees with values ranging from 0 to 360. */
alpha: number
/** A number representing the motion of the device around the x axis, expressed in degrees with values ranging from -180 to 180. This represents a front to back motion of the device. */
beta: number
/** A number representing the motion of the device around the y axis, expressed in degrees with values ranging from -90 to 90. This represents a left to right motion of the device. */
gamma: number
}
@jringrose
jringrose / InspectorButtonAttribute.cs
Last active June 1, 2018 00:37
A utility to open up temporary inspector windows to view objects. NewInspectorWindow.cs and InspectorButtonPropertyDrawer.cs should be inside an Editor folder.
using UnityEngine;
public class InspectorButtonAttribute : PropertyAttribute { }
@bendc
bendc / simulate-typing.js
Created September 1, 2017 08:57
Fake typing animation
const trackTime = timing => {
const now = performance.now();
if (!timing.startTime) timing.startTime = now;
const elapsed = now - timing.startTime;
const {duration} = timing;
if (duration != null && duration <= elapsed) timing.startTime = null;
return elapsed;
};
const delay = (callback, duration) => {
@bendc
bendc / easing.css
Created September 23, 2016 04:12
Easing CSS variables
:root {
--ease-in-quad: cubic-bezier(.55, .085, .68, .53);
--ease-in-cubic: cubic-bezier(.550, .055, .675, .19);
--ease-in-quart: cubic-bezier(.895, .03, .685, .22);
--ease-in-quint: cubic-bezier(.755, .05, .855, .06);
--ease-in-expo: cubic-bezier(.95, .05, .795, .035);
--ease-in-circ: cubic-bezier(.6, .04, .98, .335);
--ease-out-quad: cubic-bezier(.25, .46, .45, .94);
--ease-out-cubic: cubic-bezier(.215, .61, .355, 1);