rebounds.js
Rectangle scaling functions.
Functions
rebounds.fit(space, rect, options = {positionX: 0.5, positionY: 0.5, reduce: true, expand: true})
alias: rebounds.showAll
Returns scaled rect
bounds to fit into space
.
rebounds;// => {width: 100, height: 25, x: 0, y: 37.5} rebounds;// => {width: 200, height: 50, x: -50, y: 25}
rebounds.fill(space, rect, options = {positionX: 0.5, positionY: 0.5, reduce: true, expand: true})
alias: rebounds.noBorder
Returns scaled rect
bounds to fill space
.
rebounds;// => {width: 400, height: 100, x: -150, y: 0} rebounds;// => {width: 200, height: 50, x: -50, y: 25}
rebounds.remain(space, rect, options = {positionX: 0.5, positionY: 0.5})
alias: rebounds.noScale
Returns non-scaled rect
bounds repositioned against space
.
rebounds;// => {width: 200, height: 50, x: -50, y: 25}
rebounds.stretch(space, rect, options = {positionX: 0.5, positionY: 0.5})
alias: rebounds.exactFit
Returns rect
bounds stretched into the same size with space
.
rebounds;// => {width: 100, height: 100, x: 0, y: 0}
rebounds.position(space, rect, options = {positionX: 0.5, positionY: 0.5})
Returns coordinates of rect
repositioned against space
.
rebounds;// => {x: -50, y: 25} rebounds;// => {x: 0, y: 75} rebounds;// => {x: 0, y: 50}