https://github.com/math2001/rectjs
Rect heavily inspired by the pygame's Rect (python)
https://github.com/math2001/rectjs
Last synced: 12 months ago
JSON representation
Rect heavily inspired by the pygame's Rect (python)
- Host: GitHub
- URL: https://github.com/math2001/rectjs
- Owner: math2001
- Created: 2016-12-20T07:49:52.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-12-23T23:32:35.000Z (over 9 years ago)
- Last Synced: 2025-02-24T13:13:39.040Z (over 1 year ago)
- Language: JavaScript
- Size: 10.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Rectjs
Rectjs is a simple file that helps you with rects (to use the baslise canvas for example)
If you've already used the pygame's rect, well the goal of this is to be the exact same, in javascript.
Otherwise, here's how you use it
```javascript
> var myRect = new Rect(0, 0, 10, 10)
undefined
> [myRect.x, myRect.y, myRect.width, myRect.height]
[ 0, 0, 10, 10 ]
> myRect.top == myRect.x
true
> myRect.bottom
10
> myRect.center
[ 5, 5 ]
> myRect.centerx = 0
0
> myRect.left
-5
>
```