Skip to content

Commit

Permalink
Update type def and build.
Browse files Browse the repository at this point in the history
  • Loading branch information
pofulu committed May 22, 2022
1 parent 0028b14 commit 7ad563d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 13 deletions.
4 changes: 2 additions & 2 deletions PFTween.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,8 @@ declare class PFTween<T extends Number | Number[] | ScalarSignal | Vec2Signal |
get durationMilliseconds(): number;
}
declare class PFTweenValue {
readonly rawValue: any;
constructor(animate: any);
readonly rawValue: ScalarSignal | ArrayOfScalarSignals;
constructor(animate: ScalarSignal | ArrayOfScalarSignals);
/**
* Take input numbers and output them in a different order.
* Input values correspond to the swizzle value (xyzw) in the order theyre inputted. For example, an input of (1,2,3) and a swizzle value of (yxz) would output (2,1,3). You can also use 0 and 1. For example, a swizzle value of (x01) would output (1,0,1).
Expand Down
19 changes: 10 additions & 9 deletions PFTween.js
Original file line number Diff line number Diff line change
Expand Up @@ -557,15 +557,16 @@ class PFTweener extends PFTweenValue {
loopCount: config.loopCount,
mirror: config.isMirror
});
let tween;
if (config.useCustomCurve) {
const progress = Animation_1.default.animate(driver, Animation_1.default.samplers.linear(0, 1));
const y = config.curve.evaluate(progress);
tween = super(Animation_1.default.animate(Animation_1.default.valueDriver(y, 0, 1), Animation_1.default.samplers.linear(config.begin, config.end)));
}
else {
tween = super(Animation_1.default.animate(driver, config.sampler));
}
const tween = super((() => {
if (config.useCustomCurve) {
const progress = Animation_1.default.animate(driver, Animation_1.default.samplers.linear(0, 1));
const y = config.curve.evaluate(progress);
return Animation_1.default.animate(Animation_1.default.valueDriver(y, 0, 1), Animation_1.default.samplers.linear(config.begin, config.end));
}
else {
return Animation_1.default.animate(driver, config.sampler);
}
})());
// prevent unnecessary subscription
if (config.loopCount != Infinity) {
config.events.onComplete.invokeOnEvent(driver.onCompleted());
Expand Down
4 changes: 2 additions & 2 deletions PFTweenDemo/scripts/PFTween.ts
Original file line number Diff line number Diff line change
Expand Up @@ -598,9 +598,9 @@ class PFTween<T extends Number | Number[] | ScalarSignal | Vec2Signal | PointSig
}

class PFTweenValue {
readonly rawValue;
readonly rawValue: ScalarSignal | ArrayOfScalarSignals;

constructor(animate) {
constructor(animate: ScalarSignal | ArrayOfScalarSignals) {
this.rawValue = animate;
}

Expand Down

0 comments on commit 7ad563d

Please sign in to comment.