Displaying a list of elements in a grid

Overview

Say you have an array of elements that you wish to display as a grid. The general formula for this would be:

var numColumns = Math.floor(viewport.width / itemWidth);
for(var i = 0; i <
Read more…

Convert Degrees to Radians And Vice Versa

// degrees -> radians
var radians = degrees * Math.PI / 180;
// radians -> degrees
var degrees = radians * 180 / Math.PI;
Read more…