Skip to content

Commit

Permalink
Migrated project to Typescript - strict: false 🐺 (#41)
Browse files Browse the repository at this point in the history
* Migrated project to Typescript!

Co-authored-by: Ani Sinanaj <[email protected]>
Co-authored-by: Riccardo Canella <[email protected]>

* Improving buildfile

Co-authored-by: Ani Sinanaj <[email protected]>
Co-authored-by: Riccardo Canella <[email protected]>
  • Loading branch information
3 people authored May 2, 2020
1 parent 5ae128c commit 4454c60
Show file tree
Hide file tree
Showing 21 changed files with 1,533 additions and 7,070 deletions.
7 changes: 6 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"extends": ["plugin:prettier/recommended"],
"parser": "@typescript-eslint/parser",
"extends": [
"plugin:@typescript-eslint/recommended", // Uses the recommended rules from the @typescript-eslint/eslint-plugin
"prettier/@typescript-eslint", // Uses eslint-config-prettier to disable ESLint rules from @typescript-eslint/eslint-plugin that would conflict with prettier
"plugin:prettier/recommended" // Enables eslint-plugin-prettier and eslint-config-prettier. This will display prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array.],
],
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module"
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
node_modules/
node_modules/
tsbuild/
3 changes: 2 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules/
etc/
etc/
tsbuild/
27 changes: 14 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,20 @@ Create a div container and instantiate a SiriWave object

## Constructor options

| Key | Type | Description | Default | Required |
| ---------- | ------------- | ---------------------------------------------------------------------- | ---------- | -------- |
| container | DOMElement | The DOM container where the DOM canvas element will be added. | null | yes |
| style | "ios", "ios9" | The style of the wave. | "ios" | no |
| ratio | Number | Ratio of the display to use. Calculated by default. | calculated | no |
| speed | Number | The speed of the animation. | 0.2 | no |
| amplitude | Number | The amplitude of the complete wave-form. | 1 | no |
| frequency | Number | The frequency of the complete wave-form. Only available in style "ios" | 6 | no |
| color | String | Color of the wave. Only available in style "ios" | "#fff" | no |
| cover | Bool | The `canvas` covers the entire width or height of the container | false | no |
| autostart | Bool | Decide wether start the animation on boot. | false | no |
| pixelDepth | Number | Number of step (in pixels) used when drawed on canvas. | 0.02 | no |
| lerpSpeed | Number | Lerp speed to interpolate properties. | 0.01 | no |
| Key | Type | Description | Default | Required |
| --------------- | ------------------ | ---------------------------------------------------------------------- | ---------- | -------- |
| container | DOMElement | The DOM container where the DOM canvas element will be added. | null | yes |
| style | "ios", "ios9" | The style of the wave. | "ios" | no |
| ratio | Number | Ratio of the display to use. Calculated by default. | calculated | no |
| speed | Number | The speed of the animation. | 0.2 | no |
| amplitude | Number | The amplitude of the complete wave-form. | 1 | no |
| frequency | Number | The frequency of the complete wave-form. Only available in style "ios" | 6 | no |
| color | String | Color of the wave. Only available in style "ios" | "#fff" | no |
| cover | Bool | The `canvas` covers the entire width or height of the container | false | no |
| autostart | Bool | Decide wether start the animation on boot. | false | no |
| pixelDepth | Number | Number of step (in pixels) used when drawed on canvas. | 0.02 | no |
| lerpSpeed | Number | Lerp speed to interpolate properties. | 0.01 | no |
| curveDefinition | ICurveDefinition[] | Override definition of the curves | null | no |

## API

Expand Down
15 changes: 15 additions & 0 deletions dist/curve.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import SiriWaveController from "./siriwave";
import { ICurveDefinition, ICurve } from "./types";
export declare class Curve implements ICurve {
ctrl: SiriWaveController;
definition: ICurveDefinition;
ATT_FACTOR: number;
GRAPH_X: number;
AMPLITUDE_FACTOR: number;
constructor(ctrl: SiriWaveController, definition: ICurveDefinition);
globalAttFn(x: number): number;
_xpos(i: number): number;
_ypos(i: number): number;
draw(): void;
static getDefinition(): ICurveDefinition[];
}
43 changes: 43 additions & 0 deletions dist/ios9curve.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import SiriWaveController from "./siriwave";
import { ICurveDefinition, ICurve } from "./types";
export declare class iOS9Curve implements ICurve {
ctrl: SiriWaveController;
definition: ICurveDefinition;
spawnAt: number;
noOfCurves: number;
prevMaxY: number;
phases: number[];
amplitudes: number[];
despawnTimeouts: number[];
offsets: number[];
speeds: number[];
finalAmplitudes: number[];
widths: number[];
verses: number[];
GRAPH_X: number;
AMPLITUDE_FACTOR: number;
SPEED_FACTOR: number;
DEAD_PX: number;
ATT_FACTOR: number;
DESPAWN_FACTOR: number;
NOOFCURVES_RANGES: [number, number];
AMPLITUDE_RANGES: [number, number];
OFFSET_RANGES: [number, number];
WIDTH_RANGES: [number, number];
SPEED_RANGES: [number, number];
DESPAWN_TIMEOUT_RANGES: [number, number];
constructor(ctrl: SiriWaveController, definition: ICurveDefinition);
getRandomRange(e: [number, number]): number;
respawnSingle(ci: number): void;
getEmptyArray(count: number): number[];
respawn(): void;
globalAttFn(x: number): number;
sin(x: number, phase: number): number;
_grad(x: number, a: number, b: number): number;
yRelativePos(i: number): number;
_ypos(i: number): number;
_xpos(i: number): number;
drawSupportLine(): void;
draw(): void;
static getDefinition(): ICurveDefinition[];
}
Loading

0 comments on commit 4454c60

Please sign in to comment.