@plupin/character 0.3.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -18,12 +18,27 @@ var AUTHORED_CLIP_NAMES = [
18
18
  "pose",
19
19
  "rage",
20
20
  "sob",
21
- "nod"
21
+ "nod",
22
+ "brazil-funk",
23
+ "pacu-jalur",
24
+ "velocity",
25
+ "griddy",
26
+ "floss",
27
+ "caramel"
22
28
  ];
23
29
  var FPS = 20;
24
30
  var round = (value) => Math.round(value * 100) / 100;
25
31
  var lerp = (from, to, t) => from + (to - from) * t;
26
- function keyframes(loop, keys) {
32
+ var applyEase = (t, ease) => {
33
+ if (ease === "smooth")
34
+ return 0.5 - 0.5 * Math.cos(Math.PI * t);
35
+ if (ease === "snap")
36
+ return 1 - (1 - t) ** 4;
37
+ if (ease === "out")
38
+ return 1 - (1 - t) ** 2.4;
39
+ return t;
40
+ };
41
+ function keyframes(loop, keys, defaultEase = "linear") {
27
42
  const last = keys[keys.length - 1];
28
43
  if (!last)
29
44
  throw new Error("A clip needs at least one keyed pose.");
@@ -35,7 +50,8 @@ function keyframes(loop, keys) {
35
50
  const from = keys[index];
36
51
  const to = keys[index + 1] ?? from;
37
52
  const span = to.at - from.at;
38
- const t = span > 0 ? Math.min(1, Math.max(0, (seconds - from.at) / span)) : 0;
53
+ const rawT = span > 0 ? Math.min(1, Math.max(0, (seconds - from.at) / span)) : 0;
54
+ const t = applyEase(rawT, to.ease ?? defaultEase);
39
55
  const frame = [];
40
56
  for (const bone of AUTHORED_BONES) {
41
57
  const a = from.pose[bone] ?? {};
@@ -629,7 +645,494 @@ var AUTHORED_CLIPS = {
629
645
  at: 1.6,
630
646
  pose: { torso: { x: 0.04 }, head: { x: 0.02 }, armL: { z: -0.1 }, armR: { z: 0.1 } }
631
647
  }
632
- ])
648
+ ]),
649
+ "brazil-funk": keyframes(true, [
650
+ {
651
+ at: 0,
652
+ pose: {
653
+ torso: { x: -0.1, y: 0.16, z: -0.14 },
654
+ head: { x: 0.1, y: -0.14, z: 0.1 },
655
+ armL: { x: -0.55, z: -0.25 },
656
+ armR: { x: 0.15, z: 0.35 },
657
+ legL: { x: -0.34, z: -0.12 },
658
+ legR: { x: 0.18, z: 0.1 }
659
+ },
660
+ lift: 0.02
661
+ },
662
+ {
663
+ at: 0.2,
664
+ pose: {
665
+ torso: { x: -0.04, y: 0.04, z: -0.04 },
666
+ head: { x: -0.06, y: -0.04, z: 0.02 },
667
+ armL: { x: -0.35, z: -0.18 },
668
+ armR: { x: -0.35, z: 0.22 },
669
+ legL: { x: -0.12, z: -0.08 },
670
+ legR: { x: -0.12, z: 0.08 }
671
+ },
672
+ lift: 0.14,
673
+ ease: "out"
674
+ },
675
+ {
676
+ at: 0.4,
677
+ pose: {
678
+ torso: { x: -0.12, y: -0.16, z: 0.14 },
679
+ head: { x: 0.12, y: 0.14, z: -0.1 },
680
+ armL: { x: 0.15, z: -0.35 },
681
+ armR: { x: -0.55, z: 0.25 },
682
+ legL: { x: 0.18, z: -0.1 },
683
+ legR: { x: -0.34, z: 0.12 }
684
+ },
685
+ lift: 0.02,
686
+ ease: "snap"
687
+ },
688
+ {
689
+ at: 0.6,
690
+ pose: {
691
+ torso: { x: -0.04, y: -0.04, z: 0.04 },
692
+ head: { x: -0.06, y: 0.04, z: -0.02 },
693
+ armL: { x: -0.35, z: -0.22 },
694
+ armR: { x: -0.35, z: 0.18 },
695
+ legL: { x: -0.12, z: -0.08 },
696
+ legR: { x: -0.12, z: 0.08 }
697
+ },
698
+ lift: 0.14,
699
+ ease: "out"
700
+ },
701
+ {
702
+ at: 0.8,
703
+ pose: {
704
+ torso: { x: -0.14, y: 0.22, z: -0.16 },
705
+ head: { x: 0.14, y: -0.18, z: 0.12 },
706
+ armL: { x: -0.75, z: -0.3 },
707
+ armR: { x: -0.25, z: 0.45 },
708
+ legL: { x: -0.42, z: -0.14 },
709
+ legR: { x: 0.24, z: 0.12 }
710
+ },
711
+ lift: 0.01,
712
+ ease: "snap"
713
+ },
714
+ {
715
+ at: 1,
716
+ pose: {
717
+ torso: { x: -0.02, y: 0, z: 0 },
718
+ head: { x: -0.08, y: 0, z: 0 },
719
+ armL: { x: -0.45, z: -0.24 },
720
+ armR: { x: -0.45, z: 0.24 },
721
+ legL: { x: -0.1, z: -0.08 },
722
+ legR: { x: -0.1, z: 0.08 }
723
+ },
724
+ lift: 0.16,
725
+ ease: "out"
726
+ },
727
+ {
728
+ at: 1.2,
729
+ pose: {
730
+ torso: { x: -0.14, y: -0.22, z: 0.16 },
731
+ head: { x: 0.14, y: 0.18, z: -0.12 },
732
+ armL: { x: -0.25, z: -0.45 },
733
+ armR: { x: -0.75, z: 0.3 },
734
+ legL: { x: 0.24, z: -0.12 },
735
+ legR: { x: -0.42, z: 0.14 }
736
+ },
737
+ lift: 0.01,
738
+ ease: "snap"
739
+ },
740
+ {
741
+ at: 1.4,
742
+ pose: {
743
+ torso: { x: -0.04, y: 0.04, z: -0.04 },
744
+ head: { x: -0.06, y: -0.04, z: 0.02 },
745
+ armL: { x: -0.42, z: -0.22 },
746
+ armR: { x: -0.25, z: 0.28 },
747
+ legL: { x: -0.18, z: -0.1 },
748
+ legR: { x: 0.04, z: 0.1 }
749
+ },
750
+ lift: 0.14,
751
+ ease: "smooth"
752
+ },
753
+ {
754
+ at: 1.6,
755
+ pose: {
756
+ torso: { x: -0.1, y: 0.16, z: -0.14 },
757
+ head: { x: 0.1, y: -0.14, z: 0.1 },
758
+ armL: { x: -0.55, z: -0.25 },
759
+ armR: { x: 0.15, z: 0.35 },
760
+ legL: { x: -0.34, z: -0.12 },
761
+ legR: { x: 0.18, z: 0.1 }
762
+ },
763
+ lift: 0.02,
764
+ ease: "smooth"
765
+ }
766
+ ], "smooth"),
767
+ "pacu-jalur": keyframes(true, [
768
+ {
769
+ at: 0,
770
+ pose: {
771
+ torso: { x: 0.12, y: 0.32, z: -0.12 },
772
+ head: { x: -0.04, y: -0.24, z: 0.08 },
773
+ armL: { x: -0.95, z: 0.38 },
774
+ armR: { x: -0.35, z: 0.92 },
775
+ legL: { x: -0.22, z: -0.18 },
776
+ legR: { x: 0.16, z: 0.18 }
777
+ },
778
+ lift: 0.04
779
+ },
780
+ {
781
+ at: 0.6,
782
+ pose: {
783
+ torso: { x: 0.08, y: 0.06, z: -0.04 },
784
+ head: { x: 0.06, y: -0.04, z: 0.02 },
785
+ armL: { x: -0.72, z: -0.88 },
786
+ armR: { x: -0.88, z: -0.12 },
787
+ legL: { x: -0.14, z: -0.18 },
788
+ legR: { x: -0.14, z: 0.18 }
789
+ },
790
+ lift: 0.16,
791
+ ease: "smooth"
792
+ },
793
+ {
794
+ at: 1.2,
795
+ pose: {
796
+ torso: { x: 0.12, y: -0.32, z: 0.12 },
797
+ head: { x: -0.04, y: 0.24, z: -0.08 },
798
+ armL: { x: -0.35, z: -0.92 },
799
+ armR: { x: -0.95, z: -0.38 },
800
+ legL: { x: 0.16, z: -0.18 },
801
+ legR: { x: -0.22, z: 0.18 }
802
+ },
803
+ lift: 0.04,
804
+ ease: "smooth"
805
+ },
806
+ {
807
+ at: 1.8,
808
+ pose: {
809
+ torso: { x: 0.06, y: -0.06, z: 0.04 },
810
+ head: { x: 0.06, y: 0.04, z: -0.02 },
811
+ armL: { x: -0.88, z: 0.12 },
812
+ armR: { x: -0.72, z: 0.88 },
813
+ legL: { x: -0.14, z: -0.18 },
814
+ legR: { x: -0.14, z: 0.18 }
815
+ },
816
+ lift: 0.16,
817
+ ease: "smooth"
818
+ },
819
+ {
820
+ at: 2.4,
821
+ pose: {
822
+ torso: { x: 0.12, y: 0.32, z: -0.12 },
823
+ head: { x: -0.04, y: -0.24, z: 0.08 },
824
+ armL: { x: -0.95, z: 0.38 },
825
+ armR: { x: -0.35, z: 0.92 },
826
+ legL: { x: -0.22, z: -0.18 },
827
+ legR: { x: 0.16, z: 0.18 }
828
+ },
829
+ lift: 0.04,
830
+ ease: "smooth"
831
+ }
832
+ ], "smooth"),
833
+ velocity: keyframes(true, [
834
+ {
835
+ at: 0,
836
+ pose: {
837
+ torso: { x: -0.04, y: 0.14, z: -0.08 },
838
+ head: { x: -0.04, y: -0.1, z: 0.06 },
839
+ armL: { x: -0.45, z: -0.45 },
840
+ armR: { x: -0.45, z: 0.45 },
841
+ legL: { x: -0.12, z: -0.1 },
842
+ legR: { x: 0.1, z: 0.1 }
843
+ },
844
+ lift: 0.1
845
+ },
846
+ {
847
+ at: 0.4,
848
+ pose: {
849
+ torso: { x: -0.12, y: 0.22, z: -0.12 },
850
+ head: { x: -0.1, y: -0.16, z: 0.08 },
851
+ armL: { x: -0.65, z: -0.68 },
852
+ armR: { x: -0.65, z: 0.68 },
853
+ legL: { x: -0.18, z: -0.12 },
854
+ legR: { x: 0.14, z: 0.12 }
855
+ },
856
+ lift: 0.16,
857
+ ease: "smooth"
858
+ },
859
+ {
860
+ at: 0.55,
861
+ pose: {
862
+ torso: { x: 0.18, y: -0.18, z: 0.16 },
863
+ head: { x: 0.16, y: 0.22, z: -0.16 },
864
+ armL: { x: -1.05, z: 0.42 },
865
+ armR: { x: -1.05, z: -0.42 },
866
+ legL: { x: -0.28, z: -0.14 },
867
+ legR: { x: 0.22, z: 0.14 }
868
+ },
869
+ lift: 0.01,
870
+ ease: "snap"
871
+ },
872
+ {
873
+ at: 0.9,
874
+ pose: {
875
+ torso: { x: 0.15, y: -0.14, z: 0.13 },
876
+ head: { x: 0.12, y: 0.18, z: -0.13 },
877
+ armL: { x: -0.98, z: 0.36 },
878
+ armR: { x: -0.98, z: -0.36 },
879
+ legL: { x: -0.24, z: -0.12 },
880
+ legR: { x: 0.18, z: 0.12 }
881
+ },
882
+ lift: 0.04,
883
+ ease: "smooth"
884
+ },
885
+ {
886
+ at: 1.25,
887
+ pose: {
888
+ torso: { x: 0.02, y: -0.04, z: 0.04 },
889
+ head: { x: 0, y: 0.04, z: -0.02 },
890
+ armL: { x: -0.5, z: -0.35 },
891
+ armR: { x: -0.5, z: 0.35 },
892
+ legL: { x: 0.06, z: -0.1 },
893
+ legR: { x: -0.12, z: 0.1 }
894
+ },
895
+ lift: 0.18,
896
+ ease: "smooth"
897
+ },
898
+ {
899
+ at: 1.4,
900
+ pose: {
901
+ torso: { x: -0.16, y: 0.26, z: -0.2 },
902
+ head: { x: -0.12, y: -0.26, z: 0.18 },
903
+ armL: { x: -0.35, z: -2.05 },
904
+ armR: { x: -0.95, z: 0.32 },
905
+ legL: { x: -0.36, z: -0.14 },
906
+ legR: { x: 0.26, z: 0.14 }
907
+ },
908
+ lift: 0.24,
909
+ ease: "snap"
910
+ },
911
+ {
912
+ at: 1.75,
913
+ pose: {
914
+ torso: { x: -0.13, y: 0.22, z: -0.17 },
915
+ head: { x: -0.1, y: -0.22, z: 0.15 },
916
+ armL: { x: -0.38, z: -1.95 },
917
+ armR: { x: -0.9, z: 0.34 },
918
+ legL: { x: -0.32, z: -0.12 },
919
+ legR: { x: 0.22, z: 0.12 }
920
+ },
921
+ lift: 0.2,
922
+ ease: "smooth"
923
+ },
924
+ {
925
+ at: 2,
926
+ pose: {
927
+ torso: { x: -0.04, y: 0.14, z: -0.08 },
928
+ head: { x: -0.04, y: -0.1, z: 0.06 },
929
+ armL: { x: -0.45, z: -0.45 },
930
+ armR: { x: -0.45, z: 0.45 },
931
+ legL: { x: -0.12, z: -0.1 },
932
+ legR: { x: 0.1, z: 0.1 }
933
+ },
934
+ lift: 0.1,
935
+ ease: "smooth"
936
+ }
937
+ ], "smooth"),
938
+ griddy: keyframes(true, [
939
+ {
940
+ at: 0,
941
+ pose: {
942
+ torso: { x: 0.22, y: 0.08, z: -0.08 },
943
+ head: { x: -0.14, y: -0.08, z: 0.06 },
944
+ armL: { x: 0.65, z: -0.22 },
945
+ armR: { x: 0.65, z: 0.22 },
946
+ legL: { x: -0.68, z: -0.06 },
947
+ legR: { x: 0.34, z: 0.06 }
948
+ },
949
+ lift: 0.12
950
+ },
951
+ {
952
+ at: 0.4,
953
+ pose: {
954
+ torso: { x: 0.16, y: -0.06, z: 0.06 },
955
+ head: { x: 0.06, y: 0.08, z: -0.06 },
956
+ armL: { x: -1.15, z: -0.28 },
957
+ armR: { x: -1.15, z: 0.28 },
958
+ legL: { x: 0.34, z: -0.06 },
959
+ legR: { x: -0.68, z: 0.06 }
960
+ },
961
+ lift: 0.04,
962
+ ease: "smooth"
963
+ },
964
+ {
965
+ at: 0.8,
966
+ pose: {
967
+ torso: { x: 0.24, y: -0.08, z: 0.08 },
968
+ head: { x: -0.14, y: 0.08, z: -0.06 },
969
+ armL: { x: 0.65, z: -0.22 },
970
+ armR: { x: 0.65, z: 0.22 },
971
+ legL: { x: -0.68, z: -0.06 },
972
+ legR: { x: 0.34, z: 0.06 }
973
+ },
974
+ lift: 0.12,
975
+ ease: "smooth"
976
+ },
977
+ {
978
+ at: 1.2,
979
+ pose: {
980
+ torso: { x: 0.14, y: 0.06, z: -0.06 },
981
+ head: { x: 0.08, y: -0.08, z: 0.06 },
982
+ armL: { x: -1.25, z: -0.32 },
983
+ armR: { x: -1.25, z: 0.32 },
984
+ legL: { x: 0.34, z: -0.06 },
985
+ legR: { x: -0.68, z: 0.06 }
986
+ },
987
+ lift: 0.04,
988
+ ease: "smooth"
989
+ },
990
+ {
991
+ at: 1.6,
992
+ pose: {
993
+ torso: { x: 0.22, y: 0.08, z: -0.08 },
994
+ head: { x: -0.14, y: -0.08, z: 0.06 },
995
+ armL: { x: 0.65, z: -0.22 },
996
+ armR: { x: 0.65, z: 0.22 },
997
+ legL: { x: -0.68, z: -0.06 },
998
+ legR: { x: 0.34, z: 0.06 }
999
+ },
1000
+ lift: 0.12,
1001
+ ease: "smooth"
1002
+ }
1003
+ ], "smooth"),
1004
+ floss: keyframes(true, [
1005
+ {
1006
+ at: 0,
1007
+ pose: {
1008
+ torso: { x: 0.04, y: -0.1, z: 0.22 },
1009
+ head: { y: 0.08, z: -0.16 },
1010
+ armL: { x: -0.42, z: 0.62 },
1011
+ armR: { x: -0.18, z: 0.82 },
1012
+ legL: { z: -0.14 },
1013
+ legR: { z: 0.14 }
1014
+ },
1015
+ lift: 0.03
1016
+ },
1017
+ {
1018
+ at: 0.4,
1019
+ pose: {
1020
+ torso: { x: 0.04, y: 0.1, z: -0.22 },
1021
+ head: { y: -0.08, z: 0.16 },
1022
+ armL: { x: 0.32, z: -0.82 },
1023
+ armR: { x: 0.44, z: -0.62 },
1024
+ legL: { z: 0.14 },
1025
+ legR: { z: -0.14 }
1026
+ },
1027
+ lift: 0.06,
1028
+ ease: "smooth"
1029
+ },
1030
+ {
1031
+ at: 0.8,
1032
+ pose: {
1033
+ torso: { x: 0.04, y: -0.1, z: 0.22 },
1034
+ head: { y: 0.08, z: -0.16 },
1035
+ armL: { x: 0.44, z: 0.62 },
1036
+ armR: { x: 0.32, z: 0.82 },
1037
+ legL: { z: -0.14 },
1038
+ legR: { z: 0.14 }
1039
+ },
1040
+ lift: 0.03,
1041
+ ease: "smooth"
1042
+ },
1043
+ {
1044
+ at: 1.2,
1045
+ pose: {
1046
+ torso: { x: 0.04, y: 0.1, z: -0.22 },
1047
+ head: { y: -0.08, z: 0.16 },
1048
+ armL: { x: -0.18, z: -0.82 },
1049
+ armR: { x: -0.42, z: -0.62 },
1050
+ legL: { z: 0.14 },
1051
+ legR: { z: -0.14 }
1052
+ },
1053
+ lift: 0.06,
1054
+ ease: "smooth"
1055
+ },
1056
+ {
1057
+ at: 1.6,
1058
+ pose: {
1059
+ torso: { x: 0.04, y: -0.1, z: 0.22 },
1060
+ head: { y: 0.08, z: -0.16 },
1061
+ armL: { x: -0.42, z: 0.62 },
1062
+ armR: { x: -0.18, z: 0.82 },
1063
+ legL: { z: -0.14 },
1064
+ legR: { z: 0.14 }
1065
+ },
1066
+ lift: 0.03,
1067
+ ease: "smooth"
1068
+ }
1069
+ ], "smooth"),
1070
+ caramel: keyframes(true, [
1071
+ {
1072
+ at: 0,
1073
+ pose: {
1074
+ torso: { x: 0.04, y: -0.12, z: -0.2 },
1075
+ head: { x: 0.04, y: 0.14, z: 0.2 },
1076
+ armL: { x: -0.35, z: -2.25 },
1077
+ armR: { x: -0.35, z: 2.25 },
1078
+ legL: { x: -0.26, z: -0.14 },
1079
+ legR: { x: 0.18, z: 0.14 }
1080
+ },
1081
+ lift: 0.03
1082
+ },
1083
+ {
1084
+ at: 0.4,
1085
+ pose: {
1086
+ torso: { x: -0.04, y: 0, z: 0 },
1087
+ head: { x: -0.08, y: 0, z: 0 },
1088
+ armL: { x: -0.25, z: -2.5 },
1089
+ armR: { x: -0.25, z: 2.5 },
1090
+ legL: { x: 0.12, z: -0.1 },
1091
+ legR: { x: 0.12, z: 0.1 }
1092
+ },
1093
+ lift: 0.24,
1094
+ ease: "smooth"
1095
+ },
1096
+ {
1097
+ at: 0.8,
1098
+ pose: {
1099
+ torso: { x: 0.04, y: 0.12, z: 0.2 },
1100
+ head: { x: 0.04, y: -0.14, z: -0.2 },
1101
+ armL: { x: -0.35, z: -2.25 },
1102
+ armR: { x: -0.35, z: 2.25 },
1103
+ legL: { x: 0.18, z: -0.14 },
1104
+ legR: { x: -0.26, z: 0.14 }
1105
+ },
1106
+ lift: 0.03,
1107
+ ease: "smooth"
1108
+ },
1109
+ {
1110
+ at: 1.2,
1111
+ pose: {
1112
+ torso: { x: -0.04, y: 0, z: 0 },
1113
+ head: { x: -0.08, y: 0, z: 0 },
1114
+ armL: { x: -0.25, z: -2.5 },
1115
+ armR: { x: -0.25, z: 2.5 },
1116
+ legL: { x: 0.12, z: -0.1 },
1117
+ legR: { x: 0.12, z: 0.1 }
1118
+ },
1119
+ lift: 0.24,
1120
+ ease: "smooth"
1121
+ },
1122
+ {
1123
+ at: 1.6,
1124
+ pose: {
1125
+ torso: { x: 0.04, y: -0.12, z: -0.2 },
1126
+ head: { x: 0.04, y: 0.14, z: 0.2 },
1127
+ armL: { x: -0.35, z: -2.25 },
1128
+ armR: { x: -0.35, z: 2.25 },
1129
+ legL: { x: -0.26, z: -0.14 },
1130
+ legR: { x: 0.18, z: 0.14 }
1131
+ },
1132
+ lift: 0.03,
1133
+ ease: "smooth"
1134
+ }
1135
+ ], "smooth")
633
1136
  };
