var tfx_handlers = {}; function tfx_func_swap_idx_by_coru() { this.idx.a = (this.coru=="c")?this.idx.f:this.idx.t; this.idx.b = (this.coru=="c")?this.idx.t:this.idx.f; }; function tfx_func_anim(rec) { var verb = rec["verb"] || this.verb; var dura = rec["dura"] || this.ttime; var delay = rec["delay"] || 0; var easing = this.easing || "ease"; var direction = !this.b_reverse ? "normal" : "reverse"; return { "animation-name":"kf-sshow-tfx-"+verb+"-"+rec["name"], "animation-duration":dura+"s", "animation-timing-function":easing, "animation-direction":direction, "animation-delay":delay+"s", "animation-iteration-count":1, "animation-fill-mode":"both" }; }; function tfx_func_core(pt) { var verb = this.verb_core || this.verb; if ( this.idx[pt] == undefined ) { this.idx[pt] = (pt=="a")?this.idx.f:this.idx.t; } var jqo = CSlideMan.create(this.idx[pt]); if ( this.init[pt] ) { jqo.addClass("init-sshow-tfx-"+verb+"-"+this.init[pt]) } if ( this.kf[pt] ) { jqo.css(tfx_func_anim.call(this,{ verb:verb, name:this.kf[pt] })); } jqo.appendTo(sshow.jqo_slide_w); }; function tfx_func_render() { tfx_func_core.call(this,"a"); tfx_func_core.call(this,"b"); }; tfx_handlers["fade"] = function() { this.kf.a = "f"; this.kf.b = "t"; tfx_func_render.call(this); }; tfx_handlers["zoom"] = function() { tfx_func_swap_idx_by_coru.call(this); this.init.b = "t"; this.kf.b = "t-"+this.coru; tfx_func_render.call(this); }; tfx_handlers["scroll"] = function() { this.kf.a = "f-"+this.dir; this.kf.b = "t-"+this.dir; tfx_func_render.call(this); }; tfx_handlers["turn"] = function() { this.init.a = "f-"+this.dir; this.kf.a = "f-"+this.dir; this.init.b = "t-"+this.dir; this.kf.b = "t-"+this.dir; tfx_func_render.call(this); }; tfx_handlers["cover"] = function() { this.verb_core = "cover"; this.coru = "c"; tfx_func_swap_idx_by_coru.call(this); this.init.b = this.dir; this.kf.b = "t-"+this.coru+"-"+this.dir; tfx_func_render.call(this,"cover"); }; tfx_handlers["uncover"] = function() { this.verb_core = "cover"; this.coru = "u"; tfx_func_swap_idx_by_coru.call(this); this.init.b = this.dir; this.kf.b = "t-"+this.coru+"-"+this.dir; tfx_func_render.call(this,"cover"); }; tfx_handlers["bounce"] = function() { tfx_func_swap_idx_by_coru.call(this); this.init.b = this.dir; this.kf.b = "t-"+this.coru+"-"+this.dir; tfx_func_render.call(this); }; var kenburns_n = -1; tfx_handlers["kenburns"] = function() { if ( this.dir == "random" ) { var n = Math.floor(Math.random() * 5); if ( kenburns_n == n ) { n = ((n + 1) % 5); } kenburns_n = n; switch( n ) { case 0: dir = "cc"; break; case 1: dir = "tl"; break; case 2: dir = "tr"; break; case 3: dir = "br"; break; case 4: dir = "bl"; break; } } else { dir = this.dir; } this.init.a = dir; this.kf.a = "f"; this.init.b = dir; this.kf.b = "t"; tfx_func_render.call(this); }; tfx_handler_slice = function() { var size = sshow.getSlideSize(); tfx_func_swap_idx_by_coru.call(this); CSlideMan.create(this.idx.a).appendTo(sshow.jqo_slide_w); var jqo_b = CSlideMan.create(this.idx.b); var jqo_board = $("
") .addClass("slide-base") .appendTo(sshow.jqo_slide_w); var b_lr_dir; switch ( this.verb ) { case "slice": b_lr_dir = ((this.dir=="left")||(this.dir=="right")); break; case "blind": b_lr_dir = ((this.dir=="up")||(this.dir=="down")); break; } var nos,dw,dh,remainder,rw,rh; if ( b_lr_dir ) { nos = Math.min(this.nos,size.h); dh = Math.floor(size.h / nos); remainder = size.h % nos; rw = size.w; } else { nos = Math.min(this.nos,size.w); dw = Math.floor(size.w / nos); remainder = size.w % nos; rh = size.h; } var x = 0; var y = 0; var jqo_clip = []; for( var i = 0; i < nos; i++ ) { if ( b_lr_dir ) { rh = dh; if ( 0 < remainder ) { rh += 1; remainder--; } } else { rw = dw; if ( 0 < remainder ) { rw += 1; remainder--; } } jqo_clip[i] = $("
") .css({ position:"absolute", left:x+"px", top:y+"px", width:rw+"px", height:rh+"px", overflow:"hidden", }) .html($("
") .attr("class","slice-board") .css({ position:"relative", width:rw+"px", height:rh+"px", overflow:"hidden", }) .html($("
") .addClass("slide-base") .css({ top:-y+"px", left:-x+"px", width:size.w+"px", height:size.h+"px" }) .html( jqo_b.clone() ) ) ) .appendTo(jqo_board); if ( b_lr_dir ) { y += rh; } else { x += rw; } } var half = this.ttime/2; var dt = half/nos; for( var i = 0; i < nos; i++ ) { var delay = (!this.b_reverse?dt*i:dt*(nos-i-1)); jqo_clip[i].find(".slice-board").css(tfx_func_anim.call(this,{ "verb":"slice", "name":this.coru+"-"+this.dir, "dura":half, "delay":delay })); } }; tfx_handlers["slice"] = function() { tfx_handler_slice.call(this); }; tfx_handlers["blind"] = function() { tfx_handler_slice.call(this); }; tfx_handlers["gate"] = function() { var size = sshow.getSlideSize(); tfx_func_swap_idx_by_coru.call(this); CSlideMan.create(this.idx.a).appendTo(sshow.jqo_slide_w); var jqo_b = CSlideMan.create(this.idx.b); var jqo_board = $("
") .addClass("slide-base") .appendTo(sshow.jqo_slide_w); var _this = this; var func_create = function(px){ var ctar_css = { position:"absolute", width:px.ctar_w+"px", height:px.ctar_h+"px", overflow:"hidden", }; if ( px.ctar_t != undefined ) { ctar_css.top = px.ctar_t; } if ( px.ctar_b != undefined ) { ctar_css.bottom = px.ctar_b; } if ( px.ctar_l != undefined ) { ctar_css.left = px.ctar_l; } if ( px.ctar_r != undefined ) { ctar_css.right = px.ctar_r; } return $("
") .css(ctar_css) .html($("
") .attr("class","slice-board") .css({ position:"relative", width:px.slice_w+"px", height:px.slice_h+"px", overflow:"hidden" }) .html($("
") .addClass("slide-base") .css({ top:px.shift_t+"px", left:px.shift_l+"px", width:size.w+"px", height:size.h+"px" }) .html( jqo_b.clone() ) ) ) .appendTo(jqo_board) .find(".slice-board").css(tfx_func_anim.call(_this,{ "name":_this.coru+"-"+px.key })); }; switch( this.dir ) { case "hori": var dr = Math.floor(size.w / 2); var dl = dr+(size.w % 2); func_create({ key:"l", ctar_l:0, ctar_w:dl, ctar_h:size.h, slice_w:dl, slice_h:size.h, shift_l:0 }); func_create({ key:"r", ctar_r:0, ctar_w:dr, ctar_h:size.h, slice_w:dr, slice_h:size.h, shift_l:-dl }); break; case "vert": var dt = Math.floor(size.h / 2); var db = dt+(size.h % 2); func_create({ key:"t", ctar_t:0, ctar_w:size.w, ctar_h:dt, slice_w:size.w, slice_h:dt, shift_t:0 }); func_create({ key:"b", ctar_b:0, ctar_w:size.w, ctar_h:db, slice_w:size.w, slice_h:db, shift_t:-dt }); break; } };