if ($this->_isFinallyHidden($animations)) {
$res .= ' data-animation-hide-on-leave ';
}
+ if ($s = $this->_isZoomedIn($animations)) {
+ $res .= ' data-animation-zoomed-in="' . $s . '" ';
+ }
+
+ if ($s = $this->_isZoomedOut($animations)) {
+ $res .= ' data-animation-zoomed-out="' . $s . '" ';
+ }
}
if ($this->parallax != 0) {
return 0;
}
+ protected function _isZoomedIn($animations)
+ {
+ return $this->_hasAnimation($animations, ['zoomin', 'scaleto'], 'scale');
+ }
+
+ protected function _isZoomedOut($animations)
+ {
+ return $this->_hasAnimation($animations, ['zoomout', 'scalefrom'], 'scale');
+ }
+
protected function _isFinallyHidden($animations)
{
- $hiddenAnimations = ['fadeout', 'unmask'];
+ return $this->_hasAnimation($animations, ['fadeout', 'unmask']);
+ }
+
+ protected function _hasAnimation($animations, $types, $return = null)
+ {
foreach ($animations as $animation) {
- if (isset($animation['type']) && in_array($animation['type'], $hiddenAnimations)) {
- return true;
+ if (isset($animation['type']) && in_array($animation['type'], $types)) {
+ if ($return === null) {
+ return true;
+ }
+ return $animation[$return];
}
}
return false;