29 lines
861 B
PHP
29 lines
861 B
PHP
<?php
|
|
|
|
namespace swf2ass;
|
|
|
|
class MoveRecord implements Record {
|
|
public Vector2 $start;
|
|
public Vector2 $coord;
|
|
|
|
public function __construct(Vector2 $coord, Vector2 $start) {
|
|
$this->coord = $coord;
|
|
$this->start = $start;
|
|
}
|
|
|
|
public function getStart(): Vector2 {
|
|
return $this->start;
|
|
}
|
|
|
|
public function reverse(): MoveRecord {
|
|
return new MoveRecord($this->start, $this->coord);
|
|
}
|
|
|
|
public static function fromXML(\DOMElement $element, Vector2 $cursor): MoveRecord {
|
|
return new MoveRecord(new Vector2((int)$element->getAttribute("x"), (int)$element->getAttribute("y")), $cursor);
|
|
}
|
|
|
|
public function applyMatrixTransform(MatrixTransform $transform): MoveRecord {
|
|
return new MoveRecord($transform->applyToVector($this->coord), $transform->applyToVector($this->start));
|
|
}
|
|
} |