Skip to content

Instantly share code, notes, and snippets.

View Jeremboo's full-sized avatar

Jérémie Boulay Jeremboo

View GitHub Profile
@Jeremboo
Jeremboo / 0 _ utils.math.js
Last active January 14, 2024 02:53
Useful functions on javascript es2015 : Geometry2D/3D, Math, Canvas, DOM, Color, Node...
/*******
* MATH
*******/
// http://stackoverflow.com/questions/1527803/generating-random-whole-numbers-in-javascript-in-a-specific-range
export const randInt(min, max) {
min = Math.ceil(min);
return Math.floor(Math.random() * (Math.floor(max) - min + 1)) + min;
}
export const randFloat = (min, max) => (Math.random() * (max - min) + min);
@Jeremboo
Jeremboo / Loop.js
Last active March 3, 2016 22:35
Loop class for canvas control and WebGL directed by Florian Zumbrunn - http://floz.fr/
class Loop {
constructor() {
this._idRAF = -1;
this._count = 0;
this._listeners = [];
this._binds = {};
this._binds.update = this._update.bind(this);
class SizeControl {
constructor() {
this._width = null;
this._height = null;
this._action = null;
this._onMobile = this._mobileCheck();
window.addEventListener('resize', this._onResize.bind(this), false);
window.addEventListener('orientationchange', this._onResize.bind(this), false);
@Jeremboo
Jeremboo / LetterTransition.js
Last active March 3, 2016 21:40
es2015 class for create transitions of text with each letters.
class LetterTransition {
constructor(element, style) {
this.element = element;
this.text = this.element.innerText;
this.element.innerText = '';
this.letters = [];
let i;
let key;
for (i = 0; i < this.text.length; i++) {
@Jeremboo
Jeremboo / MDBoo
Created June 23, 2015 21:20
My own CSS style for writing MarckDown syntax
h1,
h2,
h3,
h4,
h5,
h6,
p,
blockquote {
margin: 0;
padding: 0;