public function create($frames, $durations = 10, $loop = null)
    {
        if (count($frames) < 2) {
            throw new \Exception(sprintf($this->errors[ 'ERR06' ]));
        }

        // Update loop value if passed in.
        $this->mergeConfigIfSet('loop', $loop);

        // Check if $frames is a dir; get all files in ascending order if yes (else die):
        if (! is_array($frames)) {
            if (is_dir($frames)) {
                $this->frames_dir = $frames;
                if ($frames = scandir($this->frames_dir)) {
                    $frames = array_filter($frames, function ($dir) {
                        return $dir[ 0 ] != ".";
                    });
                    array_walk($frames, function (&$dir) {
                        $dir = $this->frames_dir.DIRECTORY_SEPARATOR."$dir";
                    });
                }
            }
            if (! is_array($frames)) {
                throw new \Exception(sprintf($this->errors[ 'ERR05' ], $this->frames_dir));
            }
        }

        assert(is_array($frames));

        if (sizeof($frames) < 2) {
            throw new \Exception($this->errors[ 'ERR00' ]);
        }

        return $this->buildFrameSources($frames, $durations);
    }