@studiometa/js-toolkit
Version:
A set of useful little bits of JavaScript to boost your project! 🚀
18 lines (17 loc) • 665 B
TypeScript
/**
* @typedef {Object} Rect
* @property {number} x Rectangle's x position
* @property {number} y Rectangle's y position
* @property {number} width Rectangle's width
* @property {number} height Rectangle's height
*/
/**
* Test if a rectangle collides with another rectangle.
* Inspired by http://www.jeffreythompson.org/collision-detection/rect-rect.php
*
* @param {Rect} rect1 Rectangle 1
* @param {Rect} rect2 Rectangle 2
* @return {boolean} Are the sides of one rectangle touching the other ?
* @link https://js-toolkit.studiometa.dev/utils/collision/collideRectRect.html
*/
export declare function collideRectRect(rect1: any, rect2: any): boolean;