$this->out = storage_path('fluidbook/out/');
/** @var Media $demo */
- $demo = $this->pub->getMediaInField($this->pub->getAttributeValue('animdemo'))->first()->getPath();
- $path = storage_path('fluidbook/demo/');
- Files::rmdir($path);
- Zip::extract($demo, $path);
+ $fdemo = $this->pub->getMediaInField($this->pub->getAttributeValue('animdemo'))->first();
+ if ($fdemo) {
+ $demo = $fdemo->getPath();
+ $path = storage_path('fluidbook/demo/');
+ Files::rmdir($path);
+ Zip::extract($demo, $path);
+ }
}
/**
$e = explode(':', $link['to']);
$ee = explode('/', $e[0]);
- if ($e[0] === 'pdf') {
+ if ($ee[0] == 'anim') {
+ $base = [['ease' => 'Power2.easeOut', 'duration' => 1.5, 'backgroundColor' => '#ffffff', 'transformOrigin' => 'center', 'delay' => 1], []];
+ switch ($ee[1]) {
+ case 'fadein':
+ $link['type'] = 14;
+ $base[0]['type'] = 'fadeout';
+ $base[0]['ease'] = 'Power0.easeInOut';
+ break;
+ case 'appearfromtop':
+ case 'appearfrombottom':
+ $link['type'] = 39;
+ $base[0]['type'] = 'translatefrom';
+ $base[0]['y'] = 100 * ($ee[1] == 'appearfromtop' ? -1 : 1);
+ $base[1]['type'] = 'fadein';
+ break;
+ case 'zoomout':
+ $link['type'] = 39;
+ $base[0]['type'] = 'zoomout';
+ $base[0]['scale'] = 1.3;
+ $base[0]['duration'] = 3;
+ $base[0]['ease'] = 'Power0.easeOut';
+ break;
+ }
+
+ if (isset($e[1]) && $e[1] !== '') {
+ $overriden = explode('&', $e[1]);
+ foreach ($overriden as $i => $o) {
+ if ($i === 0) {
+ if ($link['type'] == 14) {
+ $link['to'] = $o;
+ } else {
+ $base[0]['backgroundColor'] = $o;
+ }
+ } else {
+ $eo = explode('=', $o);
+ if (count($eo) == 2) {
+ $base[0][$eo[0]] = $eo[1];
+ }
+ }
+ }
+ }
+ $anim = '';
+
+ foreach ($base as $item) {
+ if (!count($item)) {
+ continue;
+ }
+ foreach ($item as $k => $v) {
+ $anim .= $k . '=' . $v . "\n";
+ }
+ $anim .= '---' . "\n";
+ }
+ $link['image_rollover'] = $anim;
+ } else if ($e[0] === 'pdf') {
$cc = explode('#', $e[1]);
$link['type'] = 16;
$link['to'] = $this->_getAssetFile($cc[0]);