Skip to content

Commit

Permalink
Rollup build (#311)
Browse files Browse the repository at this point in the history
* replace gulp build with rollup

* bump version

* point main to es6 module

* revert change to test umd

* remove browserify

* update eslint config

* fix rollup error

* update readme
  • Loading branch information
inorganik authored Apr 30, 2023
1 parent 6a34c53 commit 9c2f33c
Show file tree
Hide file tree
Showing 13 changed files with 7,044 additions and 16,933 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
module.exports = {
root: true,
ignorePatterns: ['*.js', '*.html', 'node_modules/*'],
parser: '@typescript-eslint/parser',
plugins: [
'@typescript-eslint',
Expand Down
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ Or tinker with CountUp in [Stackblitz](https://stackblitz.com/edit/countup-types
- **Highly customizeable** with a large range of options, you can even substitute numerals.
- **Smart easing**: CountUp intelligently defers easing until it gets close enough to the end value for easing to be visually noticeable. Configureable in the [options](#options).
- **Plugins** allow for alternate animations like the [Odometer plugin](https://www.npmjs.com/package/odometer_countup)

![Odomoeter plugin](./demo/images/odometer_plugin.gif)
- **Separate bundles** for modern and legacy browsers, with and without the requestAnimationFrame polyfill. Choose `countUp.min.js` for modern browsers or `countUp.withPolyfill.min.js` for IE9 and older, and Opera mini.

## Usage:

Expand Down Expand Up @@ -143,7 +143,7 @@ countUp.handleScroll();

Currently there's just one plugin, the **[Odometer Plugin](https://github.com/msoler75/odometer_countup.js)**.

To use a plugin, use the plugin option:
To use a plugin, you'll need to first install the plugin package. Then you can include it and use the plugin option. See each plugin's docs for more detailed info.
```js
const countUp = new CountUp('targetId', 5234, {
plugin: new Odometer({ duration: 2.3, lastDigitDelay: 0 }),
Expand All @@ -156,7 +156,7 @@ If you'd like to make your own plugin, see [the docs](#creating-animation-plugin

## Including CountUp

CountUp is distributed as an ES6 module because it is the most standardized and most widely compatible module for browsers, though a UMD module is [also included](#umd-module).
CountUp is distributed as an ES6 module because it is the most standardized and most widely compatible module for browsers, though a UMD module is [also included](#umd-module), along with a separate requestAnimationFrame polyfill (see below).

For the examples below, first install CountUp. This will give you the latest:
```
Expand Down Expand Up @@ -206,6 +206,10 @@ var numAnim = new countUp.CountUp('myTarget', 2000);
numAnim.start()
```

### requestAnimationFrame polyfill

You can include `dist/requestAnimationFrame.polyfill.js` if you want to support IE9 and older, and Opera mini.

---

## Contributing
Expand Down
2 changes: 1 addition & 1 deletion dist/countUp.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export declare class CountUp {
* Smart easing works by breaking the animation into 2 parts, the second part being the
* smartEasingAmount and first part being the total amount minus the smartEasingAmount. It works
* by disabling easing for the first part and enabling it on the second part. It is used if
* usingEasing is true and the total animation amount exceeds the smartEasingThreshold.
* useEasing is true and the total animation amount exceeds the smartEasingThreshold.
*/
private determineDirectionAndSmartEasing;
start(callback?: (args?: any) => any): void;
Expand Down
4 changes: 2 additions & 2 deletions dist/countUp.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ var CountUp = /** @class */ (function () {
var _this = this;
this.endVal = endVal;
this.options = options;
this.version = '2.6.0';
this.version = '2.6.1';
this.defaults = {
startVal: 0,
decimalPlaces: 0,
Expand Down Expand Up @@ -177,7 +177,7 @@ var CountUp = /** @class */ (function () {
* Smart easing works by breaking the animation into 2 parts, the second part being the
* smartEasingAmount and first part being the total amount minus the smartEasingAmount. It works
* by disabling easing for the first part and enabling it on the second part. It is used if
* usingEasing is true and the total animation amount exceeds the smartEasingThreshold.
* useEasing is true and the total animation amount exceeds the smartEasingThreshold.
*/
CountUp.prototype.determineDirectionAndSmartEasing = function () {
var end = (this.finalEndVal) ? this.finalEndVal : this.endVal;
Expand Down
2 changes: 1 addition & 1 deletion dist/countUp.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 9c2f33c

Please sign in to comment.