Skip to content

Tween.js from tweenjs#21

Open
pavel-ignatovich wants to merge 1 commit intomasterfrom
js_tweenjs_tween.js
Open

Tween.js from tweenjs#21
pavel-ignatovich wants to merge 1 commit intomasterfrom
js_tweenjs_tween.js

Conversation

@pavel-ignatovich
Copy link
Copy Markdown

@pavel-ignatovich pavel-ignatovich added Demonstration JS Files in JavaScript labels Jan 12, 2020
Copy link
Copy Markdown

@monocodus monocodus Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is autogenerated code-style review, new suggestions: 16

Comment thread Tween.js
while (tweenIds.length > 0) {
this._tweensAddedDuringUpdate = {};

for (var i = 0; i < tweenIds.length; i++) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
for (var i = 0; i < tweenIds.length; i++) {
for (var i = 0; i < tweenIds.length; i += 1) {

This comment was generated with the following checker: FixMyJS

Comment thread Tween.js
TWEEN.Group = _Group;
TWEEN._nextId = 0;
TWEEN.nextId = function () {
return TWEEN._nextId++;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return TWEEN._nextId++;
return TWEEN._nextId += 1;

This comment was generated with the following checker: FixMyJS

Comment thread Tween.js

stopChainedTweens: function () {

for (var i = 0, numChainedTweens = this._chainedTweens.length; i < numChainedTweens; i++) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
for (var i = 0, numChainedTweens = this._chainedTweens.length; i < numChainedTweens; i++) {
for (var i = 0, numChainedTweens = this._chainedTweens.length; i < numChainedTweens; i += 1) {

This comment was generated with the following checker: FixMyJS

Comment thread Tween.js
if (this._repeat > 0) {

if (isFinite(this._repeat)) {
this._repeat--;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
this._repeat--;
this._repeat -= 1;

This comment was generated with the following checker: FixMyJS

Comment thread Tween.js
this._onCompleteCallback(this._object);
}

for (var i = 0, numChainedTweens = this._chainedTweens.length; i < numChainedTweens; i++) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
for (var i = 0, numChainedTweens = this._chainedTweens.length; i < numChainedTweens; i++) {
for (var i = 0, numChainedTweens = this._chainedTweens.length; i < numChainedTweens; i += 1) {

This comment was generated with the following checker: FixMyJS

Comment thread Tween.js
var pw = Math.pow;
var bn = TWEEN.Interpolation.Utils.Bernstein;

for (var i = 0; i <= n; i++) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
for (var i = 0; i <= n; i++) {
for (var i = 0; i <= n; i += 1) {

This comment was generated with the following checker: FixMyJS

Comment thread Tween.js
return a[n];
}

for (var i = n; i > 1; i--) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
for (var i = n; i > 1; i--) {
for (var i = n; i > 1; i -= 1) {

This comment was generated with the following checker: FixMyJS

Comment thread Tween.js

},

update: function (time) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function is too long

update ( time ) now spans 80 lines.
Corresponding modifications started here.
Keep your functions' length within 50 lines to improve readability.

This comment was generated with the following checker: long_method

Comment thread Tween.js

},

update: function (time) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function is too complicated

update ( time ) now has cyclomatic complexity of 26.
Corresponding modifications started here.
Split your routines to keep cyclomatic complexity below 10 to improve their maintainability.

This comment was generated with the following checker: high_cyclomatic_complexity

Comment thread Tween.js

},

interpolation: function (interpolationFunction) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The parameter name is too long

Parameter name interpolationFunction is now 21 characters long.
Keep length of your parameter names within 20 characters to improve readability.

This comment was generated with the following checker: naming_analysis

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Demonstration JS Files in JavaScript

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant