advanceIv = 1.0 / $fps; $style = new $style(); $this->frames = $style->getFrames(); } public function __toString() { $now = microtime(true); if ($this->lastAdvance + $this->advanceIv < $now) { $this->frame = ($this->frame + 1) % count($this->frames); $this->lastAdvance = $now; } return $this->frames[$this->frame]; } }