get-scale-from-info
Calculate the size and position of scaling (uniformly or not) on multiple axis' from any point. This works well for any system that calculates from the top or left, like your browser's dom!
Installation
Download node at nodejs.org and install it, if you haven't already.
npm install get-scale-from-info --save
Usage
// require modulelet getScaleFromInfo = // returns updated postion and dimensions// { size: [10, 2], position: [0, 4] } // returns updated postion (top left) and dimensions// { size: [2, 8], position: [2, -8] }
API
spec object parameters (required)
from: Array // The [x, y, z] position to scale fromscale: Array // The [multiplierX, multiplierY, multiplierZ] amount to scale from position listed above (scale can be non-uniform)size: Array // Current dimensions in [x, y, z] formatposition: Array // The current position in [x, y, z] format
returns
size: Array // The new (post-scale) [x, y] dimensionsposition: Array // The new (post-scale) [x, y] position
License
MIT