UNPKG

@animech-public/playcanvas

Version:
2 lines (1 loc) 876 B
import{Http as t,http as a}from"../../platform/net/http.js";import{AnimCurve as o}from"../anim/evaluator/anim-curve.js";import{AnimData as r}from"../anim/evaluator/anim-data.js";import{AnimTrack as e}from"../anim/evaluator/anim-track.js";import{ResourceHandler as n}from"./handler.js";class i extends n{constructor(t){super(t,"animclip")}load(o,r){"string"==typeof o&&(o={load:o,original:o});const e={retry:this.maxRetries>0,maxRetries:this.maxRetries};o.load.startsWith("blob:")&&(e.responseType=t.ResponseType.JSON),a.get(o.load,e,((t,a)=>{t?r(`Error loading animation clip resource: ${o.original} [${t}]`):r(null,a)}))}open(t,a){const n=a.name,i=a.duration,s=a.inputs.map((t=>new r(1,t))),m=a.outputs.map((t=>new r(t.components,t.data))),p=a.curves.map((t=>new o([t.path],t.inputIndex,t.outputIndex,t.interpolation)));return new e(n,i,s,m,p)}}export{i as AnimClipHandler};