Only move across frames if shift greater than 1

This commit is contained in:
DataHoarder 2021-12-31 17:12:01 +01:00
parent 0643bcc333
commit bc592291bb

View file

@ -70,8 +70,10 @@ class positionTag implements ASSPositioningTag {
$frame = $line->end - $line->start;
$hasMoved = $this->start < $frame;
$shift = $this->end - $this->start;
if($hasMoved){
return "\\move(" . $this->from->x ."," . $this->from->y ."," . $this->to->x ."," . $this->to->y .",".ceil(($this->start - 1) * $frameDurationMs).",".floor($this->end * $frameDurationMs).")";
return "\\move(" . $this->from->x ."," . $this->from->y ."," . $this->to->x ."," . $this->to->y .",".ceil(($shift > 1 ? ($this->start - 1) : $this->end) * $frameDurationMs).",".floor($this->end * $frameDurationMs).")";
}
return "\\pos(".$this->from->x ."," . $this->from->y.")";
}