two.js icon indicating copy to clipboard operation
two.js copied to clipboard

wrong type in getPointAT declaration in path class

Open alfredo-valero opened this issue 2 years ago • 2 comments

In types.d.t , the method getPointAT is declarated with 2 params t as boolean and obj as any, when t should be a number (float)

/**
         * @name Two.Path#getPointAt
         * @function
         * @param {Boolean} t - Percentage value describing where on the {@link Two.Path} to estimate and assign coordinate values.
         * @param {Two.Vector} [object] - Object to apply calculated x, y to. If none available returns new `Object`.
         * @returns {Object}
         * @description Given a float `t` from 0 to 1, return a point or assign a passed `obj`'s coordinates to that percentage on this {@link Two.Path}'s curve.
         */
        getPointAt(t: boolean, obj: any): any;

==>

/**
         * @name Two.Path#getPointAt
         * @function
         * @param {number} t - Percentage value describing where on the {@link Two.Path} to estimate and assign coordinate values.
         * @param {Two.Vector} [object] - Object to apply calculated x, y to. If none available returns new `Object`.
         * @returns {Object}
         * @description Given a float `t` from 0 to 1, return a point or assign a passed `obj`'s coordinates to that percentage on this {@link Two.Path}'s curve.
         */
        getPointAt(t: number, obj: any): any;

Congratulations on your great work!

alfredo-valero avatar Feb 08 '23 12:02 alfredo-valero

Which version of Two.js are you using? The latest dev branch actually already has this fixed.

jonobr1 avatar Feb 08 '23 18:02 jonobr1

This PR improves it a bit too. Thanks for sharing: https://github.com/jonobr1/two.js/pull/694

jonobr1 avatar Feb 08 '23 18:02 jonobr1