https://github.com/javierbyte/dancing-dots
A js lib to get nice moving dot coordinates.
https://github.com/javierbyte/dancing-dots
Last synced: 4 months ago
JSON representation
A js lib to get nice moving dot coordinates.
- Host: GitHub
- URL: https://github.com/javierbyte/dancing-dots
- Owner: javierbyte
- Created: 2016-02-08T00:32:12.000Z (over 9 years ago)
- Default Branch: gh-pages
- Last Pushed: 2016-02-08T03:17:51.000Z (over 9 years ago)
- Last Synced: 2025-01-05T22:27:28.762Z (6 months ago)
- Language: JavaScript
- Homepage: http://javier.xyz/dancing-dots
- Size: 77.1 KB
- Stars: 2
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# [DancingDots](http://javierbyte.github.io/dancing-dots/)
[](http://javierbyte.github.io/dancing-dots/)
A library to get nice step by step dot coordinates with nice movement.
Have you ever wanted to get a set of points, and then move them like if they have a nice trayectory? No? Maybe you will want now.
## Usage
Get from npm
```
npm install dancing-dots --save
```Instanciate dancing dots.
```js
const DancingDots = require('dancing-dots')
const dots = new DancingDots(configurationObject)
```The configuration object can have the following properties:
* `dotCount`. Integer. How many dots do you want? Defaults to `10`.
* `speed`. Integer. How fast do you want the dots to move? Defaults to `5`.
* `width`. Integer. The width of the grid. Defaults to `100`.
* `height`. Integer. The height of the grid. Defaults to `100`.
* `getOnlyInts`. Boolean. Do you want only integers in your results?. Defaults to `true`.## Get the dots.
```js
dots.getCoords()
```You get:
```js
[{
x: 40,
y: 40
}, {
x: 14,
y: 99
}, {
x: 66,
y: 70
},
...
```## Update and get the dots.
```js
dots.getCoordsAndUpdate()
```That updates the position of the dots, and returns the new positions, just like `getDots()`.