- Installation
- Usage
- JS and CSS
- SCSS
- Typescript
- Styling
- CSS
- Background
- Circle color
- Circle progress color
- Circle width
- SCSS
- Background
- Circle color
- Circle progress color
- Circle width
- CSS
npm install --save circle-progress-ts
- JS and CSS
- Scss
- Typescript
Include stylesheet, e.g.
<link rel="stylesheet" type="text/css" href="node_modules/circle-progress-ts/dist/progress.css">
Include javascript, e.g.
<script src="node_modules/circle-progress-ts/dist/progress.min.js"></script>
Add div
to html
<div class="circle"></div>
Add styling to your own css
.circle {
width: 150px;
height: 150px;
}
Initialize progress circle in JS
var circle = document.querySelector( '.circle' );
var p = new progress.Progress( circle );
Change progress
// change current progress to 20%
p.progress( 20 );
or animate progress change over time
// changes from current progress to 60% over 500ms
p.progress_animate( 60, 500 );
just import the scss file
@import "./node_modules/circle-progress-ts/sass/progress";
// import circle progress lib
import { Progress } from 'circle-progress-ts';
// initialize
const circle = document.querySelector( '.circle' );
const p = new Progress( circle );
// change progress
p.progress( 20 );
p.progress_animate( 60, 500 );
- CSS
- SCSS
- Background
- Circle color
- Circle progress color
- Circle width
Usually the same as parent background
.circle .inner {
background: #373737;
}
color of the circle of the remaining progress
.circle .color {
color: #fff;
}
color of the circle of the completed progress
.circle .color {
background-color: #f00;
}
.circle .inner {
width: 93%;
height: 93%;
}
- Background
- Circle color
- Circle progress color
- Circle width
Usually the same as parent background
$bg-color: #1c1d61;
color of the circle of the remaining progress
$circle-color: #6c6c6c;
color of the circle of the completed progress
$circle-progress-color: #ff9205;
$circle-width: 7%;