Skip to content

Commit

Permalink
Merge pull request #10 from shhlife/NC_Tween
Browse files Browse the repository at this point in the history
Update NC_TweenUI.js
  • Loading branch information
Jason Schleifer authored Dec 6, 2018
2 parents 68fbdc0 + 1cd9f86 commit 2fe3a4a
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions NC_TweenUI.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* NC_Tween.js
*
* Jason Schleifer / 25 November 2018
* Latest Revision: 6 December 2018, 8:16 AM
* Latest Revision: 6 December 2018, 1:30 PM
* License: GPL v3
*
* Description:
Expand All @@ -13,6 +13,8 @@
* Version:
* --------
*
* 0.4 - Fixed bug when using more than one peg/drawing at a time.
*
* 0.3 - Added Antic and Overshoot - first pass to see how those work.
* Moved all UI into the main js file, no need for NC_TweenUI.ui anymore.
*
Expand Down Expand Up @@ -251,31 +253,34 @@ function NC_Tween() {
for (i = 0; i < columnInfo.length; i++) {
c = columnInfo[i];

var np = p; // use np so we don't overwrite p

// only continue if the previous value and the next value aren't the same. Otherwise we're wasting time!
if (c.prevValue != c.nextValue) {
// if we're favoring the next key..
if (p == 75) {
if (np == 75) {
columnInfo[i].prevValue = columnInfo[i].val;
// now set p to 50 so we'll be between the current value and the next
p = 50;
np = 50;
}
// if we're favoring the previous key
if (p == 25) {
if (np == 25) {
columnInfo[i].nextValue = columnInfo[i].val;
// now set p to 50
p = 50;
np = 50;
}


// get the next value that we tween to
nv = this.tween(c.prevValue, c.nextValue, p);
var nv = this.tween(columnInfo[i].prevValue, columnInfo[i].nextValue, np);

// Create a key
result = column.setKeyFrame(c.col, curFrame);

// Now adjust the key based on the previous key's settings.
func.setBezierPoint(c.col, curFrame, nv, c.pointHandleLeftX, c.pointHandleLeftY, c.pointHandleRightX, c.pointHandleRightY, c.constSeg, c.continuity);

} else {
// skipping
}
}
scene.endUndoRedoAccum();
Expand All @@ -296,7 +301,6 @@ function NC_Tween() {
this.NC_SetTween(115);
}


// UI
// =========================================

Expand Down

0 comments on commit 2fe3a4a

Please sign in to comment.