ronanbrett / mojs-typescript-definitions

4 stars 3 forks source link

Creating a burst animation - compiler error #1

Open Cyamanide opened 6 years ago

Cyamanide commented 6 years ago

Hi

First off thank you for creating the type definition, but I had an issue when I tried to create a burst animation, like the following:

burst = new mojs.Burst({
        left: 0,
        top: 0,
        radius: {4: 32},
        angle: 45,
        count: 14,
        children: {
            radius: 2.5,
            fill: '#FD7932',
            scale: {1: 0, easing: 'quad.in'},
            pathScale: [0.8, null],
            degreeShift: [13, null],
            duration: [500, 700],
            easing: 'quint.out'
        }
    });

I got the following webpack compiler error:

ERROR in src/app/mojs/mojs.component.ts(77,28): error TS2345: Argument of type '{ left: number; top: number; radius: { 4: number; }; angle: number; count: number; children: { ra...' is not assignable to parameter of type 'BurstOptions'. Property 'parent' is missing in type '{ left: number; top: number; radius: { 4: number; }; angle: number; count: number; children: { ra...'.

To fix it I changed the 'burstoptions' property definitions for radius and children as follows:

'radius' from:

radius: number,

to

radius: number | any,

and 'children' from:

children: { /* (+) SHAPE SWIRL PROPERTIES AND CALLBACKS (excludingxandy) - see ShapeSwirl API */ }

to:

children: any | { /* (+) SHAPE SWIRL PROPERTIES AND CALLBACKS (excludingxandy) - see ShapeSwirl API */ }

I doubt it's the best solution but it worked.

Aloento commented 2 years ago

radius: number | { [delta: string]: number }