37 private float $totalTime,
38 private int $easeType,
40 private array $progressKeyFrames,
41 private array $rotationOptions,
44 public function getTotalTime() : float{ return $this->totalTime; }
49 public function getEaseType() : int{ return $this->easeType; }
54 public function getCurve() : array{ return $this->curve; }
66 public static function read(ByteBufferReader $in) : self{
67 $totalTime = LE::readFloat($in);
68 $easeType = Byte::readUnsigned($in);
71 $curveCount = VarInt::readUnsignedInt($in);
72 for($i = 0; $i < $curveCount; ++$i){
73 $curve[] = CommonTypes::getVector3($in);
76 $progressKeyFrames = [];
77 $progressKeyFrameCount = VarInt::readUnsignedInt($in);
78 for($i = 0; $i < $progressKeyFrameCount; ++$i){
79 $progressKeyFrames[] = CommonTypes::getVector2($in);
82 $rotationOptions = [];
83 $rotationOptionCount = VarInt::readUnsignedInt($in);
84 for($i = 0; $i < $rotationOptionCount; ++$i){
85 $rotationOptions[] = CameraRotationOption::read($in);
88 return new self($totalTime, $easeType, $curve, $progressKeyFrames, $rotationOptions);
91 public function write(ByteBufferWriter $out) : void{
92 LE::writeFloat($out, $this->totalTime);
93 Byte::writeUnsigned($out, $this->easeType);
95 VarInt::writeUnsignedInt($out, count($this->curve));
96 foreach($this->curve as $point){
97 CommonTypes::putVector3($out, $point);
100 VarInt::writeUnsignedInt($out, count($this->progressKeyFrames));
101 foreach($this->progressKeyFrames as $keyFrame){
102 CommonTypes::putVector2($out, $keyFrame);
105 VarInt::writeUnsignedInt($out, count($this->rotationOptions));
106 foreach($this->rotationOptions as $option){
107 $option->write($out);