Add easing function parameter to anim function.

This commit is contained in:
2023-03-02 10:39:39 +08:00
parent 456782930a
commit a93c081dd8

View File

@@ -493,7 +493,7 @@ namespace Cryville.Crtr {
}
class func_anim : PdtOperator {
readonly Func<PropSrc> _ctxcb;
public func_anim(Func<PropSrc> ctxcb) : base(2) {
public func_anim(Func<PropSrc> ctxcb) : base(3) {
_ctxcb = ctxcb;
}
protected override unsafe void Execute() {
@@ -502,7 +502,12 @@ namespace Cryville.Crtr {
var dim1 = GetDimension(op1);
var dim2 = GetDimension(op2);
var dim0 = Math.Min(dim1, dim2);
var time = oputil.AsNumber(_ctxcb());
float time;
switch (LoadedOperandCount) {
case 2: time = oputil.AsNumber(_ctxcb()); break;
case 3: time = GetOperand(2).AsNumber(); break;
default: throw new ArgumentException("Argument count not 2 or 3");
}
if (dim0 == 1) {
GetReturnFrame(PdtInternalType.Number, sizeof(float))
.SetNumber(op1.AsNumber() * (1 - time) + op2.AsNumber() * time);