634
1137
 
635
1138
  // src/rig.ts
@@ -764,19 +1267,44 @@ var CLIPS = {
764
1267
  pose: authored("pose"),
765
1268
  rage: authored("rage"),
766
1269
  sob: authored("sob"),
767
- nod: authored("nod")
1270
+ nod: authored("nod"),
1271
+ "brazil-funk": authored("brazil-funk"),
1272
+ "pacu-jalur": authored("pacu-jalur"),
1273
+ velocity: authored("velocity"),
1274
+ griddy: authored("griddy"),
1275
+ floss: authored("floss"),
1276
+ caramel: authored("caramel")
768
1277
  };
769
1278
  var isCustomClip = (clip) => typeof clip !== "string";
770
1279
  var customDuration = (clip) => clip.frames.length / clip.fps;
771
1280
  function customFrame(clip, seconds) {
772
1281
  const count = clip.frames.length;
1282
+ if (count <= 1)
1283
+ return [...clip.frames[0] ?? []];
1284
+ const span = clip.loop ? count - 1 : count - 1;
773
1285
  const position = Math.max(0, seconds) * clip.fps;
774
- const wrapped = clip.loop ? position % count : Math.min(position, count - 1);
1286
+ const wrapped = clip.loop && span > 0 ? position % span : Math.min(position, count - 1);
775
1287
  const index = Math.floor(wrapped);
776
- const here = clip.frames[index] ?? clip.frames[count - 1] ?? [];
777
- const next = clip.frames[clip.loop ? (index + 1) % count : Math.min(index + 1, count - 1)] ?? here;
778
- const blend = wrapped - index;
779
- return here.map((value, slot) => value + ((next[slot] ?? value) - value) * blend);
1288
+ const t = wrapped - index;
1289
+ const at = (i) => {
1290
+ if (clip.loop && span > 0)
1291
+ return clip.frames[(i % span + span) % span] ?? [];
1292
+ return clip.frames[Math.max(0, Math.min(count - 1, i))] ?? [];
1293
+ };
1294
+ const p0 = at(index - 1);
1295
+ const p1 = at(index);
1296
+ const p2 = at(index + 1);
1297
+ const p3 = at(index + 2);
1298
+ if (t <= 0.000001)
1299
+ return [...p1];
1300
+ const t2 = t * t;
1301
+ const t3 = t2 * t;
1302
+ return p1.map((v1, slot) => {
1303
+ const v0 = p0[slot] ?? v1;
1304
+ const v2 = p2[slot] ?? v1;
1305
+ const v3 = p3[slot] ?? v2;
1306
+ return 0.5 * (2 * v1 + (-v0 + v2) * t + (2 * v0 - 5 * v1 + 4 * v2 - v3) * t2 + (-v0 + 3 * v1 - 3 * v2 + v3) * t3);
1307
+ });
780
1308
  }
781
1309
  function sampleCustom(clip, seconds) {
782
1310
  const frame = customFrame(clip, seconds);