audiomotion-analyzer 4.1.0 → 4.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -3,8 +3,8 @@
3
3
 
4
4
  **audioMotion-analyzer** is a high-resolution real-time audio spectrum analyzer built upon **Web Audio** and **Canvas** JavaScript APIs.
5
5
 
6
- It was originally conceived as part of a full-featured music player called [**audioMotion**](https://audiomotion.me),
7
- but I later decided to make only the spectrum analyzer available as a self-contained module, so other developers could use it in their own projects.
6
+ It was originally conceived as part of my full-featured music player called [**audioMotion**](https://audiomotion.me), but I later decided
7
+ to make the spectrum analyzer available as a self-contained module, so other developers could use it in their own JS projects.
8
8
 
9
9
  My goal is to make this the best looking, most accurate and customizable spectrum analyzer around, in a small-footprint and high-performance package.
10
10
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "audiomotion-analyzer",
3
3
  "description": "High-resolution real-time graphic audio spectrum analyzer JavaScript module with no dependencies.",
4
- "version": "4.1.0",
4
+ "version": "4.1.1",
5
5
  "main": "./src/audioMotion-analyzer.js",
6
6
  "module": "./src/audioMotion-analyzer.js",
7
7
  "types": "./src/index.d.ts",
@@ -2,12 +2,12 @@
2
2
  * audioMotion-analyzer
3
3
  * High-resolution real-time graphic audio spectrum analyzer JS module
4
4
  *
5
- * @version 4.1.0
5
+ * @version 4.1.1
6
6
  * @author Henrique Avila Vianna <hvianna@gmail.com> <https://henriquevianna.com>
7
7
  * @license AGPL-3.0-or-later
8
8
  */
9
9
 
10
- const VERSION = '4.1.0';
10
+ const VERSION = '4.1.1';
11
11
 
12
12
  // internal constants
13
13
  const TAU = 2 * Math.PI,
@@ -102,6 +102,18 @@ const deprecate = ( name, alternative ) => console.warn( `${name} is deprecated.
102
102
  // returns the validated value, or the first element of `list` if `value` is not found in the array
103
103
  const validateFromList = ( value, list, modifier = 'toLowerCase' ) => list[ Math.max( 0, list.indexOf( ( '' + value )[ modifier ]() ) ) ];
104
104
 
105
+ // Polyfill for Array.findLastIndex()
106
+ if ( ! Array.prototype.findLastIndex ) {
107
+ Array.prototype.findLastIndex = function( callback ) {
108
+ let index = this.length;
109
+ while ( index-- > 0 ) {
110
+ if ( callback( this[ index ] ) )
111
+ return index;
112
+ }
113
+ return -1;
114
+ }
115
+ }
116
+
105
117
  // AudioMotionAnalyzer class
106
118
 
107
119
  export default class AudioMotionAnalyzer {
@@ -1684,12 +1696,12 @@ export default class AudioMotionAnalyzer {
1684
1696
  ctx.moveTo( ...radialXY( x, y, dir ) );
1685
1697
  ctx.lineTo( ...radialXY( x, y + h, dir ) );
1686
1698
  if ( isRound )
1687
- ctx.arc( centerX, centerY, radius + y + h, startAngle, endAngle );
1699
+ ctx.arc( centerX, centerY, radius + y + h, startAngle, endAngle, dir != 1 );
1688
1700
  else
1689
1701
  ctx.lineTo( ...radialXY( x + w, y + h, dir ) );
1690
1702
  ctx.lineTo( ...radialXY( x + w, y, dir ) );
1691
1703
  if ( isRound && ! stroke ) // close the bottom line only when not in outline mode
1692
- ctx.arc( centerX, centerY, radius + y, endAngle, startAngle, true );
1704
+ ctx.arc( centerX, centerY, radius + y, endAngle, startAngle, dir == 1 );
1693
1705
  }
1694
1706
  strokeIf( stroke );
1695
1707
  ctx.fill();