Skip to content

Instantly share code, notes, and snippets.

@w3Serif
w3Serif / isItemWithinRanges.js
Last active December 8, 2019 17:58
check for number element within range
/**
* Usage:
* let set = [[0,45], [135,225], [315, 360]]; // or simple array: [0,45]
* let isvalwithin = isItemWithinRanges(35, set); // [0, 45]
* isvalwithin = isItemWithinRanges(65, set); // false
*
* @param val {number}
* @param range {Array}
* @returns {Boolean|Array}
*/
@w3Serif
w3Serif / easing.js
Last active December 19, 2019 06:32 — forked from gre/easing.js
Simple Easing Functions in Javascript - see https://github.com/gre/bezier-easing
/*
* Easing Functions - inspired from http://gizma.com/easing/
* only considering the t value for the range [0, 1] => [0, 1]
*/
EasingFunctions = {
// no easing, no acceleration
linear: function (t) { return t },
// accelerating from zero velocity
easeInQuad: function (t) { return t*t },
// decelerating to zero velocity