Сам еще не до конца разбираюсь, но, помоему, это сильно сказывается на скорости загрузки?
<div class='anim'>
<div class='animated anim-bg-1'></div>
<div class='animated anim-bg-2'></div>
<div class='animated anim-bg-1 dop'></div>
</div>
<div class='page'>
<p>Контент страницы</p>
</div>
.anim {
position: fixed;
top: 0; left: 0;
width: 100%; height: 100%;
overflow: hidden;
}
@keyframes GO {
0% { transform: translate(0, 0); }
100% { transform: translate(0, -200%); }
}
.animated {
animation: GO 7s infinite;
}
.anim-bg-1 {
position: absolute;
top: 0; left: 0;
width: 100%; height: 100%;
background: red;
}
.dop {
top: 200%;
}
.anim-bg-2 {
position: absolute;
top: 100%; left: 0;
width: 100%; height: 100%;
background: green;
}
.page {
position: absolute;
top: 0; left: 0;
width: 100%;
color: #fff;
}
<?php
namespace View;
use Controller\Error;
use Twig_Environment;
use Twig_Loader_Filesystem;
class TwigView implements IView
{
/**
* @var Twig_Environment
*/
private $twig;
/**
* @var Twig_Loader_Filesystem
*/
private $loader;
/**
* @var string
*/
private $template;
/**
* @var array
*/
private $params;
/**
* @param string $template Имя шаблона
* @param array $params Передаваемые параметры
*/
public function __construct($template, $params)
{
$this->loader = new Twig_Loader_Filesystem(TEMPLATE_DIR);
$this->twig = new Twig_Environment($this->loader);
$this->template = $template;
$this->params = $params;
}
/**
* @return string
*/
public function render()
{
try {
return $this->twig->render($this->template, $this->params);
} catch (\Twig_Error_Loader $e) {
$error = new Error();
$error->index404();
}
}
}
public function index()
{
$this->isAuthorized('users');
try {
$twig = new TwigView('Users/ShowAllUsers.twig',
[
'session' => $_SESSION,
'user' => $this->em->getRepository('Model\User')->getAll()
]
);
print $twig->render();
} catch (DatabaseException $e) {
$error = new Error();
$error->index1010($e->getMessage());
}
}