setTimeout(function () {
$this.fluidbook.initVideos();
$this.initInlineSlideshows();
+ $this.initAnimatedContentsLinks();
}, 200);
this.resize();
},
+ initAnimatedContentsLinks: function () {
+ $(".contentLink[data-animation]").each(function () {
+ var animation = $(this).data('animation');
+ if (animation.type === undefined || animation.type === '') {
+ return;
+ }
+ var from = {};
+ var to = {};
+ var duration = 0.5;
+ if (animation.duration !== undefined) {
+ duration = parseFloat(animation.duration);
+ }
+ if (animation.ease !== undefined) {
+ to.ease = animation.ease;
+ }
+ if (animation.delay !== undefined) {
+ to.delay = parseFloat(animation.delay);
+ }
+ if (animation.type === 'fadein') {
+ from.opacity = 0;
+ to.opacity = 1;
+ } else if (animation.type === 'fadeout') {
+ from.opacity = 1;
+ to.opacity = 0;
+ } else if (animation.type === "unmask" || animation.type === 'reveal') {
+ var w = parseFloat($(this).css('width'));
+ var h = parseFloat($(this).css('height'));
+
+ var top = 0;
+ var right = w;
+ var bottom = h;
+ var left = 0;
+
+ var rectinit = 'rect(0px,' + w + 'px,' + h + 'px,0px)';
+ if ((animation.direction === 'left' && animation.type === 'unmask') ||
+ (animation.direction === 'right' && animation.type === 'reveal')) {
+ right = 0;
+ } else if ((animation.direction === 'right' && animation.type === 'unmask') ||
+ (animation.direction === 'left' && animation.type === 'reveal')) {
+ left = w;
+ } else if ((animation.direction === 'up' && animation.type === 'unmask') ||
+ (animation.direction === 'down' && animation.type === 'reveal')) {
+ bottom = 0;
+ } else if ((animation.direction === 'down' && animation.type === 'unmask') ||
+ (animation.direction === 'up' && animation.type === 'reveal')) {
+ top = h;
+ }
+ var rect = 'rect(' + top + 'px,' + right + 'px,' + bottom + 'px,' + left + 'px);';
+
+ if (animation.type === 'unmask') {
+ to.clip = rect;
+ from.clip = rectinit;
+ } else if (animation.type === 'reveal') {
+ to.clip = rectinit;
+ from.clip = rect;
+ }
+ }
+
+ $(this).show();
+ console.log(duration, from, to);
+ TweenMax.fromTo($(this), duration, from, to);
+ });
+ },
+
getLinkDataById: function (uid) {
return this.fluidbook.datas.linksData[uid];
},