Skip to content

Instantly share code, notes, and snippets.

View nrwinner's full-sized avatar
🏠
Working from home

Nick Winner nrwinner

🏠
Working from home
  • Baltimore, MD
  • 12:25 (UTC -04:00)
View GitHub Profile
@nrwinner
nrwinner / angle.js
Created June 10, 2018 15:03
Calculate width, height, and bottom position of rotated "angle" elements
let w = window.outerWidth;
let width = Math.ceil(w / Math.cos(ANGLE * Math.PI / 180));
let height = Math.ceil(w * Math.tan(ANGLE * Math.PI / 180));
let bottom = Math.floor((-1) * ((Math.tan(ANGLE * Math.PI / 180) * w) / 2));