|
1 | | -# polyavatar |
2 | | -Generate polygonal avatars |
| 1 | +<p align="center"> |
| 2 | + <img src="docs/polyavatarlogo.svg" /> |
| 3 | +</p> |
3 | 4 |
|
4 | | -## Install |
| 5 | +# What it is |
| 6 | +Simple plygin to generate polygonal avatars with customization options. |
| 7 | + |
| 8 | +## How to install |
5 | 9 | Copy the file to your project |
6 | 10 |
|
7 | | -## Instantiate |
| 11 | +## Quick Start |
| 12 | +1. Create a canvas element with the desired width: |
| 13 | + |
| 14 | +``` html |
| 15 | +<canvas class="polyavatar" width="256" height="256"></canvas> |
| 16 | +``` |
| 17 | +2. Instantiate the plugin poiting to the canvas element |
8 | 18 | ``` javascript |
9 | | -// Create a new instance of the plugin |
10 | 19 | var newInstance = new PolygonAvatar({ |
11 | | - selector: '.polyavatarnoimage', |
| 20 | + selector: '.polyavatar' |
12 | 21 | }) |
13 | 22 | ``` |
| 23 | + |
| 24 | +3. Enjoy the result |
| 25 | + |
| 26 | + |
| 27 | + |
| 28 | +## Options |
| 29 | + |
| 30 | +The plugin can be configured using the one of a combination of the following options: |
| 31 | + |
| 32 | +| Parameter | Description | Default | Mandatory | |
| 33 | +|------------------|:---------------------------------------------------------------------------------------------------|:---------:|:---------:| |
| 34 | +| selector | A CSS selector to the destination canvas to render. | '' | x | |
| 35 | +| sides | How many sides (more than 2, of course) the polygon should have. | 6 | | |
| 36 | +| image | Sets the image to be rendered inside the polygon. | '' | | |
| 37 | +| percentage | The percentage of the progress bar around the image. | 0.98 | | |
| 38 | +| progressBarColor | The color of the progress bar. | '#4ff461' | | |
| 39 | +| showProgress | If the avatar should render the progressbar | true | | |
| 40 | +| animated | If the progress bar will be animated until it reaches the target percentage | true | | |
| 41 | +| online | The online status of the user. Omitting it will not generate the status indicator. | undefined | | |
| 42 | +| levelNumber | The level of the user. It will be shown as a smal polygon on the right with the level number in it. | undefined | | |
| 43 | + |
14 | 44 | ## Contributing |
15 | 45 | Please read this [style guidelines](https://github.com/joemottershaw/style-guidelines) documentation project and please follow the [contribution guidelines](./.github/CONTRIBUTING.md) and [code of conduct](./.github/CODE_OF_CONDUCT.md). |
16 | 46 |
|
|
0 commit comments