decord/source/386__isNativeReflectConstruct.js

131 lines
4 KiB
JavaScript
Raw Normal View History

2026-07-29 08:29:29 +00:00
// Module ID: 386
// Function ID: 387
// Name: _isNativeReflectConstruct
// Dependencies: [41, 42, 93, 95, 96, 98, 379]
// Module 386 (_isNativeReflectConstruct)
2026-08-24 06:08:38 +00:00
import _inheritsDefault from "_inherits" /* 98 */;
import AnimationDefault from "Animation" /* 379 */;
import closure_1 from "_classCallCheck" /* 41 */;
import closure_2 from "_possibleConstructorReturn" /* 93 */;
import closure_3 from "_getPrototypeOf" /* 95 */;
import closure_4 from "_get" /* 96 */;
import importDefaultResult from "_createClass" /* 42 */;
2026-07-29 08:29:29 +00:00
const DecayAnimation = global;
function _isNativeReflectConstruct() {
try {
const _Boolean = Boolean;
const call = valueOf.call;
const _Reflect = Reflect;
const _Boolean2 = Boolean;
if (typeof call === "unknown") {
let callResult = valueOf();
} else {
callResult = call(constructResult);
}
2026-08-24 06:08:38 +00:00
closure_0 = !callResult;
_isNativeReflectConstruct = function _isNativeReflectConstruct() {
2026-07-29 08:29:29 +00:00
return closure_0;
2026-08-24 06:08:38 +00:00
};
2026-07-29 08:29:29 +00:00
return _isNativeReflectConstruct();
} catch (err) {
}
}
class DecayAnimation {
constructor(arg0) {
self = this;
2026-08-24 06:08:38 +00:00
tmp = closure_1(this, DecayAnimation);
2026-07-29 08:29:29 +00:00
items = [];
items[0] = global;
2026-08-24 06:08:38 +00:00
tmp2 = closure_3;
obj = closure_3(DecayAnimation);
tmp3 = closure_2;
2026-07-29 08:29:29 +00:00
if (_isNativeReflectConstruct()) {
tmp5 = globalThis;
_Reflect = Reflect;
constructResult = Reflect.construct(obj, items, tmp2(self).constructor);
} else {
constructResult = obj.apply(self, items);
}
tmp3Result = tmp3(self, constructResult);
num = global.deceleration;
if (num == null) {
num = 0.998;
}
tmp3Result._deceleration = num;
({ velocity: tmp6._velocity, platformConfig: tmp6._platformConfig } = global);
return tmp3Result;
}
}
2026-08-24 06:08:38 +00:00
_inheritsDefault(DecayAnimation, AnimationDefault);
2026-07-29 08:29:29 +00:00
let items = [
{
key: "__getNativeAnimationConfig",
value: function __getNativeAnimationConfig() {
return { type: "decay", deceleration: this._deceleration, velocity: this._velocity, iterations: this.__iterations, platformConfig: this._platformConfig, debugID: this.__getDebugID() };
}
},
{
key: "start",
value: function start(_lastValue, _onUpdate, arg2, arg3, self) {
self = this;
self = this;
self = this;
const tmp = callback3(callback2(self.prototype), "start", this);
2026-08-24 06:08:38 +00:00
closure_1 = tmp;
2026-07-29 08:29:29 +00:00
let fn = tmp;
2026-08-04 21:03:28 +00:00
if (typeof tmp === "function") {
2026-07-29 08:29:29 +00:00
fn = (items) => fn.apply(self, items);
}
const items = [_lastValue, _onUpdate, arg2, arg3, self];
fn(items);
self._lastValue = _lastValue;
self._fromValue = _lastValue;
self._onUpdate = _onUpdate;
self._startTime = Date.now();
if (!self.__startAnimationIfNative(self)) {
const _requestAnimationFrame = requestAnimationFrame;
self._animationFrame = requestAnimationFrame(() => self.onUpdate());
}
}
},
{
key: "onUpdate",
value: function onUpdate() {
const self = this;
const result = this._velocity / (1 - this._deceleration);
const sum = this._fromValue + result * (1 - Math.exp(-1 - this._deceleration * (Date.now() - this._startTime)));
this._onUpdate(sum);
if (Math.abs(this._lastValue - sum) < 0.1) {
self.__notifyAnimationEnd({ finished: true });
} else {
self._lastValue = sum;
if (self.__active) {
const _requestAnimationFrame = requestAnimationFrame;
const onUpdate = self.onUpdate;
self._animationFrame = requestAnimationFrame(onUpdate.bind(self));
}
}
}
},
{
key: "stop",
value: function stop() {
let self = this;
self = this;
let fn = callback3(callback2(self.prototype), "stop", this);
2026-08-04 21:03:28 +00:00
if (typeof fn === "function") {
2026-07-29 08:29:29 +00:00
fn = (items) => fn.apply(self, items);
}
fn([]);
if (null != self._animationFrame) {
DecayAnimation.cancelAnimationFrame(self._animationFrame);
}
self.__notifyAnimationEnd({ finished: false });
}
}
];
export default importDefaultResult(DecayAnimation, items);