image imgs.eq(0).css({ visibility: 'visible' }); if (! sleep) imgs.eq(0).css(position_to_css(plan[0], 2)); // create animation chain var countdown = opts.loop; function create_chain(i, chainf) { // building the chain backwards, or inside out if (i % 2 == 0) { if (sleep) { // still image sleep var i_sleep = i / 2, i_hide = (i_sleep - 1 + plan.length) % plan.length, img_sleep = imgs.eq(i_sleep), img_hide = imgs.eq(i_hide); var newf = function() { img_hide.css('visibility', 'hidden'); setTimeout(chainf, sleep); }; } else { // single image slide var i_slide = i / 2, i_hide = (i_slide - 1 + plan.length) % plan.length, img_slide = imgs.eq(i_slide), img_hide = imgs.eq(i_hide), time = plan[i_slide].time_ms, slide_anim = position_to_css(plan[i_slide], 3); var newf = function() { img_hide.css('visibility', 'hidden'); img_slide.animate(slide_anim, time, 'linear', chainf); }; } } else { if (sleep) { // still image cross-fade var i_from = Math.floor(i / 2), i_to = Math.ceil(i / 2) % plan.length, img_from = imgs.eq(i_from), img_to = imgs.eq(i_to), from_anim = {}, to_init = { visibility: 'visible' }, to_anim = {}; if (i_to > i_from) { to_init.opacity = 0; to_anim.opacity = 1; } else { from_anim.opacity = 0; } var newf = function() { img_to.css(to_init); if (from_anim.opacity != undefined) img_from.animate(from_anim, fade_ms, 'linear', chainf); else img_to.animate(to_anim, fade_ms, 'linear', chainf); }; } else { // cross-slide + cross-fade var i_from = Math.floor(i / 2), i_to = Math.ceil(i / 2) % plan.length, img_from = imgs.eq(i_from), img_to = imgs.eq(i_to), from_anim = position_to_css(plan[i_from], 4), to_init = position_to_css(plan[i_to], 1), to_anim = position_to_css(plan[i_to], 2); if (i_to > i_from) { to_init.opacity = 0; to_anim.opacity = 1; } else { from_anim.opacity = 0; } to_init.visibility = 'visible'; var newf = function() { img_from.animate(from_anim, fade_ms, 'linear'); img_to.css(to_init); img_to.animate(to_anim, fade_ms, 'linear', chainf); }; } } // if the loop option was requested, push a countdown check if (opts.loop && i == plan.length * 2 - 2) { var newf_orig = newf; newf = function() { if (--countdown) newf_orig(); } } if (i > 0) return create_chain(i - 1, newf); else return newf; } var animation = create_chain(plan.length * 2 - 1, function() { return animation(); }); // start animation animation(); }); return self; }; طب
الثلاثاء, 16 جمادى الأولى 1424 10:45 ص

قائمة المواقع الطبية

أخرى خدمات