Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

moeSidani mhdSid

🎯
Focusing
  • Rakuten
  • Tokyo
View GitHub Profile
View fadeInAudioElementVolume.ts
public fadeInAudioElementVolume (start: number, end: number, duration: number, callback?: Function): void {
const delta: number = end - start;
let startTime: number = null;
let t: number;
let factor: number;
let frame: any;
const tweenLoop: FrameRequestCallback = (time?: number) => {
if (!time) {
time = new Date().getTime();
}
@mhdSid
mhdSid / arrayIterator.ts
Last active Nov 11, 2018
Simple & Generic Way to Iterate Backwards & Forwards through an Array
View arrayIterator.ts
public iterateBackwards (arrayLength: number, index: number): number {
return index = (index <= 0) ? arrayLength - 1 : --index, index;
}
public iterateForwards (arrayLength: number, index: number): number {
return index = (index >= arrayLength - 1) ? 0 : ++index, index;
}
/*
* Usage
You can’t perform that action at this time.