1/** 2 * jQuery Skitter Slideshow 3 * @name jquery.skitter.js 4 * @description Slideshow 5 * @author Thiago Silva Ferreira - http://thiagosf.net 6 * @version 4.4.0 7 * @created August 04, 2010 8 * @updated July 01, 2015 9 * @copyright (c) 2010 Thiago Silva Ferreira - http://thiagosf.net 10 * @license Dual licensed under the MIT or GPL Version 2 licenses 11 * @example http://thiagosf.net/projects/jquery/skitter/ 12 */ 13;(function($) { 14 15 var number_skitter = 0, 16 skitters = []; 17 18 $.fn.skitter = function(options) { 19 return this.each(function() { 20 if ( $(this).data('skitter_number') == undefined ) { 21 $(this).data('skitter_number', number_skitter); 22 skitters.push(new $sk(this, options, number_skitter)); 23 ++number_skitter; 24 } 25 }); 26 }; 27 28 var defaults = { 29 // Animation velocity 30 velocity: 1, 31 32 // Interval between transitions 33 interval: 2500, 34 35 // Default animation 36 animation: '', 37 38 // Numbers display 39 numbers: true, 40 41 // Navigation display 42 navigation: true, 43 44 // Label display 45 label: true, 46 47 // Easing default 48 easing_default: '', 49 50 // The skitters box (internal) 51 box_skitter: null, 52 53 // @deprecated 54 time_interval: null, 55 56 // Image link (internal) 57 images_links: null, 58 59 // Actual image (internal) 60 image_atual: null, 61 62 // Actual link (internal) 63 link_atual: null, 64 65 // Actual label (internal) 66 label_atual: null, 67 68 // Actual target (internal) 69 target_atual: '_self', 70 71 // Skitter width (internal) 72 width_skitter: null, 73 74 // Skitter height (internal) 75 height_skitter: null, 76 77 // Image number loop (internal) 78 image_i: 1, 79 80 // Is animating (internal) 81 is_animating: false, 82 83 // Is hover box_skitter (internal) 84 is_hover_box_skitter: false, 85 86 // Smart randomly (internal) 87 random_ia: null, 88 89 // Randomly sliders 90 show_randomly: false, 91 92 // Navigation with thumbs 93 thumbs: false, 94 95 // Animation/style number/dot 96 animateNumberOut: false, 97 98 // Animation/style hover number/dot 99 animateNumberOver: false, 100 101 // Animation/style active number/dot 102 animateNumberActive: false, 103 104 // Hide numbers and navigation 105 hideTools: false, 106 107 // Fullscreen mode 108 fullscreen: false, 109 110 // Loading data from XML file 111 xml: false, 112 113 // Navigation with dots 114 dots: false, 115 116 // Width label 117 width_label: null, 118 119 // Final opacity of elements in hideTools 120 opacity_elements: 0.75, 121 122 // Interval animation hover elements hideTools 123 interval_in_elements: 200, 124 125 // Interval animation out elements hideTools 126 interval_out_elements: 300, 127 128 // Onload Callback 129 onLoad: null, 130 131 // Function call to change image 132 imageSwitched: null, 133 134 // @deprecated 135 max_number_height: 20, 136 137 // Alignment of numbers/dots/thumbs 138 numbers_align: 'left', 139 140 // Preview with dots 141 preview: false, 142 143 // Focus slideshow 144 focus: false, 145 146 // Focus active (internal) 147 foucs_active: false, 148 149 // Position of button focus slideshow 150 focus_position: 'center', 151 152 // Option play/pause manually 153 controls: false, 154 155 // Position of button controls 156 controls_position: 'center', 157 158 // Displays progress bar 159 progressbar: false, 160 161 // CSS progress bar 162 progressbar_css: {}, 163 164 // Is paused (internal) 165 is_paused: false, 166 167 // Is blur (internal) 168 is_blur: false, 169 170 // Is paused time (internal) 171 is_paused_time: false, 172 173 // Time start (internal) 174 timeStart: 0, 175 176 // Elapsed time (internal) 177 elapsedTime: 0, 178 179 // Stop animation to move mouse over it. 180 stop_over: true, 181 182 // Enable navigation keys 183 enable_navigation_keys: false, 184 185 // Specific animations 186 with_animations: [], 187 188 // Function call to go over the navigation buttons 189 // mouseOverButton: function() { $(this).stop().animate({opacity:0.5}, 200); }, 190 mouseOverButton: null, 191 192 // Function call to go out the navigation buttons 193 // mouseOutButton: function() { $(this).stop().animate({opacity:1}, 200); }, 194 mouseOutButton: null, 195 196 // Sets whether the slideshow will start automatically 197 auto_play: true, 198 199 // Label animation type 200 labelAnimation: 'slideUp', 201 202 // Theme 203 theme: null, 204 205 // Structure (internal) 206 structure: '<a href="#" class="prev_button">prev</a>' 207 + '<a href="#" class="next_button">next</a>' 208 + '<span class="info_slide"></span>' 209 + '<div class="container_skitter">' 210 + '<div class="image">' 211 + '<a href=""><img class="image_main" /></a>' 212 + '<div class="label_skitter"></div>' 213 + '</div>' 214 + '</div>' 215 216 }; 217 218 $.skitter = function(obj, options, number) { 219 this.box_skitter = $(obj); 220 this.timer = null; 221 this.settings = $.extend({}, defaults, options || {}); 222 this.number_skitter = number; 223 this.setup(); 224 }; 225 226 // Shortcut 227 var $sk = $.skitter; 228 229 $sk.fn = $sk.prototype = {}; 230 231 $sk.fn.extend = $.extend; 232 233 $sk.fn.extend({ 234 235 /** 236 * Init 237 */ 238 setup: function() 239 { 240 var self = this; 241 242 // Fullscreen 243 if (this.settings.fullscreen) { 244 var width = $(window).width(); 245 var height = $(window).height(); 246 this.box_skitter.width(width).height(height); 247 this.box_skitter.css({'position':'absolute', 'top':0, 'left':0, 'z-index':1000}); 248 this.settings.stop_over = false; 249 $('body').css({'overflown':'hidden'}); 250 } 251 252 this.settings.width_skitter = parseFloat(this.box_skitter.css('width')); 253 this.settings.height_skitter = parseFloat(this.box_skitter.css('height')); 254 255 if (!this.settings.width_skitter || !this.settings.height_skitter) { 256 console.warn('Width or height size is null! - Skitter Slideshow'); 257 return false; 258 } 259 260 // Theme 261 if ( this.settings.theme ) { 262 this.box_skitter.addClass('skitter-' + this.settings.theme); 263 } 264 265 // Structure html 266 this.box_skitter.append(this.settings.structure); 267 268 // Settings 269 this.settings.easing_default = this.getEasing(this.settings.easing); 270 271 if (this.settings.velocity >= 2) this.settings.velocity = 1.3; 272 if (this.settings.velocity <= 0) this.settings.velocity = 1; 273 274 this.box_skitter.find('.info_slide').hide(); 275 this.box_skitter.find('.label_skitter').hide(); 276 this.box_skitter.find('.prev_button').hide(); 277 this.box_skitter.find('.next_button').hide(); 278 279 this.box_skitter.find('.container_skitter').width(this.settings.width_skitter); 280 this.box_skitter.find('.container_skitter').height(this.settings.height_skitter); 281 282 var width_label = this.settings.width_label ? this.settings.width_label : this.settings.width_skitter; 283 this.box_skitter.find('.label_skitter').width(width_label); 284 285 var initial_select_class = ' image_number_select', u = 0; 286 this.settings.images_links = new Array(); 287 288 // Add image, link, animation type and label 289 var addImageLink = function (link, src, animation_type, label, target) { 290 self.settings.images_links.push([src, link, animation_type, label, target]); 291 if (self.settings.thumbs) { 292 var dimension_thumb = ''; 293 if (self.settings.width_skitter > self.settings.height_skitter) { 294 dimension_thumb = 'height="100"'; 295 } 296 else { 297 dimension_thumb = 'width="100"'; 298 } 299 self.box_skitter.find('.info_slide').append( 300 '<span class="image_number'+initial_select_class+'" rel="'+(u - 1)+'" id="image_n_'+u+'_'+self.number_skitter+'">' 301 +'<img src="'+src+'" '+dimension_thumb+' />' 302 +'</span> ' 303 ); 304 } 305 else { 306 self.box_skitter.find('.info_slide').append( 307 '<span class="image_number'+initial_select_class+'" rel="'+(u - 1)+'" id="image_n_'+u+'_'+self.number_skitter+'">'+u+'</span> ' 308 ); 309 } 310 initial_select_class = ''; 311 }; 312 313 // Load from XML 314 if (this.settings.xml) { 315 $.ajax({
316 type: 'GET', 317 url: this.settings.xml, 318 async: false, 319 dataType: 'xml', 320 success: function(xml) { 321 var ul = $('<ul></ul>'); 322 $(xml).find('skitter slide').each(function(){ 323 ++u; 324 var link = ($(this).find('link').text()) ? $(this).find('link').text() : '#'; 325 var src = $(this).find('image').text(); 326 var animation_type = $(this).find('image').attr('type'); 327 var label = $(this).find('label').text(); 328 var target = ($(this).find('target').text()) ? $(this).find('target').text() : '_self'; 329 addImageLink(link, src, animation_type, label, target); 330 }); 331 } 332 }); 333 } 334 // Load from json 335 else if (this.settings.json) { 336 337 } 338 // Load from HTML 339 else { 340 this.box_skitter.find('ul li').each(function(){ 341 ++u; 342 var link = ($(this).find('a').length) ? $(this).find('a').attr('href') : '#'; 343 var src = $(this).find('img').attr('src'); 344 var animation_type = $(this).find('img').attr('class'); 345 var label = $(this).find('.label_text').html(); 346 var target = ($(this).find('a').length && $(this).find('a').attr('target')) ? $(this).find('a').attr('target') : '_self'; 347 addImageLink(link, src, animation_type, label, target); 348 }); 349 } 350 351 // Thumbs 352 if (self.settings.thumbs && !self.settings.fullscreen) 353 { 354 // New animation 355 self.settings.animateNumberOut = {opacity:0.3}; 356 self.settings.animateNumberOver = {opacity:0.5}; 357 self.settings.animateNumberActive = {opacity:1}; 358 359 self.box_skitter.find('.info_slide').addClass('info_slide_thumb'); 360 var width_info_slide = (u + 1) * self.box_skitter.find('.info_slide_thumb .image_number').width(); 361 self.box_skitter.find('.info_slide_thumb').width(width_info_slide); 362 self.box_skitter.css({height:self.box_skitter.height() + self.box_skitter.find('.info_slide').height()}); 363 364 self.box_skitter.append('<div class="container_thumbs"></div>'); 365 var copy_info_slide = self.box_skitter.find('.info_slide').clone(); 366 self.box_skitter.find('.info_slide').remove(); 367 self.box_skitter.find('.container_thumbs') 368 .width(self.settings.width_skitter) 369 .append(copy_info_slide); 370 371 // Scrolling with mouse movement 372 var width_image = 0, 373 width_skitter = this.settings.width_skitter, 374 height_skitter = this.settings.height_skitter, 375 w_info_slide_thumb = 0, 376 info_slide_thumb = self.box_skitter.find('.info_slide_thumb'), 377 x_value = 0, 378 y_value = self.box_skitter.offset().top; 379 380 info_slide_thumb.find('.image_number').each(function(){ 381 width_image += $(this).outerWidth(); 382 }); 383 384 info_slide_thumb.width(width_image+'px'); 385 w_info_slide_thumb = info_slide_thumb.width(); 386 width_value = this.settings.width_skitter; 387 388 width_value = width_skitter - 100; 389 390 if (width_info_slide > self.settings.width_skitter) { 391 self.box_skitter.mousemove(function(e){ 392 x_value = self.box_skitter.offset().left + 90; 393 394 var x = e.pageX, y = e.pageY, new_x = 0; 395 396 x = x - x_value; 397 y = y - y_value; 398 novo_width = w_info_slide_thumb - width_value; 399 new_x = -((novo_width * x) / width_value); 400 401 if (new_x > 0) new_x = 0; 402 if (new_x < -(w_info_slide_thumb - width_skitter)) new_x = -(w_info_slide_thumb - width_skitter); 403 404 if (y > height_skitter) { 405 info_slide_thumb.css({left: new_x}); 406 } 407 }); 408 } 409 410 self.box_skitter.find('.scroll_thumbs').css({'left':10}); 411 412 if (width_info_slide < self.settings.width_skitter) { 413 self.box_skitter.find('.info_slide').width('auto'); 414 self.box_skitter.find('.box_scroll_thumbs').hide(); 415 416 var class_info = '.info_slide'; 417 switch (self.settings.numbers_align) { 418 case 'center' : 419 var _vleft = (self.settings.width_skitter - self.box_skitter.find(class_info).width()) / 2; 420 self.box_skitter.find(class_info).css({'left':_vleft}); 421 break; 422 423 case 'right' : 424 self.box_skitter.find(class_info).css({'left':'auto', 'right':'-5px'}); 425 break; 426 427 case 'left' : 428 self.box_skitter.find(class_info).css({'left':'0px'}); 429 break; 430 } 431 } 432 433 } 434 else 435 { 436 var class_info = '.info_slide'; 437 438 if (self.settings.dots) { 439 self.box_skitter.find('.info_slide').addClass('info_slide_dots').removeClass('info_slide'); 440 class_info = '.info_slide_dots'; 441 } 442 443 switch (self.settings.numbers_align) { 444 case 'center' : 445 var _vleft = (self.settings.width_skitter - self.box_skitter.find(class_info).width()) / 2; 446 self.box_skitter.find(class_info).css({'left':_vleft}); 447 break; 448 449 case 'right' : 450 self.box_skitter.find(class_info).css({'left':'auto', 'right':'15px'}); 451 break; 452 453 case 'left' : 454 self.box_skitter.find(class_info).css({'left':'15px'}); 455 break; 456 } 457 458 if (!self.settings.dots) { 459 if (self.box_skitter.find('.info_slide').height() > 20) { 460 self.box_skitter.find('.info_slide').hide(); 461 } 462 } 463 } 464 465 this.box_skitter.find('ul').hide(); 466 467 if (this.settings.show_randomly) 468 this.settings.images_links.sort(function(a,b) {return Math.random() - 0.5;}); 469 470 this.settings.image_atual = this.settings.images_links[0][0]; 471 this.settings.link_atual = this.settings.images_links[0][1]; 472 this.settings.label_atual = this.settings.images_links[0][3]; 473 this.settings.target_atual = this.settings.images_links[0][4]; 474 475 if (this.settings.images_links.length > 1) 476 { 477 this.box_skitter.find('.prev_button').click(function() { 478 if (self.settings.is_animating == false) { 479 480 self.settings.image_i -= 2; 481 482 if (self.settings.image_i == -2) { 483 self.settings.image_i = self.settings.images_links.length - 2; 484 } 485 else if (self.settings.image_i == -1) { 486 self.settings.image_i = self.settings.images_links.length - 1; 487 } 488 489 self.jumpToImage(self.settings.image_i); 490 } 491 return false; 492 }); 493 494 this.box_skitter.find('.next_button').click(function() { 495 self.jumpToImage(self.settings.image_i); 496 return false; 497 }); 498 499 self.box_skitter.find('.next_button, .prev_button').bind('mouseover', self.settings.mouseOverButton); 500 self.box_skitter.find('.next_button, .prev_button').bind('mouseleave', self.settings.mouseOutButton); 501 502 this.box_skitter.find('.image_number').hover(function() { 503 if ($(this).attr('class') != 'image_number image_number_select') { 504 if ( self.settings.animateNumberOver ) { 505 $(this).stop().animate(self.settings.animateNumberOver, 300); 506 } 507 // $(this).stop().animate(self.settings.animateNumberOver, 300); 508 } 509 }, function(){ 510 if ($(this).attr('class') != 'image_number image_number_select') { 511 if ( self.settings.animateNumberOut ) { 512 $(this).stop().animate(self.settings.animateNumberOut, 500); 513 } 514 // $(this).stop().animate(self.settings.animateNumberOut, 500); 515 } 516 }); 517 518 this.box_skitter.find('.image_number').click(function(){ 519 if ($(this).attr('class') != 'image_number image_number_select') { 520 var imageNumber = parseInt($(this).attr('rel')); 521 self.jumpToImage(imageNumber); 522 } 523 return false; 524 }); 525 526 if ( self.settings.animateNumberOut ) { 527 this.box_skitter.find('.image_number').css(self.settings.animateNumberOut); 528 } 529 530 if ( self.settings.animateNumberActive ) { 531 this.box_skitter.find('.image_number:eq(0)').css(self.settings.animateNumberActive); 532 } 533 534 // this.box_skitter.find('.image_number').css(self.settings.animateNumberOut); 535 // this.box_skitter.find('.image_number:eq(0)').css(self.settings.animateNumberActive); 536 537 // Preview with dots 538 if (self.settings.preview && self.settings.dots) 539 { 540 var preview = $('<div class="preview_slide"><ul></ul></div>'); 541 542 for (var i = 0; i < this.settings.images_links.length; i++) { 543 var li = $('<li></li>'); 544 var img = $('<img />'); 545 img.attr('src', this.settings.images_links[i][0]); 546 li.append(img); 547 preview.find('ul').append(li); 548 } 549 550 var width_preview_ul = parseInt(this.settings.images_links.length * 100); 551 preview.find('ul').width(width_preview_ul); 552 $(class_info).append(preview); 553 554 self.box_skitter.find(class_info).find('.image_number').mouseenter(function() { 555 var _left_info = parseFloat(self.box_skitter.find(class_info).offset().left); 556 var _left_image = parseFloat($(this).offset().left); 557 var _left_preview = (_left_image - _left_info) - 43; 558 559 var rel = parseInt($(this).attr('rel')); 560 var image_current_preview = self.box_skitter.find('.preview_slide_current img').attr('src'); 561 var _left_ul = -(rel * 100); 562 563 self.box_skitter.find('.preview_slide').find('ul').animate({left: _left_ul}, {duration:200, queue: false, easing: 'easeOutSine'}); 564 self.box_skitter.find('.preview_slide').fadeTo(1,1).animate({left: _left_preview}, {duration:200, queue: false}); 565 }); 566 567 self.box_skitter.find(class_info).mouseleave(function() { 568 $('.preview_slide').animate({opacity: 'hide'}, {duration: 200, queue: false}); 569 }); 570 } 571 } 572 573 // Focus 574 if (self.settings.focus) { 575 self.focusSkitter(); 576 } 577 578 // Constrols 579 if (self.settings.controls) { 580 self.setControls(); 581 } 582 583 // Progressbar 584 if (self.settings.progressbar && self.settings.auto_play) { 585 self.addProgressBar(); 586 } 587 588 // hideTools 589 if (self.settings.hideTools) { 590 self.hideTools(); 591 } 592 593 // Navigation keys 594 if (self.settings.enable_navigation_keys) { 595 self.enableNavigationKeys(); 596 } 597 598 this.loadImages(); 599 }, 600 601 /** 602 * Load images 603 */ 604 loadImages: function () 605 { 606 var self = this; 607 608 var loading = $('<div class="loading">Loading</div>'); 609 this.box_skitter.append(loading); 610 var total = this.settings.images_links.length; 611 612 var u = 0; 613 $.each(this.settings.images_links, function(i) 614 { 615 var self_il = this; 616 var loading = $('<span class="image_loading"></span>'); 617 loading.css({position:'absolute', top:'-9999em'}); 618 self.box_skitter.append(loading); 619 var img = new Image(); 620 621 $(img).load(function () { 622 ++u; 623 if (u == total) { 624 self.box_skitter.find('.loading').remove(); 625 self.box_skitter.find('.image_loading').remove(); 626 self.start(); 627 } 628 }).error(function () { 629 self.box_skitter.find('.loading, .image_loading, .image_number, .next_button, .prev_button').remove(); 630 self.box_skitter.html('<p style="color:white;background:black;">Error loading images. One or more images were not found.</p>'); 631 }).attr('src', self_il[0]); 632 }); 633 }, 634 635 /** 636 * Start skitter 637 */ 638 start: function() 639 { 640 var self = this; 641 var init_pause = false; 642 643 if (this.settings.numbers || this.settings.thumbs) this.box_skitter.find('.info_slide').fadeIn(500); 644 if (this.settings.dots) this.box_skitter.find('.info_slide_dots').fadeIn(500); 645 if (this.settings.label) this.box_skitter.find('.label_skitter').show(); 646 if (this.settings.navigation) { 647 this.box_skitter.find('.prev_button').fadeIn(500); 648 this.box_skitter.find('.next_button').fadeIn(500); 649 } 650 651 if (self.settings.auto_play) { 652 self.startTime(); 653 } 654 655 self.windowFocusOut(); 656 self.setLinkAtual(); 657 658 self.box_skitter.find('.image a img').attr({'src': self.settings.image_atual}); 659 img_link = self.box_skitter.find('.image a'); 660 img_link = self.resizeImage(img_link); 661 img_link.find('img').fadeIn(1500); 662 663 self.setValueBoxText(); 664 self.showBoxText(); 665 666 if (self.settings.auto_play) { 667 self.stopOnMouseOver(); 668 } 669 670 var mouseOverInit = function() { 671 if (self.settings.stop_over) { 672 init_pause = true; 673 self.settings.is_hover_box_skitter = true; 674 self.clearTimer(true); 675 self.pauseProgressBar(); 676 } 677 }; 678 679 self.box_skitter.mouseover(mouseOverInit); 680 self.box_skitter.find('.next_button').mouseover(mouseOverInit); 681 682 if (self.settings.images_links.length > 1 && !init_pause) { 683 if (self.settings.auto_play) { 684 self.timer = setTimeout(function() { self.nextImage(); }, self.settings.interval); 685 } 686 } 687 else { 688 self.box_skitter.find('.loading, .image_loading, .image_number, .next_button, .prev_button').remove(); 689 } 690 691 if ($.isFunction(self.settings.onLoad)) self.settings.onLoad(self); 692 }, 693 694 /** 695 * Jump to image 696 */ 697 jumpToImage: function(imageNumber) 698 { 699 if (this.settings.is_animating == false) { 700 this.settings.elapsedTime = 0; 701 this.box_skitter.find('.box_clone').stop(); 702 this.clearTimer(true); 703 this.settings.image_i = Math.floor(imageNumber); 704 705 this.box_skitter.find('.image a').attr({'href': this.settings.link_atual}); 706 this.box_skitter.find('.image_main').attr({'src': this.settings.image_atual}); 707 this.box_skitter.find('.box_clone').remove(); 708 709 this.nextImage(); 710 } 711 }, 712 713 /** 714 * Next image 715 */ 716 nextImage: function() 717 { 718 var self = this; 719 720 animations_functions = [ 721 'cube', 722 'cubeRandom', 723 'block', 724 'cubeStop', 725 'cubeStopRandom', 726 'cubeHide', 727 'cubeSize', 728 'horizontal', 729 'showBars', 730 'showBarsRandom', 731 'tube', 732 'fade', 733 'fadeFour', 734 'paralell',
735 'blind', 736 'blindHeight', 737 'blindWidth', 738 'directionTop', 739 'directionBottom', 740 'directionRight', 741 'directionLeft', 742 'cubeSpread', 743 'glassCube', 744 'glassBlock', 745 'circles', 746 'circlesInside', 747 'circlesRotate', 748 'cubeShow', 749 'upBars', 750 'downBars', 751 'hideBars', 752 'swapBars', 753 'swapBarsBack', 754 'swapBlocks', 755 'cut' 756 ]; 757 758 if (self.settings.progressbar) self.hideProgressBar(); 759 760 animation_type = (this.settings.animation == '' && this.settings.images_links[this.settings.image_i][2]) ? 761 this.settings.images_links[this.settings.image_i][2] : (this.settings.animation == '' ? 'default' : this.settings.animation); 762 763 // RandomUnique 764 if (animation_type == 'randomSmart') 765 { 766 if (!this.settings.random_ia) { 767 animations_functions.sort(function() { 768 return 0.5 - Math.random(); 769 }); 770 this.settings.random_ia = animations_functions; 771 } 772 animation_type = this.settings.random_ia[this.settings.image_i]; 773 } 774 // Random 775 else if (animation_type == 'random') 776 { 777 var random_id = parseInt(Math.random() * animations_functions.length); 778 animation_type = animations_functions[random_id]; 779 } 780 // Specific animations 781 else if (self.settings.with_animations.length > 0) 782 { 783 var total_with_animations = self.settings.with_animations.length; 784 if (this.settings._i_animation == undefined) { 785 this.settings._i_animation = 0; 786 } 787 animation_type = self.settings.with_animations[this.settings._i_animation]; 788 ++this.settings._i_animation; 789 if (this.settings._i_animation >= total_with_animations) this.settings._i_animation = 0; 790 } 791 792 switch (animation_type) 793 { 794 case 'cube' : 795 this.animationCube(); 796 break; 797 case 'cubeRandom' : 798 this.animationCube({random:true}); 799 break; 800 case 'block' : 801 this.animationBlock(); 802 break; 803 case 'cubeStop' : 804 this.animationCubeStop(); 805 break; 806 case 'cubeStopRandom' : 807 this.animationCubeStop({random:true}); 808 break; 809 case 'cubeHide' : 810 this.animationCubeHide(); 811 break; 812 case 'cubeSize' : 813 this.animationCubeSize(); 814 break; 815 case 'horizontal' : 816 this.animationHorizontal(); 817 break; 818 case 'showBars' : 819 this.animationShowBars(); 820 break; 821 case 'showBarsRandom' : 822 this.animationShowBars({random:true}); 823 break; 824 case 'tube' : 825 this.animationTube(); 826 break; 827 case 'fade' : 828 this.animationFade(); 829 break; 830 case 'fadeFour' : 831 this.animationFadeFour(); 832 break; 833 case 'paralell' : 834 this.animationParalell(); 835 break; 836 case 'blind' : 837 this.animationBlind(); 838 break; 839 case 'blindHeight' : 840 this.animationBlindDimension({height:true}); 841 break; 842 case 'blindWidth' : 843 this.animationBlindDimension({height:false, time_animate:400, delay:50}); 844 break; 845 case 'directionTop' : 846 this.animationDirection({direction:'top'}); 847 break; 848 case 'directionBottom' : 849 this.animationDirection({direction:'bottom'}); 850 break; 851 case 'directionRight' : 852 this.animationDirection({direction:'right', total:5}); 853 break; 854 case 'directionLeft' : 855 this.animationDirection({direction:'left', total:5}); 856 break; 857 case 'cubeSpread' : 858 this.animationCubeSpread(); 859 break; 860 case 'cubeJelly' : 861 this.animationCubeJelly(); 862 break; 863 case 'glassCube' : 864 this.animationGlassCube(); 865 break; 866 case 'glassBlock' : 867 this.animationGlassBlock(); 868 break; 869 case 'circles' : 870 this.animationCircles(); 871 break; 872 case 'circlesInside' : 873 this.animationCirclesInside(); 874 break; 875 case 'circlesRotate' : 876 this.animationCirclesRotate(); 877 break; 878 case 'cubeShow' : 879 this.animationCubeShow(); 880 break; 881 case 'upBars' : 882 this.animationDirectionBars({direction: 'top'}); 883 break; 884 case 'downBars' : 885 this.animationDirectionBars({direction: 'bottom'}); 886 break; 887 case 'hideBars' : 888 this.animationHideBars(); 889 break; 890 case 'swapBars' : 891 this.animationSwapBars();
892 break; 893 case 'swapBarsBack' : 894 this.animationSwapBars({easing: 'easeOutBack'}); 895 break; 896 case 'swapBlocks' : 897 this.animationSwapBlocks(); 898 break; 899 case 'cut' : 900 this.animationCut(); 901 break; 902 default : 903 this.animationTube(); 904 break; 905 } 906 }, 907 908 animationCube: function (options) 909 { 910 var self = this; 911 912 var options = $.extend({}, {random: false}, options || {}); 913 914 this.settings.is_animating = true; 915 var easing = (this.settings.easing_default == '') ? 'easeOutExpo' : this.settings.easing_default; 916 var time_animate = 700 / this.settings.velocity; 917 918 this.setActualLevel(); 919 920 var division_w = Math.ceil(this.settings.width_skitter / (this.settings.width_skitter / 8)); 921 var division_h = Math.ceil(this.settings.height_skitter / (this.settings.height_skitter / 3)); 922 var total = division_w * division_h; 923 924 var width_box = Math.ceil(this.settings.width_skitter / division_w); 925 var height_box = Math.ceil(this.settings.height_skitter / division_h); 926 927 var init_top = this.settings.height_skitter + 200; 928 var init_left = this.settings.height_skitter + 200; 929 930 var col_t = 0; 931 var col = 0; 932 933 for (i = 0; i < total; i++) { 934 935 init_top = (i % 2 == 0) ? init_top : -init_top; 936 init_left = (i % 2 == 0) ? init_left : -init_left; 937 938 var _vtop = init_top + (height_box * col_t) + (col_t * 150); 939 var _vleft = -self.settings.width_skitter; 940 //var _vleft = (init_left + (width_box * col)) + (col * 50); 941 942 var _vtop_image = -(height_box * col_t); 943 944 var _vleft_image = -(width_box * col); 945 var _btop = (height_box * col_t); 946 var _bleft = (width_box * col); 947 948 var box_clone = this.getBoxClone(); 949 box_clone.hide(); 950 951 var delay_time = 50 * (i); 952 953 if (options.random) { 954 delay_time = 40 * (col); 955 box_clone.css({left:_vleft+'px', top:_vtop+'px', width:width_box, height:height_box}); 956 } 957 else { 958 time_animate = 500; 959 //box_clone.css({left:(this.settings.width_skitter / 2), top:this.settings.height_skitter + 50, width:width_box, height:height_box}); 960 box_clone.css({left:(this.settings.width_skitter) + (width_box * i), top:this.settings.height_skitter + (height_box * i), width:width_box, height:height_box}); 961 } 962 963 //box_clone.find('img').css({left:_vleft_image, top:_vtop_image}); 964 //box_clone.find('img').css({left:_vleft_image+100, top:_vtop_image}); 965 966 this.addBoxClone(box_clone); 967 968 var callback = (i == (total - 1)) ? function() { self.finishAnimation(); } : ''; 969 box_clone.show().delay(delay_time).animate({top:_btop+'px', left:_bleft+'px'}, time_animate, easing, callback); 970 971 if (options.random) { 972 box_clone.find('img').css({left:_vleft_image+100, top:_vtop_image+50}); 973 box_clone.find('img').delay(delay_time+(time_animate/2)).animate({left:_vleft_image, top:_vtop_image}, 1000, 'easeOutBack'); 974 } 975 else { 976 box_clone.find('img').css({left:_vleft_image, top:_vtop_image}); 977 box_clone.find('img').delay(delay_time+(time_animate/2)).fadeTo(100, 0.5).fadeTo(300, 1); 978 } 979 980 col_t++; 981 if (col_t == division_h) { 982 col_t = 0; 983 col++; 984 } 985 } 986 }, 987 988 animationBlock: function(options) 989 { 990 var self = this; 991 992 this.settings.is_animating = true; 993 var easing = (this.settings.easing_default == '') ? 'easeOutQuad' : this.settings.easing_default; 994 var time_animate = 500 / this.settings.velocity; 995 996 this.setActualLevel(); 997 998 var total = Math.ceil(this.settings.width_skitter / (this.settings.width_skitter / 15));
999 var width_box = Math.ceil(this.settings.width_skitter / total); 1000 var height_box = (this.settings.height_skitter); 1001 1002 for (i = 0; i < total; i++) { 1003 1004 var _bleft = (width_box * (i)); 1005 var _btop = 0; 1006 1007 var box_clone = this.getBoxClone(); 1008 box_clone.css({left: this.settings.width_skitter + 100, top:0, width:width_box, height:height_box}); 1009 box_clone.find('img').css({left:-(width_box * i)}); 1010 1011 this.addBoxClone(box_clone); 1012 1013 var delay_time = 80 * (i); 1014 var callback = (i == (total - 1)) ? function() { self.finishAnimation(); } : ''; 1015 //box_clone.delay(delay_time).animate({top:_btop, left:_bleft, opacity:'show'}, time_animate, easing, callback); 1016 1017 box_clone.show().delay(delay_time).animate({top:_btop, left:_bleft}, time_animate, easing); 1018 box_clone.find('img').hide().delay(delay_time+100).animate({opacity:'show'}, time_animate+300, easing, callback); 1019 } 1020 1021 }, 1022 1023 animationCubeStop: function(options) 1024 { 1025 var self = this; 1026 1027 var options = $.extend({}, {random: false}, options || {}); 1028 1029 this.settings.is_animating = true; 1030 var easing = (this.settings.easing_default == '') ? 'easeInQuad' : this.settings.easing_default; 1031 var time_animate = 300 / this.settings.velocity; 1032 1033 var image_old = this.box_skitter.find('.image_main').attr('src'); 1034 1035 this.setActualLevel(); 1036 1037 this.setLinkAtual(); 1038 this.box_skitter.find('.image_main').attr({'src':this.settings.image_atual}); 1039 1040 var division_w = Math.ceil(this.settings.width_skitter / (this.settings.width_skitter / 8)); 1041 var division_h = Math.ceil(this.settings.height_skitter / (this.settings.width_skitter / 8)); 1042 var total = division_w * division_h; 1043 1044 var width_box = Math.ceil(this.settings.width_skitter / division_w); 1045 var height_box = Math.ceil(this.settings.height_skitter / division_h); 1046 1047 var init_top = 0; 1048 var init_left = 0; 1049 1050 var col_t = 0; 1051 var col = 0; 1052 var _ftop = this.settings.width_skitter / 16; 1053 1054 for (i = 0; i < total; i++) { 1055 init_top = (i % 2 == 0) ? init_top : -init_top; 1056 init_left = (i % 2 == 0) ? init_left : -init_left; 1057 1058 var _vtop = init_top + (height_box * col_t); 1059 var _vleft = (init_left + (width_box * col)); 1060 var _vtop_image = -(height_box * col_t); 1061 1062 var _vleft_image = -(width_box * col); 1063 var _btop = _vtop - _ftop; 1064 var _bleft = _vleft - _ftop; 1065 1066 var box_clone = this.getBoxCloneImgOld(image_old); 1067 box_clone.css({left:_vleft+'px', top:_vtop+'px', width:width_box, height:height_box}); 1068 box_clone.find('img').css({left:_vleft_image, top:_vtop_image}); 1069 1070 this.addBoxClone(box_clone); 1071 box_clone.show(); 1072 1073 var delay_time = 50 * i; 1074 1075 if (options.random) { 1076 time_animate = (400 * (self.getRandom(2) + 1)) / this.settings.velocity; 1077 _btop = _vtop; 1078 _bleft = _vleft; 1079 delay_time = Math.ceil( 30 * self.getRandom(30) ); 1080 } 1081 1082 if (options.random && i == (total - 1)) { 1083 time_animate = 400 * 3; 1084 delay_time = 30 * 30; 1085 } 1086 1087 var callback = (i == (total - 1)) ? function() { self.finishAnimation(); } : ''; 1088 box_clone.delay(delay_time).animate({opacity:'hide', top:_btop+'px', left:_bleft+'px'}, time_animate, easing, callback); 1089 1090 col_t++; 1091 if (col_t == division_h) { 1092 col_t = 0; 1093 col++; 1094 } 1095 } 1096 }, 1097 1098 animationCubeHide: function(options) 1099 { 1100 var self = this; 1101 1102 this.settings.is_animating = true; 1103 var easing = (this.settings.easing_default == '') ? 'easeOutQuad' : this.settings.easing_default; 1104 var time_animate = 500 / this.settings.velocity; 1105 1106 var image_old = this.box_skitter.find('.image_main').attr('src'); 1107 1108 this.setActualLevel(); 1109 1110 this.setLinkAtual(); 1111 this.box_skitter.find('.image_main').attr({'src':this.settings.image_atual}); 1112
1113 var division_w = Math.ceil(this.settings.width_skitter / (this.settings.width_skitter / 8)); 1114 var division_h = Math.ceil(this.settings.height_skitter / (this.settings.height_skitter / 3)); 1115 var total = division_w * division_h; 1116 1117 var width_box = Math.ceil(this.settings.width_skitter / division_w); 1118 var height_box = Math.ceil(this.settings.height_skitter / division_h); 1119 1120 var init_top = 0; 1121 var init_left = 0; 1122 1123 var col_t = 0; 1124 var col = 0; 1125 1126 for (i = 0; i < total; i++) { 1127 1128 init_top = (i % 2 == 0) ? init_top : -init_top; 1129 init_left = (i % 2 == 0) ? init_left : -init_left; 1130 1131 var _vtop = init_top + (height_box * col_t); 1132 var _vleft = (init_left + (width_box * col)); 1133 var _vtop_image = -(height_box * col_t); 1134 1135 var _vleft_image = -(width_box * col); 1136 var _btop = _vtop - 50; 1137 var _bleft = _vleft - 50; 1138 1139 var box_clone = this.getBoxCloneImgOld(image_old); 1140 box_clone.css({left:_vleft+'px', top:_vtop+'px', width:width_box, height:height_box}); 1141 box_clone.find('img').css({left:_vleft_image, top:_vtop_image}); 1142 1143 this.addBoxClone(box_clone); 1144 box_clone.show(); 1145 1146 var delay_time = 50 * i; 1147 delay_time = (i == (total - 1)) ? (total * 50) : delay_time; 1148 var callback = (i == (total - 1)) ? function() { self.finishAnimation(); } : ''; 1149 1150 box_clone.delay(delay_time).animate({opacity:'hide'}, time_animate, easing, callback); 1151 1152 col_t++; 1153 if (col_t == division_h) { 1154 col_t = 0; 1155 col++; 1156 } 1157 } 1158 1159 }, 1160 1161 animationCubeJelly: function(options) 1162 { 1163 var self = this; 1164 1165 this.settings.is_animating = true; 1166 var easing = (this.settings.easing_default == '') ? 'easeInBack' : this.settings.easing_default; 1167 var time_animate = 300 / this.settings.velocity; 1168 1169 var image_old = this.box_skitter.find('.image_main').attr('src'); 1170 1171 this.setActualLevel(); 1172 1173 this.setLinkAtual(); 1174 this.box_skitter.find('.image_main').attr({'src':this.settings.image_atual}); 1175 1176 var division_w = Math.ceil(this.settings.width_skitter / (this.settings.width_skitter / 8)); 1177 var division_h = Math.ceil(this.settings.height_skitter / (this.settings.height_skitter / 3)); 1178 var total = division_w * division_h; 1179 1180 var width_box = Math.ceil(this.settings.width_skitter / division_w); 1181 var height_box = Math.ceil(this.settings.height_skitter / division_h); 1182 1183 var init_top = 0; 1184 var init_left = 0; 1185 1186 var col_t = 0; 1187 var col = 0; 1188 var u = -1; 1189 1190 for (i = 0; i < total; i++) { 1191 1192 if (col % 2 != 0) { 1193 if (col_t == 0) { 1194 u = u + division_h + 1; 1195 } 1196 u--; 1197 } 1198 else { 1199 if (col > 0 && col_t == 0) { 1200 u = u + 2; 1201 } 1202 u++; 1203 } 1204 1205 init_top = (i % 2 == 0) ? init_top : -init_top; 1206 init_left = (i % 2 == 0) ? init_left : -init_left; 1207 1208 var _vtop = init_top + (height_box * col_t); 1209 var _vleft = (init_left + (width_box * col)); 1210 var _vtop_image = -(height_box * col_t); 1211 1212 var _vleft_image = -(width_box * col); 1213 var _btop = _vtop - 50; 1214 var _bleft = _vleft - 50; 1215 1216 var box_clone = this.getBoxCloneImgOld(image_old); 1217 box_clone.css({left:_vleft+'px', top:_vtop+'px', width:width_box, height:height_box}); 1218 box_clone.find('img').css({left:_vleft_image, top:_vtop_image}); 1219 1220 this.addBoxClone(box_clone); 1221 box_clone.show(); 1222 1223 var delay_time = (50 * i); 1224 var callback = (i == (total - 1)) ? function() { self.finishAnimation(); } : ''; 1225 1226 box_clone.delay(delay_time).animate({width:'+=100px', height:'+=100px', top:'-=20px', left: '-=20px', opacity:'hide'}, time_animate, easing, callback); 1227 col_t++; 1228 1229 if (col_t == division_h) { 1230 col_t = 0; 1231 col++; 1232 } 1233 1234 } 1235 }, 1236 1237 animationCubeSize: function(options) 1238 { 1239 var self = this; 1240 1241 this.settings.is_animating = true; 1242 var easing = (this.settings.easing_default == '') ? 'easeInOutQuad' : this.settings.easing_default; 1243 var time_animate = 600 / this.settings.velocity; 1244 1245 var image_old = this.box_skitter.find('.image_main').attr('src'); 1246 1247 this.setActualLevel(); 1248 1249 this.setLinkAtual(); 1250 this.box_skitter.find('.image_main').attr({'src':this.settings.image_atual}); 1251
1252 var division_w = Math.ceil(this.settings.width_skitter / (this.settings.width_skitter / 8)); 1253 var division_h = Math.ceil(this.settings.height_skitter / (this.settings.height_skitter / 3)); 1254 var total = division_w * division_h; 1255 1256 var width_box = Math.ceil(this.settings.width_skitter / division_w); 1257 var height_box = Math.ceil(this.settings.height_skitter / division_h); 1258 1259 var init_top = 0; 1260 var init_left = 0; 1261 1262 var col_t = 0; 1263 var col = 0; 1264 var _ftop = Math.ceil(this.settings.width_skitter / 6); 1265 1266 for (i = 0; i < total; i++) { 1267 1268 init_top = (i % 2 == 0) ? init_top : -init_top; 1269 init_left = (i % 2 == 0) ? init_left : -init_left; 1270 1271 var _vtop = init_top + (height_box * col_t); 1272 var _vleft = (init_left + (width_box * col)); 1273 var _vtop_image = -(height_box * col_t); 1274 1275 var _vleft_image = -(width_box * col); 1276 var _btop = _vtop - _ftop; 1277 var _bleft = _vleft - _ftop; 1278 1279 var box_clone = this.getBoxCloneImgOld(image_old); 1280 box_clone.css({left:_vleft, top:_vtop, width:width_box, height:height_box}); 1281 box_clone.find('img').css({left:_vleft_image, top:_vtop_image}); 1282 1283 this.addBoxClone(box_clone); 1284 box_clone.show(); 1285 1286 var delay_time = 50 * i; 1287 var callback = (i == (total - 1)) ? function() { self.finishAnimation(); } : ''; 1288 box_clone.delay(delay_time).animate({ 1289 opacity:'hide',width:'hide',height:'hide',top:_vtop+(width_box*1.5),left:_vleft+(height_box*1.5) 1290 }, time_animate, easing, callback); 1291 1292 col_t++; 1293 if (col_t == division_h) { 1294 col_t = 0; 1295 col++; 1296 } 1297 } 1298 1299 }, 1300 1301 animationHorizontal: function(options) 1302 { 1303 var self = this; 1304 1305 this.settings.is_animating = true; 1306 var easing = (this.settings.easing_default == '') ? 'easeOutExpo' : this.settings.easing_default; 1307 var time_animate = 700 / this.settings.velocity; 1308 1309 this.setActualLevel(); 1310 1311 var total = Math.ceil(this.settings.width_skitter / (this.settings.width_skitter / 7)); 1312 var width_box = (this.settings.width_skitter); 1313 var height_box = Math.ceil(this.settings.height_skitter / total); 1314 1315 for (i = 0; i < total; i++) { 1316 var _bleft = (i % 2 == 0 ? '' : '') + width_box; 1317 var _btop = (i * height_box); 1318 1319 var box_clone = this.getBoxClone(); 1320 1321 box_clone.css({left:_bleft+'px', top:_btop+'px', width:width_box, height:height_box}); 1322 box_clone.find('img').css({left:0, top:-_btop}); 1323 1324 this.addBoxClone(box_clone); 1325 1326 var delay_time = 90 * i; 1327 var callback = (i == (total - 1)) ? function() { self.finishAnimation(); } : ''; 1328 box_clone.delay(delay_time).animate({opacity:'show', top:_btop, left:0}, time_animate, easing, callback); 1329 } 1330 }, 1331 1332 animationShowBars: function(options) 1333 { 1334 var self = this; 1335 1336 var options = $.extend({}, {random: false}, options || {}); 1337 1338 this.settings.is_animating = true; 1339 var easing = (this.settings.easing_default == '') ? 'easeOutQuad' : this.settings.easing_default; 1340 var time_animate = 400 / this.settings.velocity; 1341 1342 this.setActualLevel(); 1343 1344 var total = Math.ceil(this.settings.width_skitter / (this.settings.width_skitter / 10)); 1345 var width_box = Math.ceil(this.settings.width_skitter / total); 1346 var height_box = (this.settings.height_skitter); 1347 1348 for (i = 0; i < total; i++) { 1349 1350 var _bleft = (width_box * (i)); 1351 var _btop = 0; 1352 1353 var box_clone = this.getBoxClone(); 1354 1355 box_clone.css({left:_bleft, top:_btop - 50, width:width_box, height:height_box}); 1356 box_clone.find('img').css({left:-(width_box * i), top:0}); 1357 1358 this.addBoxClone(box_clone); 1359 1360 if (options.random) { 1361 var random = this.getRandom(total); 1362 var delay_time = 50 * random; 1363 delay_time = (i == (total - 1)) ? (50 * total) : delay_time; 1364 } 1365 else { 1366 var delay_time = 70 * (i); 1367 time_animate = time_animate - (i * 2); 1368 } 1369 1370 var callback = (i == (total - 1)) ? function() { self.finishAnimation(); } : ''; 1371 box_clone.delay(delay_time).animate({ 1372 opacity:'show', top:_btop+'px', left:_bleft+'px' 1373 }, time_animate, easing, callback); 1374 } 1375 1376 }, 1377 1378 animationTube: function(options) 1379 { 1380 var self = this; 1381 1382 this.settings.is_animating = true; 1383 var easing = (this.settings.easing_default == '') ? 'easeOutElastic' : this.settings.easing_default; 1384 var time_animate = 600 / this.settings.velocity; 1385 1386 this.setActualLevel(); 1387
1388 var total = Math.ceil(this.settings.width_skitter / (this.settings.width_skitter / 10)); 1389 var width_box = Math.ceil(this.settings.width_skitter / total); 1390 var height_box = this.settings.height_skitter; 1391 1392 for (i = 0;i<total;i++) { 1393 var _btop = 0; 1394 var _vtop = height_box; 1395 var vleft = width_box * i; 1396 1397 var box_clone = this.getBoxClone(); 1398 1399 box_clone.css({left:vleft,top: _vtop, height:height_box, width: width_box}); 1400 box_clone.find('img').css({left:-(vleft)}); 1401 1402 this.addBoxClone(box_clone); 1403 1404 var random = this.getRandom(total); 1405 var delay_time = 30 * random; 1406 var callback = (i == (total - 1)) ? function() { self.finishAnimation(); } : ''; 1407 box_clone.show().delay(delay_time).animate({top:_btop}, time_animate, easing, callback); 1408 } 1409 }, 1410 1411 animationFade: function(options) 1412 { 1413 var self = this; 1414 1415 this.settings.is_animating = true; 1416 var easing = (this.settings.easing_default == '') ? 'easeOutQuad' : this.settings.easing_default; 1417 var time_animate = 800 / this.settings.velocity; 1418 1419 this.setActualLevel(); 1420 1421 var width_box = this.settings.width_skitter; 1422 var height_box = this.settings.height_skitter; 1423 var total = 2; 1424 1425 for (i = 0;i<total;i++) { 1426 var _vtop = 0; 1427 var _vleft = 0; 1428 1429 var box_clone = this.getBoxClone(); 1430 box_clone.css({left:_vleft, top:_vtop, width:width_box, height:height_box}); 1431 this.addBoxClone(box_clone); 1432 1433 var callback = (i == (total - 1)) ? function() { self.finishAnimation(); } : ''; 1434 box_clone.animate({opacity:'show', left:0, top:0}, time_animate, easing, callback); 1435 } 1436 }, 1437 1438 animationFadeFour: function(options) 1439 { 1440 var self = this; 1441 1442 this.settings.is_animating = true; 1443 var easing = (this.settings.easing_default == '') ? 'easeOutQuad' : this.settings.easing_default; 1444 var time_animate = 500 / this.settings.velocity; 1445 1446 this.setActualLevel(); 1447 1448 var width_box = this.settings.width_skitter; 1449 var height_box = this.settings.height_skitter; 1450 var total = 4; 1451 1452 for (i = 0;i<total;i++) { 1453 1454 if (i == 0) { 1455 var _vtop = '-100px'; 1456 var _vleft = '-100px'; 1457 } else if (i == 1) { 1458 var _vtop = '-100px'; 1459 var _vleft = '100px'; 1460 } else if (i == 2) { 1461 var _vtop = '100px'; 1462 var _vleft = '-100px'; 1463 } else if (i == 3) { 1464 var _vtop = '100px'; 1465 var _vleft = '100px'; 1466 } 1467 1468 var box_clone = this.getBoxClone(); 1469 box_clone.css({left:_vleft, top:_vtop, width:width_box, height:height_box}); 1470 this.addBoxClone(box_clone); 1471 1472 var callback = (i == (total - 1)) ? function() { self.finishAnimation(); } : ''; 1473 box_clone.animate({opacity:'show', left:0, top:0}, time_animate, easing, callback); 1474 } 1475 }, 1476 1477 animationParalell: function(options) 1478 { 1479 var self = this; 1480 1481 this.settings.is_animating = true; 1482 var easing = (this.settings.easing_default == '') ? 'easeOutQuad' : this.settings.easing_default; 1483 var time_animate = 400 / this.settings.velocity; 1484 1485 this.setActualLevel(); 1486 1487 var total = Math.ceil(this.settings.width_skitter / (this.settings.width_skitter / 16)); 1488 var width_box = Math.ceil(this.settings.width_skitter / total); 1489 var height_box = this.settings.height_skitter; 1490 1491 for (i = 0; i < total; i++) { 1492 1493 var _bleft = (width_box * (i)); 1494 var _btop = 0; 1495 1496 var box_clone = this.getBoxClone(); 1497 1498 box_clone.css({left:_bleft, top:_btop - this.settings.height_skitter, width:width_box, height:height_box}); 1499 box_clone.find('img').css({left:-(width_box * i), top:0}); 1500 1501 this.addBoxClone(box_clone); 1502 1503 var delay_time; 1504 if (i <= ((total / 2) - 1)) { 1505 delay_time = 1400 - (i * 200); 1506 } 1507 else if (i > ((total / 2) - 1)) { 1508 delay_time = ((i - (total / 2)) * 200); 1509 } 1510 delay_time = delay_time / 2.5; 1511 1512 var callback = (i == (total - 1)) ? function() { self.finishAnimation(); } : ''; 1513 box_clone.delay(delay_time).animate({ 1514 top:_btop+'px', left:_bleft+'px', opacity: 'show' 1515 }, time_animate, easing, callback); 1516 } 1517 1518 }, 1519 1520 animationBlind: function(options) 1521 { 1522 var self = this; 1523 1524 var options = $.extend({}, {height: false}, options || {}); 1525 1526 this.settings.is_animating = true; 1527 var easing = (this.settings.easing_default == '') ? 'easeOutQuad' : this.settings.easing_default; 1528 var time_animate = 400 / this.settings.velocity; 1529 1530 this.setActualLevel(); 1531
1532 var total = Math.ceil(this.settings.width_skitter / (this.settings.width_skitter / 16)); 1533 var width_box = Math.ceil(this.settings.width_skitter / total); 1534 var height_box = this.settings.height_skitter; 1535 1536 for (i = 0; i < total; i++) { 1537 1538 var _bleft = (width_box * (i)); 1539 var _btop = 0; 1540 1541 var box_clone = this.getBoxClone(); 1542 1543 box_clone.css({left:_bleft, top:_btop, width:width_box, height:height_box}); 1544 box_clone.find('img').css({left:-(width_box * i), top:0}); 1545 1546 this.addBoxClone(box_clone); 1547 1548 var delay_time; 1549 1550 if (!options.height) { 1551 if (i <= ((total / 2) - 1)) { 1552 delay_time = 1400 - (i * 200); 1553 } 1554 else if (i > ((total / 2) - 1)) { 1555 delay_time = ((i - (total / 2)) * 200); 1556 } 1557 var callback = (i == (total - 1)) ? function() { self.finishAnimation(); } : ''; 1558 } 1559 else { 1560 if (i <= ((total / 2) - 1)) { 1561 delay_time = 200 + (i * 200); 1562 } 1563 else if (i > ((total / 2) - 1)) { 1564 delay_time = (((total / 2) - i) * 200) + (total * 100); 1565 } 1566 var callback = (i == (total / 2)) ? function() { self.finishAnimation(); } : ''; 1567 } 1568 1569 delay_time = delay_time / 2.5; 1570 1571 if (!options.height) { 1572 box_clone.delay(delay_time).animate({ 1573 opacity:'show',top:_btop+'px', left:_bleft+'px', width:'show' 1574 }, time_animate, easing, callback); 1575 } 1576 else { 1577 time_animate = time_animate + (i * 2); 1578 var easing = 'easeOutQuad'; 1579 box_clone.delay(delay_time).animate({ 1580 opacity:'show',top:_btop+'px', left:_bleft+'px', height:'show' 1581 }, time_animate, easing, callback); 1582 } 1583 } 1584 1585 }, 1586 1587 animationBlindDimension: function(options) 1588 { 1589 var self = this; 1590 1591 var options = $.extend({}, {height: true, time_animate: 500, delay: 100}, options || {}); 1592 1593 this.settings.is_animating = true; 1594 var easing = (this.settings.easing_default == '') ? 'easeOutQuad' : this.settings.easing_default; 1595 var time_animate = options.time_animate / this.settings.velocity; 1596 1597 this.setActualLevel(); 1598 1599 var total = Math.ceil(this.settings.width_skitter / (this.settings.width_skitter / 16)); 1600 var width_box = Math.ceil(this.settings.width_skitter / total); 1601 var height_box = this.settings.height_skitter; 1602 1603 for (i = 0; i < total; i++) { 1604 1605 var _bleft = (width_box * (i)); 1606 var _btop = 0; 1607 1608 var box_clone = this.getBoxClone(); 1609 1610 box_clone.css({left:_bleft, top:_btop, width:width_box, height:height_box}); 1611 box_clone.find('img').css({left:-(width_box * i), top:0}); 1612 1613 this.addBoxClone(box_clone); 1614 1615 var delay_time = options.delay * i; 1616 var callback = (i == (total - 1)) ? function() { self.finishAnimation(); } : ''; 1617 1618 if (!options.height) { 1619 box_clone.delay(delay_time).animate({ 1620 opacity:'show',top:_btop+'px', left:_bleft+'px', width:'show' 1621 }, time_animate, easing, callback); 1622 } 1623 else { 1624 var easing = 'easeOutQuad'; 1625 box_clone.delay(delay_time).animate({ 1626 opacity:'show',top:_btop+'px', left:_bleft+'px', height:'show' 1627 }, time_animate, easing, callback); 1628 } 1629 } 1630 1631 }, 1632 1633 animationDirection: function(options) 1634 { 1635 var self = this; 1636 1637 var options = $.extend({}, {direction: 'top', delay_type: 'sequence', total: 7}, options || {}); 1638 1639 this.settings.is_animating = true; 1640 var easing = (this.settings.easing_default == '') ? 'easeInOutExpo' : this.settings.easing_default; 1641 var time_animate = 1200 / this.settings.velocity; 1642 1643 var image_old = this.box_skitter.find('.image_main').attr('src'); 1644 1645 this.setActualLevel(); 1646 1647 this.setLinkAtual(); 1648 this.box_skitter.find('.image_main').attr({'src':this.settings.image_atual}); 1649 this.box_skitter.find('.image_main').hide(); 1650 1651 var total = options.total; 1652 1653 for (i = 0; i < total; i++) { 1654 1655 switch (options.direction) 1656 { 1657 default : case 'top' : 1658
1659 var width_box = Math.ceil(this.settings.width_skitter / total); 1660 var height_box = this.settings.height_skitter; 1661 1662 var _itopc = 0; 1663 var _ileftc = (width_box * i); 1664 var _ftopc = -height_box; 1665 var _fleftc = _ileftc; 1666 1667 var _itopn = height_box; 1668 var _ileftn = _ileftc; 1669 var _ftopn = 0; 1670 var _fleftn = _ileftc; 1671 1672 var _vtop_image = 0; 1673 var _vleft_image = -_ileftc; 1674 1675 break; 1676 1677 case 'bottom' : 1678 1679 var width_box = Math.ceil(this.settings.width_skitter / total); 1680 var height_box = this.settings.height_skitter; 1681 1682 var _itopc = 0; 1683 var _ileftc = (width_box * i); 1684 var _ftopc = height_box; 1685 var _fleftc = _ileftc; 1686 1687 var _itopn = -height_box; 1688 var _ileftn = _ileftc; 1689 var _ftopn = 0; 1690 var _fleftn = _ileftc; 1691 1692 var _vtop_image = 0; 1693 var _vleft_image = -_ileftc; 1694 1695 break; 1696 1697 case 'right' : 1698 1699 var width_box = this.settings.width_skitter; 1700 var height_box = Math.ceil(this.settings.height_skitter / total); 1701 1702 var _itopc = (height_box * i); 1703 var _ileftc = 0; 1704 var _ftopc = _itopc; 1705 var _fleftc = width_box; 1706 1707 var _itopn = _itopc; 1708 var _ileftn = -_fleftc; 1709 var _ftopn = _itopc; 1710 var _fleftn = 0; 1711 1712 var _vtop_image = -_itopc; 1713 var _vleft_image = 0; 1714 1715 break; 1716 1717 case 'left' : 1718 1719 var width_box = this.settings.width_skitter; 1720 var height_box = Math.ceil(this.settings.height_skitter / total); 1721 1722 var _itopc = (height_box * i); 1723 var _ileftc = 0; 1724 var _ftopc = _itopc; 1725 var _fleftc = -width_box; 1726 1727 var _itopn = _itopc; 1728 var _ileftn = -_fleftc; 1729 var _ftopn = _itopc; 1730 var _fleftn = 0; 1731 1732 var _vtop_image = -_itopc; 1733 var _vleft_image = 0; 1734 1735 break; 1736 1737 } 1738 1739 switch (options.delay_type) 1740 { 1741 case 'zebra' : default : var delay_time = (i % 2 == 0) ? 0 : 150; break; 1742 case 'random' : var delay_time = 30 * (Math.random() * 30); break; 1743 case 'sequence' : var delay_time = i * 100; break; 1744 } 1745 1746 var box_clone = this.getBoxCloneImgOld(image_old); 1747 box_clone.find('img').css({left:_vleft_image, top:_vtop_image}); 1748 1749 box_clone.css({top:_itopc, left:_ileftc, width:width_box, height:height_box}); 1750 1751 this.addBoxClone(box_clone); 1752 box_clone.show(); 1753 box_clone.delay(delay_time).animate({ top:_ftopc, left:_fleftc }, time_animate, easing); 1754 1755 // Next image 1756 var box_clone_next = this.getBoxClone(); 1757 box_clone_next.find('img').css({left:_vleft_image, top:_vtop_image}); 1758 1759 box_clone_next.css({top:_itopn, left:_ileftn, width:width_box, height:height_box}); 1760 1761 this.addBoxClone(box_clone_next); 1762 box_clone_next.show(); 1763 1764 var callback = (i == (total - 1)) ? function() { self.finishAnimation(); } : ''; 1765 box_clone_next.delay(delay_time).animate({ top:_ftopn, left
1765:_fleftn }, time_animate, easing, callback); 1766 1767 } 1768 }, 1769 1770 animationCubeSpread: function(options) 1771 { 1772 var self = this; 1773 1774 this.settings.is_animating = true; 1775 var easing = (this.settings.easing_default == '') ? 'easeOutQuad' : this.settings.easing_default; 1776 var time_animate = 700 / this.settings.velocity; 1777 1778 this.setActualLevel(); 1779 1780 var division_w = Math.ceil(this.settings.width_skitter / (this.settings.width_skitter / 8)); 1781 var division_h = Math.ceil(this.settings.height_skitter / (this.settings.width_skitter / 8)); 1782 var total = division_w * division_h; 1783 1784 var width_box = Math.ceil(this.settings.width_skitter / division_w); 1785 var height_box = Math.ceil(this.settings.height_skitter / division_h); 1786 1787 var init_top = 0; 1788 var init_left = 0; 1789 1790 var col_t = 0; 1791 var col = 0; 1792 var order = new Array; 1793 var spread = new Array; 1794 1795 // Make order 1796 for (i = 0; i < total; i++) { 1797 init_top = (i % 2 == 0) ? init_top : -init_top; 1798 init_left = (i % 2 == 0) ? init_left : -init_left; 1799 1800 var _vtop = init_top + (height_box * col_t); 1801 var _vleft = (init_left + (width_box * col)); 1802 1803 order[i] = [_vtop, _vleft]; 1804 1805 col_t++; 1806 if (col_t == division_h) { 1807 col_t = 0; 1808 col++; 1809 } 1810 } 1811 1812 // Reset col and col_t 1813 col_t = 0; 1814 col = 0; 1815 1816 // Make array for spread 1817 for (i = 0; i < total; i++) { 1818 spread[i] = i; 1819 }; 1820 1821 // Shuffle array 1822 var spread = self.shuffleArray(spread); 1823 1824 for (i = 0; i < total; i++) { 1825 init_top = (i % 2 == 0) ? init_top : -init_top; 1826 init_left = (i % 2 == 0) ? init_left : -init_left; 1827 1828 var _vtop = init_top + (height_box * col_t); 1829 var _vleft = (init_left + (width_box * col)); 1830 var _vtop_image = -(height_box * col_t); 1831 1832 var _vleft_image = -(width_box * col); 1833 var _btop = _vtop; 1834 var _bleft = _vleft; 1835 1836 _vtop = order[spread[i]][0]; 1837 _vleft = order[spread[i]][1]; 1838 1839 var box_clone = this.getBoxClone(); 1840 1841 box_clone.css({left:_vleft+'px', top:_vtop+'px', width:width_box, height:height_box}); 1842 box_clone.find('img').css({left:_vleft_image, top:_vtop_image}); 1843 1844 this.addBoxClone(box_clone); 1845 1846 var delay_time = 30 * (Math.random() * 30); 1847 if (i == (total-1)) delay_time = 30 * 30; 1848 var callback = (i == (total - 1)) ? function() { self.finishAnimation(); } : ''; 1849 box_clone.delay(delay_time).animate({opacity:'show',top:_btop+'px', left:_bleft+'px'}, time_animate, easing, callback); 1850 1851 col_t++; 1852 if (col_t == division_h) { 1853 col_t = 0; 1854 col++; 1855 } 1856 } 1857 }, 1858 1859 animationGlassCube: function(options) 1860 { 1861 var self = this; 1862 1863 this.settings.is_animating = true; 1864 var easing = (this.settings.easing_default == '') ? 'easeOutExpo' : this.settings.easing_default; 1865 var time_animate = 500 / this.settings.velocity; 1866 1867 this.setActualLevel(); 1868 1869 var total = Math.ceil(this.settings.width_skitter / (this.settings.width_skitter / 10)) * 2; 1870 var width_box = Math.ceil(this.settings.width_skitter / total) * 2; 1871 var height_box = (this.settings.height_skitter) / 2; 1872 var col = 0; 1873 1874 for (i = 0; i < total; i++) { 1875 mod = (i % 2) == 0 ? true : false; 1876 1877 var _ileft = (width_box * (col)); 1878 var _itop = (mod) ? -self.settings.height_skitter : self.settings.height_skitter; 1879 1880 var _fleft = (width_box * (col)); 1881 var _ftop = (mod) ? 0 : (height_box); 1882 1883 var _bleft = -(width_box * col); 1884 var _btop = (mod) ? 0 : -(height_box); 1885 1886 var delay_time = 120 * col; 1887 1888 var box_clone = this.getBoxClone(); 1889 box_clone.css({left: _ileft, top:_itop, width:width_box, height:height_box}); 1890 1891 box_clone 1892 .find('img') 1893 .css({left: _bleft + (width_box / 1.5), top: _btop}) 1894 .delay(delay_time) 1895 .animate({left: _bleft, top: _btop}, (time_animate * 1.9), 'easeOutQuad'); 1896 1897 this.addBoxClone(box_clone); 1898 1899 var callback = (i == (total - 1)) ? function() { self.finishAnimation(); } : ''; 1900 box_clone.show().delay(delay_time).animate({top:_ftop, left:_fleft}, time_animate, easing, callback); 1901 1902 if ((i % 2) != 0) col++; 1903 } 1904 }, 1905 1906 animationGlassBlock: function(options) 1907 { 1908 var self = this; 1909 1910 this.settings.is_animating = true; 1911 var easing = (this.settings.easing_default == '') ? 'easeOutExpo' : this.settings.easing_default; 1912 var time_animate = 700 / this.settings.velocity; 1913 1914 this.setActualLevel(); 1915
1916 var total = Math.ceil(this.settings.width_skitter / (this.settings.width_skitter / 10)); 1917 var width_box = Math.ceil(this.settings.width_skitter / total); 1918 var height_box = (this.settings.height_skitter); 1919 1920 for (i = 0; i < total; i++) { 1921 var _ileft = (width_box * (i)); 1922 var _itop = 0; 1923 1924 var _fleft = (width_box * (i)); 1925 var _ftop = 0; 1926 1927 var _bleft = -(width_box * (i)); 1928 var _btop = 0; 1929 1930 var delay_time = 100 * i; 1931 1932 var box_clone = this.getBoxClone(); 1933 box_clone.css({left: _ileft, top:_itop, width:width_box, height:height_box}); 1934 1935 box_clone 1936 .find('img') 1937 .css({left: _bleft + (width_box / 1.5), top: _btop}) 1938 .delay(delay_time) 1939 .animate({left: _bleft, top: _btop}, (time_animate * 1.1), 'easeInOutQuad'); 1940 1941 this.addBoxClone(box_clone); 1942 1943 var callback = (i == (total - 1)) ? function() { self.finishAnimation(); } : ''; 1944 box_clone.delay(delay_time).animate({top:_ftop, left:_fleft, opacity: 'show'}, time_animate, easing, callback); 1945 1946 } 1947 }, 1948 1949 animationCircles: function(options) 1950 { 1951 var self = this; 1952 1953 this.settings.is_animating = true; 1954 var easing = (this.settings.easing_default == '') ? 'easeInQuad' : this.settings.easing_default; 1955 var time_animate = 500 / this.settings.velocity; 1956 1957 this.setActualLevel(); 1958 1959 var total = Math.ceil(this.settings.width_skitter / (this.settings.width_skitter / 10)); 1960 var size_box = 100; 1961 1962 var radius = Math.sqrt(Math.pow((this.settings.width_skitter), 2) + Math.pow((this.settings.height_skitter), 2)); 1963 var radius = Math.ceil(radius); 1964 1965 for (i = 0; i < total; i++) { 1966 var _ileft = (self.settings.width_skitter / 2) - (size_box / 2); 1967 var _itop = (self.settings.height_skitter / 2) - (size_box / 2); 1968 1969 var _fleft = _ileft; 1970 var _ftop = _itop; 1971 var box_clone = null; 1972 1973 box_clone = this.getBoxCloneBackground({ 1974 image: self.settings.image_atual, 1975 left: _ileft, 1976 top: _itop, 1977 width: size_box, 1978 height: size_box, 1979 position: { 1980 top: -_itop, 1981 left: -_ileft 1982 } 1983 }).css3({ 1984 'border-radius': radius+'px' 1985 }); 1986 1987 size_box += 100; 1988 1989 this.addBoxClone(box_clone); 1990 1991 var delay_time = 70 * i; 1992 var callback = (i == (total - 1)) ? function() { self.finishAnimation(); } : ''; 1993 box_clone.delay(delay_time).animate({top: _ftop, left: _fleft, opacity: 'show'}, time_animate, easing, callback); 1994 1995 } 1996 }, 1997 1998 animationCirclesInside: function(options) 1999 { 2000 var self = this; 2001 2002 this.settings.is_animating = true; 2003 var easing = (this.settings.easing_default == '') ? 'easeInQuad' : this.settings.easing_default; 2004 var time_animate = 500 / this.settings.velocity; 2005 2006 var image_old = this.box_skitter.find('.image_main').attr('src'); 2007 2008 this.setActualLevel(); 2009 2010 this.setLinkAtual(); 2011 this.box_skitter.find('.image_main').attr({'src':this.settings.image_atual}); 2012 2013 var total = Math.ceil(this.settings.width_skitter / (this.settings.width_skitter / 10)); 2014 2015 var radius = Math.sqrt(Math.pow((this.settings.width_skitter), 2) + Math.pow((this.settings.height_skitter), 2)); 2016 var radius = Math.ceil(radius); 2017 var size_box = radius; 2018 2019 for (i = 0; i < total; i++) { 2020 var _ileft = (self.settings.width_skitter / 2) - (size_box / 2); 2021 var _itop = (self.settings.height_skitter / 2) - (size_box / 2); 2022 2023 var _fleft = _ileft; 2024 var _ftop = _itop; 2025 var box_clone = null; 2026 2027 box_clone = this.getBoxCloneBackground({ 2028 image: image_old, 2029 left: _ileft, 2030 top: _itop, 2031 width: size_box, 2032 height: size_box, 2033 position: { 2034 top: -_itop, 2035 left: -_ileft 2036 } 2037 }).css3({ 2038 'border-radius': radius+'px' 2039 }); 2040 2041 size_box -= 100; 2042 2043 this.addBoxClone(box_clone); 2044 box_clone.show(); 2045 2046 var delay_time = 70 * i; 2047 var callback = (i == (total - 1)) ? function() { self.finishAnimation(); } : ''; 2048 box_clone.delay(delay_time).animate({top: _ftop, left: _fleft, opacity: 'hide'}, time_animate, easing, callback); 2049 2050 } 2051 }, 2052 2053 animationCirclesRotate: function(options) 2054 { 2055 var self = this; 2056 2057 this.settings.is_animating = true; 2058 var easing = (this.settings.easing_default == '') ? 'easeOutQuad' : this.settings.easing_default; 2059 var time_animate = 500 / this.settings.velocity; 2060 2061 var image_old = this.box_skitter.find('.image_main').attr('src'); 2062 2063 this.setActualLevel(); 2064 2065 this.setLinkAtual(); 2066 this.box_skitter.find('.image_main').attr({'src':this.settings.image_atual}); 2067
2068 var total = Math.ceil(this.settings.width_skitter / (this.settings.width_skitter / 10)); 2069 2070 var radius = Math.sqrt(Math.pow((this.settings.width_skitter), 2) + Math.pow((this.settings.height_skitter), 2)); 2071 var radius = Math.ceil(radius); 2072 var size_box = radius; 2073 2074 for (i = 0; i < total; i++) { 2075 var _ileft = (self.settings.width_skitter / 2) - (size_box / 2); 2076 var _itop = (self.settings.height_skitter / 2) - (size_box / 2); 2077 2078 var _fleft = _ileft; 2079 var _ftop = _itop; 2080 var box_clone = null; 2081 2082 box_clone = this.getBoxCloneImgOld(image_old); 2083 box_clone.css({left: _ileft, top:_itop, width:size_box, height:size_box}).css3({ 2084 'border-radius': radius+'px' 2085 }); 2086 box_clone.find('img').css({left: -_ileft, top: -_itop}); 2087 2088 size_box -= 100; 2089 2090 this.addBoxClone(box_clone); 2091 box_clone.show(); 2092 2093 var delay_time = 100 * i; 2094 var callback = (i == (total - 1)) ? function() { self.finishAnimation(); } : ''; 2095 var _rotate = (i % 2 == 0) ? '20deg' : '-20deg'; 2096 box_clone.delay(delay_time).animate({top: _ftop, left: _fleft, opacity: 'hide', rotate: _rotate}, time_animate, easing, callback); 2097 } 2098 }, 2099 2100 animationCubeShow: function(options) 2101 { 2102 var self = this; 2103 2104 this.settings.is_animating = true; 2105 var easing = (this.settings.easing_default == '') ? 'easeOutQuad' : this.settings.easing_default; 2106 var time_animate = 400 / this.settings.velocity; 2107 2108 this.setActualLevel(); 2109 2110 var division_w = Math.ceil(this.settings.width_skitter / (this.settings.width_skitter / 8)); 2111 var division_h = Math.ceil(this.settings.height_skitter / (this.settings.height_skitter / 4)); 2112 var total = division_w * division_h; 2113 2114 var width_box = Math.ceil(this.settings.width_skitter / division_w); 2115 var height_box = Math.ceil(this.settings.height_skitter / division_h); 2116 2117 var last = false; 2118 2119 var _btop = 0; 2120 var _bleft = 0; 2121 var line = 0; 2122 var col = 0; 2123 2124 for (i = 0; i < total; i++) { 2125 2126 _btop = height_box * line; 2127 _bleft = width_box * col; 2128 2129 var delay_time = 30 * (i); 2130 2131 var box_clone = this.getBoxClone(); 2132 box_clone.css({left:_bleft, top:_btop, width:width_box, height:height_box}).hide(); 2133 box_clone.find('img').css({left:-_bleft, top:-_btop}); 2134 this.addBoxClone(box_clone); 2135 2136 var callback = (i == (total - 1)) ? function() { self.finishAnimation(); } : ''; 2137 box_clone.delay(delay_time).animate({width:'show', height:'show'}, time_animate, easing, callback); 2138 2139 line++; 2140 if (line == division_h) { 2141 line = 0; 2142 col++; 2143 } 2144 } 2145 }, 2146 2147 animationDirectionBars: function(options) 2148 { 2149 var self = this; 2150 2151 var options = $.extend({}, {direction: 'top'}, options || {}); 2152 2153 this.settings.is_animating = true; 2154 var easing = (this.settings.easing_default == '') ? 'easeInOutQuad' : this.settings.easing_default; 2155 var time_animate = 400 / this.settings.velocity; 2156 2157 var image_old = this.box_skitter.find('.image_main').attr('src'); 2158 2159 this.setActualLevel(); 2160 2161 this.setLinkAtual(); 2162 this.box_skitter.find('.image_main').attr({'src':this.settings.image_atual}); 2163 2164 var total = 12; 2165 var width_box = Math.ceil(this.settings.width_skitter / total); 2166 var height_box = this.settings.height_skitter; 2167 var _ftop = (options.direction == 'top') ? -height_box : height_box; 2168 2169 for (i = 0; i < total; i++) { 2170 var _vtop = 0; 2171 var _vleft = (width_box * i); 2172 var _vtop_image = 0; 2173 var _vleft_image = -(width_box * i); 2174 2175 var box_clone = this.getBoxCloneImgOld(image_old); 2176 box_clone.css({left:_vleft+'px', top:_vtop+'px', width:width_box, height:height_box}); 2177 box_clone.find('img').css({left:_vleft_image, top:_vtop_image}); 2178 2179 this.addBoxClone(box_clone); 2180 box_clone.show(); 2181 2182 var delay_time = 70 * i; 2183 var callback = (i == (total - 1)) ? function() { self.finishAnimation(); } : ''; 2184 2185 box_clone.delay(delay_time).animate({top:_ftop}, time_animate, easing, callback); 2186 } 2187 2188 }, 2189 2190 animationHideBars: function(options) 2191 { 2192 var self = this; 2193 2194 var options = $.extend({}, {random: false}, options || {}); 2195 2196 this.settings.is_animating = true; 2197 var easing = (this.settings.easing_default == '') ? 'easeOutCirc' : this.settings.easing_default; 2198 var time_animate = 700 / this.settings.velocity; 2199 2200 var image_old = this.box_skitter.find('.image_main').attr('src'); 2201 2202 this.setActualLevel(); 2203 2204 this.setLinkAtual(); 2205 this.box_skitter.find('.image_main').attr({'src':this.settings.image_atual}); 2206 2207 var division_w = Math.ceil(this.settings.width_skitter / (this.settings.width_skitter / 10)); 2208 var total = division_w; 2209 2210 var width_box = Math.ceil(this.settings.width_skitter / division_w); 2211 var height_box = this.settings.height_skitter; 2212 2213 for (i = 0; i < total; i++) { 2214 var _vtop = 0; 2215 var _vleft = width_box * i; 2216 2217 var _vtop_image = 0; 2218 var _vleft_image = -(width_box * i); 2219 2220 var _fleft = '+='+width_box; 2221 2222 var box_clone = this.getBoxCloneImgOld(image_old); 2223 box_clone.css({left:0, top:0, width:width_box, height:height_box}); 2224 box_clone.find('img').css({left:_vleft_image, top:_vtop_image}); 2225 2226 var box_clone_main = this.getBoxCloneImgOld(image_old); 2227 box_clone_main.css({left:_vleft+'px', top:_vtop+'px', width:width_box, height:height_box}); 2228 box_clone_main.html(box_clone); 2229 2230 this.addBoxClone(box_clone_main); 2231 box_clone.show(); 2232 box_clone_main.show(); 2233 2234 var delay_time = 50 * i; 2235 var callback = (i == (total - 1)) ? function() { self.finishAnimation(); } : ''; 2236 2237 box_clone.delay(delay_time).animate({left:_fleft}, time_animate, easing, callback); 2238 } 2239 }, 2240 2241 animationSwapBars: function(options) 2242 { 2243 var self = this; 2244 2245 var options = $.extend({}
2245, {direction: 'top', delay_type: 'sequence', total: 7, easing: 'easeOutCirc'}, options || {}); 2246 2247 this.settings.is_animating = true; 2248 var easing = (this.settings.easing_default == '') ? options.easing : this.settings.easing_default; 2249 var time_animate = 500 / this.settings.velocity; 2250 2251 var image_old = this.box_skitter.find('.image_main').attr('src'); 2252 2253 this.setActualLevel(); 2254 2255 this.setLinkAtual(); 2256 this.box_skitter.find('.image_main').attr({'src':this.settings.image_atual}); 2257 this.box_skitter.find('.image_main').hide(); 2258 2259 var total = options.total; 2260 2261 for (i = 0; i < total; i++) { 2262 2263 var width_box = Math.ceil(this.settings.width_skitter / total); 2264 var height_box = this.settings.height_skitter; 2265 2266 var _itopc = 0; 2267 var _ileftc = (width_box * i); 2268 var _ftopc = -height_box; 2269 var _fleftc = _ileftc + width_box ; 2270 2271 var _itopn = height_box; 2272 var _ileftn = _ileftc; 2273 var _ftopn = 0; 2274 var _fleftn = _ileftc; 2275 2276 var _vtop_image = 0; 2277 var _vleft_image = -_ileftc; 2278 2279 switch (options.delay_type) 2280 { 2281 case 'zebra' : default : var delay_time = (i % 2 == 0) ? 0 : 150; break; 2282 case 'random' : var delay_time = 30 * (Math.random() * 30); break; 2283 case 'sequence' : var delay_time = i * 100; break; 2284 } 2285 2286 // Old image 2287 var box_clone = this.getBoxCloneImgOld(image_old); 2288 box_clone.find('img').css({left:_vleft_image, top:0}); 2289 box_clone.css({top:0, left:0, width:width_box, height:height_box}); 2290 2291 // Next image 2292 var box_clone_next = this.getBoxClone(); 2293 box_clone_next.find('img').css({left:_vleft_image, top:0}); 2294 box_clone_next.css({top:0, left:-width_box, width:width_box, height:height_box}); 2295 2296 // Container box images 2297 var box_clone_container = this.getBoxClone(); 2298 box_clone_container.html('').append(box_clone).append(box_clone_next); 2299 box_clone_container.css({top:0, left:_ileftc, width:width_box, height:height_box}); 2300 2301 // Add containuer 2302 this.addBoxClone(box_clone_container); 2303 2304 // Show boxes 2305 box_clone_container.show(); 2306 box_clone.show(); 2307 box_clone_next.show(); 2308 2309 // Callback 2310 var callback = (i == (total - 1)) ? function() { self.finishAnimation(); } : ''; 2311 2312 // Animations 2313 box_clone.delay(delay_time).animate({ left: width_box }, time_animate, easing); 2314 box_clone_next.delay(delay_time).animate({ left:0 }, time_animate, easing, callback); 2315 } 2316 }, 2317 2318 animationSwapBlocks: function(options) 2319 { 2320 var self = this; 2321 2322 var options = $.extend({}, {easing_old: 'easeInOutQuad', easing_new: 'easeOutQuad'}, options || {}); 2323 2324 this.settings.is_animating = true; 2325 var easing_old = (this.settings.easing_default == '') ? options.easing_old : this.settings.easing_default; 2326 var easing_new = (this.settings.easing_default == '') ? options.easing_new : this.settings.easing_default; 2327 var time_animate = 800 / this.settings.velocity; 2328 2329 var image_old = this.box_skitter.find('.image_main').attr('src'); 2330 2331 this.setActualLevel(); 2332 2333 this.setLinkAtual(); 2334 this.box_skitter.find('.image_main').attr({'src':this.settings.image_atual}); 2335 this.box_skitter.find('.image_main').hide(); 2336 2337 var total = 2; 2338 var width_box = this.settings.width_skitter; 2339 var height_box = Math.ceil(this.settings.height_skitter / total); 2340 2341 // Old image 2342 var box_clone1 = this.getBoxCloneImgOld(image_old), box_clone2 = this.getBoxCloneImgOld(image_old); 2343 box_clone1.find('img').css({left:0, top:0}); 2344 box_clone1.css({top:0, left:0, width:width_box, height:height_box}); 2345 2346 box_clone2.find('img').css({left:0, top:-height_box}); 2347 box_clone2.css({top:height_box, left:0, width:width_box, height:height_box}); 2348 2349 // Next image 2350 var box_clone_next1 = this.getBoxClone(), box_clone_next2 = this.getBoxClone(); 2351 box_clone_next1.find('img').css({left:0, top:height_box});
2352 box_clone_next1.css({top:0, left:0, width:width_box, height:height_box}); 2353 2354 box_clone_next2.find('img').css({left:0, top: -(height_box * total) }); 2355 box_clone_next2.css({top:height_box, left:0, width:width_box, height:height_box}); 2356 2357 // Add boxes 2358 this.addBoxClone(box_clone_next1); 2359 this.addBoxClone(box_clone_next2); 2360 this.addBoxClone(box_clone1); 2361 this.addBoxClone(box_clone2); 2362 2363 // Show boxes 2364 box_clone1.show(); 2365 box_clone2.show(); 2366 box_clone_next1.show(); 2367 box_clone_next2.show(); 2368 2369 // Callback 2370 var callback = function() { self.finishAnimation(); }; 2371 2372 // Animations 2373 box_clone1.find('img').animate({ top: height_box }, time_animate, easing_old, function() { 2374 box_clone1.remove(); 2375 }); 2376 box_clone2.find('img').animate({ top: -(height_box * total) }, time_animate, easing_old, function() { 2377 box_clone2.remove(); 2378 }); 2379 box_clone_next1.find('img').animate({ top: 0 }, time_animate, easing_new); 2380 box_clone_next2.find('img').animate({ top: -height_box }, time_animate, easing_new, callback); 2381 }, 2382 2383 animationCut: function(options) 2384 { 2385 var self = this; 2386 2387 var options = $.extend({}, {easing_old: 'easeInOutExpo', easing_new: 'easeInOutExpo'}, options || {}); 2388 2389 this.settings.is_animating = true; 2390 var easing_old = (this.settings.easing_default == '') ? options.easing_old : this.settings.easing_default; 2391 var easing_new = (this.settings.easing_default == '') ? options.easing_new : this.settings.easing_default; 2392 var time_animate = 900 / this.settings.velocity; 2393 2394 var image_old = this.box_skitter.find('.image_main').attr('src'); 2395 2396 this.setActualLevel(); 2397 2398 this.setLinkAtual(); 2399 this.box_skitter.find('.image_main').attr({'src':this.settings.image_atual}); 2400 this.box_skitter.find('.image_main').hide(); 2401 2402 var total = 2; 2403 var width_box = this.settings.width_skitter; 2404 var height_box = Math.ceil(this.settings.height_skitter / total); 2405 2406 // Old image 2407 var box_clone1 = this.getBoxCloneImgOld(image_old), box_clone2 = this.getBoxCloneImgOld(image_old); 2408 box_clone1.find('img').css({left:0, top:0}); 2409 box_clone1.css({top:0, left:0, width:width_box, height:height_box}); 2410 2411 box_clone2.find('img').css({left:0, top:-height_box}); 2412 box_clone2.css({top:height_box, left:0, width:width_box, height:height_box}); 2413 2414 // Next image 2415 var box_clone_next1 = this.getBoxClone(), box_clone_next2 = this.getBoxClone(); 2416 //box_clone_next1.find('img').css({left:0, top:height_box}); 2417 box_clone_next1.find('img').css({left:0, top:0}); 2418 box_clone_next1.css({top:0, left:width_box, width:width_box, height:height_box}); 2419 2420 //box_clone_next2.find('img').css({left:0, top: -(height_box * total) }); 2421 box_clone_next2.find('img').css({left:0, top: -height_box }); 2422 box_clone_next2.css({top:height_box, left:-width_box, width:width_box, height:height_box}); 2423 2424 // Add boxes 2425 this.addBoxClone(box_clone_next1); 2426 this.addBoxClone(box_clone_next2); 2427 this.addBoxClone(box_clone1); 2428 this.addBoxClone(box_clone2); 2429 2430 // Show boxes 2431 box_clone1.show(); 2432 box_clone2.show(); 2433 box_clone_next1.show(); 2434 box_clone_next2.show(); 2435 2436 // Callback 2437 var callback = function() { self.finishAnimation(); }; 2438 2439 // Animations 2440 box_clone1.animate({ left: -width_box }, time_animate, easing_old, function() { 2441 box_clone1.remove(); 2442 }); 2443 box_clone2.animate({ left: width_box }, time_animate, easing_old, function() { 2444 box_clone2.remove(); 2445 }); 2446 box_clone_next1.animate({ left: 0 }, time_animate, easing_new); 2447 box_clone_next2.animate({ left: 0 }, time_animate, easing_new, callback); 2448 }, 2449 2450 // End animations ---------------------- 2451 2452 // Finish animation 2453 finishAnimation: function (options) 2454 { 2455 var self = this; 2456 this.box_skitter.find('.image_main').show(); 2457 this.showBoxText(); 2458 this.settings.is_animating = false; 2459 this.box_skitter.find('.image_main').attr({'src': this.settings.image_atual}); 2460 this.box_skitter.find('.image a').attr({'href': this.settings.link_atual}); 2461 2462 if (!this.settings.is_hover_box_skitter && !this.settings.is_paused && !this.settings.is_blur) { 2463 this.timer = setTimeout(function() { self.completeMove(); }, this.settings.interval); 2464 } 2465 2466 self.startTime(); 2467 }, 2468 2469 // Complete move 2470 completeMove: function () 2471 { 2472 this.clearTimer(true); 2473 this.box_skitter.find('.box_clone').remove(); 2474 if (!this.settings.is_paused && !this.settings.is_blur) this.nextImage(); 2475 }, 2476 2477 // Actual config for animation 2478 setActualLevel: function() { 2479 if ($.isFunction(this.settings.imageSwitched)) this.settings.imageSwitched(this.settings.image_i, this); 2480 this.setImageLink(); 2481 this.addClassNumber(); 2482 this.hideBoxText(); 2483 this.increasingImage(); 2484 }, 2485 2486 // Set image and link 2487 setImageLink: function() 2488 { 2489 var name_image = this.settings.images_links[this.settings.image_i][0]; 2490 var link_image = this.settings.images_links[this.settings.image_i][1]; 2491 var label_image = this.settings.images_links[this.settings.image_i][3]; 2492 var target_link = this.settings.images_links[this.settings.image_i][4]; 2493 2494 this.settings.image_atual = name_image; 2495 this.settings.link_atual = link_image; 2496 this.settings.label_atual = label_image; 2497 this.settings.target_atual = target_link; 2498 }, 2499 2500 // Add class for number 2501 addClassNumber: function () 2502 { 2503 var self = this; 2504 // this.box_skitter.find('.image_number_select').animate(self.settings.animateNumberOut, 500).removeClass('image_number_select'); 2505 // $('#image_n_'+(this.settings.image_i+1)+'_'+self.number_skitter).animate(self.settings.animateNumberActive, 700).addClass('image_number_select'); 2506 this.box_skitter.find('.image_number_select').removeClass('image_number_select'); 2507 $('#image_n_'+(this.settings.image_i+1)+'_'+self.number_skitter).addClass('image_number_select'); 2508 }, 2509 2510 // Increment image_i 2511 increasingImage: function() 2512 { 2513 this.settings.image_i++; 2514 if (this.settings.image_i == this.settings.images_links.length) { 2515 this.settings.image_i = 0; 2516 } 2517 }, 2518 2519 // Get box clone 2520 getBoxClone: function() 2521 { 2522 if (this.settings.link_atual != '#') { 2523 var img_clone = $('<a href="'+this.settings.link_atual+'"><img src="'+this.settings.image_atual+'" /></a>'); 2524 img_clone.attr({ 'target': this.settings.target_atual }); 2525 } 2526 else { 2527 var img_clone = $('<img src="'+this.settings.image_atual+'" />'); 2528 } 2529 2530 img_clone = this.resizeImage(img_clone);
2531 var box_clone = $('<div class="box_clone"></div>'); 2532 box_clone.append(img_clone); 2533 return box_clone; 2534 }, 2535 2536 // Get box clone 2537 getBoxCloneImgOld: function(image_old) 2538 { 2539 if (this.settings.link_atual != '#') { 2540 var img_clone = $('<a href="'+this.settings.link_atual+'"><img src="'+image_old+'" /></a>'); 2541 img_clone.attr({ 'target': this.settings.target_atual }); 2542 } 2543 else { 2544 var img_clone = $('<img src="'+image_old+'" />'); 2545 } 2546 2547 img_clone = this.resizeImage(img_clone); 2548 var box_clone = $('<div class="box_clone"></div>'); 2549 box_clone.append(img_clone); 2550 return box_clone; 2551 }, 2552 2553 // Redimensiona imagem 2554 resizeImage: function(img_clone) 2555 { 2556 if (this.settings.fullscreen) { 2557 img_clone.find('img').height(this.settings.height_skitter); 2558 } 2559 return img_clone; 2560 }, 2561 2562 // Add box clone in box_skitter 2563 addBoxClone: function(box_clone) 2564 { 2565 this.box_skitter.find('.container_skitter').append(box_clone); 2566 }, 2567 2568 // Get accepts easing 2569 getEasing: function(easing) 2570 { 2571 var easing_accepts = [ 2572 'easeInQuad', 'easeOutQuad', 'easeInOutQuad', 2573 'easeInCubic', 'easeOutCubic', 'easeInOutCubic', 2574 'easeInQuart', 'easeOutQuart', 'easeInOutQuart', 2575 'easeInQuint', 'easeOutQuint', 'easeInOutQuint', 2576 'easeInSine', 'easeOutSine', 'easeInOutSine', 2577 'easeInExpo', 'easeOutExpo', 'easeInOutExpo', 2578 'easeInCirc', 'easeOutCirc', 'easeInOutCirc', 2579 'easeInElastic', 'easeOutElastic', 'easeInOutElastic', 2580 'easeInBack', 'easeOutBack', 'easeInOutBack', 2581 'easeInBounce', 'easeOutBounce', 'easeInOutBounce', 2582 ]; 2583 2584 if (jQuery.inArray(easing, easing_accepts) > 0) { 2585 return easing; 2586 } 2587 else { 2588 return ''; 2589 } 2590 }, 2591 2592 // Get random number 2593 getRandom: function (i) 2594 { 2595 return Math.floor(Math.random() * i); 2596 }, 2597 2598 // Set value for text 2599 setValueBoxText: function () 2600 { 2601 this.box_skitter.find('.label_skitter').html(this.settings.label_atual); 2602 }, 2603 2604 // Show box text 2605 showBoxText: function () 2606 { 2607 var self = this; 2608 2609 if ( this.settings.label_atual != undefined && this.settings.label_atual != '' && self.settings.label ) { 2610 2611 switch ( self.settings.labelAnimation ) { 2612 2613 case 'slideUp' : default : 2614 self.box_skitter.find('.label_skitter').slideDown(400); 2615 break; 2616 2617 case 'left' : case 'right' : 2618 self.box_skitter.find('.label_skitter').animate({ left: 0 }, 400, 'easeInOutQuad'); 2619 break; 2620 2621 case 'fixed' : 2622 // null 2623 break; 2624 } 2625 } 2626 }, 2627 2628 // Hide box text 2629 hideBoxText: function () 2630 { 2631 var self = this; 2632 2633 switch ( self.settings.labelAnimation ) { 2634 2635 case 'slideUp' : default : 2636 this.box_skitter.find('.label_skitter').slideUp(200, function() { 2637 self.setValueBoxText(); 2638 }); 2639 break; 2640 2641 case 'left' : case 'right' : 2642 var _left = ( self.settings.labelAnimation == 'left' ) ? -(self.box_skitter.find('.label_skitter').width()) : (self.box_skitter.find('.label_skitter').width()); 2643 self.box_skitter.find('.label_skitter').animate({ left: _left }, 400, 'easeInOutQuad', function() { 2644 self.setValueBoxText(); 2645 }); 2646 break; 2647 2648 case 'fixed' : 2649 self.setValueBoxText(); 2650 break; 2651 } 2652 }, 2653 2654 // Stop time to get over box_skitter 2655 stopOnMouseOver: function () 2656 { 2657 var self = this; 2658 2659 if ( self.settings.stop_over ) 2660 { 2661 self.box_skitter.hover(function() { 2662 2663 if (self.settings.stop_over) self.settings.is_hover_box_skitter = true; 2664 2665 if (!self.settings.is_paused_time) { 2666 self.pauseTime(); 2667 } 2668 2669 self.setHideTools('hover'); 2670 self.clearTimer(true); 2671 2672 }, function() { 2673 if (self.settings.stop_over) self.settings.is_hover_box_skitter = false; 2674 2675 if (self.settings.elapsedTime == 0 && !self.settings.is_animating && !self.settings.is_paused) { 2676 self.startTime(); 2677 } 2678 else if (!self.settings.is_paused) { 2679 self.resumeTime(); 2680 } 2681 2682 self.setHideTools('out'); 2683 self.clearTimer(true); 2684 2685 if (!self.settings.is_animating && self.settings.images_links.length > 1) { 2686 self.timer = setTimeout(function() { self.completeMove(); }, self.settings.interval - self.settings.elapsedTime); 2687 self.box_skitter.find('.image_main').attr({'src': self.settings.image_atual}); 2688 self.box_skitter.find('.image a').attr({'href': self.settings.link_atual}); 2689 } 2690 }); 2691 } 2692 else 2693 { 2694 self.box_skitter.hover(function() { 2695 self.setHideTools('hover'); 2696 }, function() { 2697 self.setHideTools('out'); 2698 }); 2699 } 2700 }, 2701 2702 // Hover/out hideTools 2703 setHideTools: function( type ) { 2704 var self = this; 2705 var opacity_elements = self.settings.opacity_elements; 2706 var interval_in_elements = self.settings.interval_in_elements; 2707 var interval_out_elements = self.settings.interval_out_elements; 2708 2709 if ( type == 'hover' ) { 2710 if (self.settings.hideTools) { 2711 if (self.settings.numbers) { 2712 self.box_skitter 2713 .find('.info_slide') 2714 .show() 2715 .css({opacity:0}
2715) 2716 .animate({opacity: opacity_elements}, interval_in_elements); 2717 } 2718 2719 if (self.settings.navigation) { 2720 self.box_skitter 2721 .find('.prev_button, .next_button') 2722 .show() 2723 .css({opacity:0}) 2724 .animate({opacity: opacity_elements}, interval_in_elements); 2725 } 2726 2727 if (self.settings.focus && !self.settings.foucs_active) { 2728 self.box_skitter 2729 .find('.focus_button') 2730 .stop() 2731 .show().css({opacity:0}) 2732 .animate({opacity:opacity_elements}, interval_in_elements); 2733 } 2734 2735 if (self.settings.controls) { 2736 self.box_skitter 2737 .find('.play_pause_button') 2738 .stop() 2739 .show().css({opacity:0}) 2740 .animate({opacity:opacity_elements}, interval_in_elements); 2741 } 2742 } 2743 2744 if (self.settings.focus && !self.settings.foucs_active && !self.settings.hideTools) { 2745 self.box_skitter 2746 .find('.focus_button') 2747 .stop() 2748 .animate({opacity:1}, interval_in_elements); 2749 } 2750 2751 if (self.settings.controls && !self.settings.hideTools) { 2752 self.box_skitter 2753 .find('.play_pause_button') 2754 .stop() 2755 .animate({opacity:1}, interval_in_elements); 2756 } 2757 } 2758 else { 2759 if (self.settings.hideTools) { 2760 if (self.settings.numbers) { 2761 self.box_skitter 2762 .find('.info_slide') 2763 .queue("fx", []) 2764 .show() 2765 .css({opacity: opacity_elements}) 2766 .animate({opacity:0}
2766, interval_out_elements); 2767 } 2768 2769 if (self.settings.navigation) { 2770 self.box_skitter 2771 .find('.prev_button, .next_button') 2772 .queue("fx", []) 2773 .show() 2774 .css({opacity: opacity_elements}) 2775 .animate({opacity:0}, interval_out_elements); 2776 } 2777 2778 if (self.settings.focus && !self.settings.foucs_active) { 2779 self.box_skitter 2780 .find('.focus_button') 2781 .stop() 2782 .css({opacity: opacity_elements}) 2783 .animate({opacity:0}, interval_out_elements); 2784 } 2785 2786 if (self.settings.controls) { 2787 self.box_skitter 2788 .find('.play_pause_button') 2789 .stop() 2790 .css({opacity: opacity_elements}) 2791 .animate({opacity:0}, interval_out_elements); 2792 } 2793 } 2794 2795 if (self.settings.focus && !self.settings.foucs_active && !self.settings.hideTools) { 2796 self.box_skitter 2797 .find('.focus_button') 2798 .stop() 2799 .animate({opacity:0.3}, interval_out_elements); 2800 } 2801 2802 if (self.settings.controls && !self.settings.hideTools) { 2803 self.box_skitter 2804 .find('.play_pause_button') 2805 .stop() 2806 .animate({opacity:0.3}, interval_out_elements); 2807 } 2808 } 2809 }, 2810 2811 // Stop timer 2812 clearTimer: function (force) { 2813 var self = this; 2814 clearInterval(self.timer); 2815 }, 2816 2817 // Set link atual 2818 setLinkAtual: function() { 2819 if (this.settings.link_atual != '#' && this.settings.link_atual != '') { 2820 this.box_skitter.find('.image a').attr({'href': this.settings.link_atual, 'target': this.settings.target_atual}); 2821 } 2822 else { 2823 this.box_skitter.find('.image a').removeAttr('href'); 2824 } 2825 }, 2826 2827 // Hide tools 2828 hideTools: function() { 2829 this.box_skitter.find('.info_slide').fadeTo(0, 0); 2830 this.box_skitter.find('.prev_button').fadeTo(0, 0); 2831 this.box_skitter.find('.next_button').fadeTo(0, 0); 2832 this.box_skitter.find('.focus_button').fadeTo(0, 0); 2833 this.box_skitter.find('.play_pause_button').fadeTo(0, 0); 2834 }, 2835 2836 // Focus Skitter 2837 focusSkitter: function() { 2838 var self = this; 2839 2840 var focus_button = $('<a href="#" class="focus_button">focus</a>'); 2841 self.box_skitter.append(focus_button); 2842 2843 var _left = (self.settings.width_skitter - focus_button.width()) / 2; 2844 var _space = 0; 2845 2846 if (self.settings.controls) _left -= 25; 2847 if (self.settings.controls_position == self.settings.focus_position) _space = focus_button.width() + 5; 2848 2849 var cssPosition = {left: _left}; 2850 2851 switch (self.settings.focus_position) 2852 { 2853 case 'leftTop' : cssPosition = {left: 5 + _space, top: 30}; break; 2854 case 'rightTop' : cssPosition = {right: 5 + _space, top: 30}; break; 2855 case 'leftBottom' : cssPosition = {left: 5 + _space, bottom: 5, top: 'auto'}; break; 2856 case 'rightBottom' : cssPosition = {right: 5 + _space, bottom: 5, top: 'auto'}; break; 2857 } 2858 2859 focus_button 2860 .css(cssPosition) 2861 .animate({opacity:0.3}, self.settings.interval_in_elements); 2862 2863 $(document).keypress(function(e) { 2864 var code = (e.keyCode ? e.keyCode : e.which); 2865 if (code == 27) $('#overlay_skitter').trigger('click'); 2866 }); 2867 2868 var _top = $('.box_skitter').offset().top; 2869 var _left = $('.box_skitter').offset().left; 2870 2871 self.box_skitter.find('.focus_button').click(function() { 2872 if ( self.settings.foucs_active ) return false; 2873 self.settings.foucs_active = true; 2874 2875 $(this).stop().animate({opacity:0}
2875, self.settings.interval_out_elements); 2876 2877 var div = $('<div id="overlay_skitter"></div>') 2878 .height( $(document).height() ) 2879 .hide() 2880 .fadeTo(self.settings.interval_in_elements, 0.98); 2881 2882 var _topFinal = (($(window).height() - $('.box_skitter').height()) / 2) + $(document).scrollTop(); 2883 var _leftFinal = ($(window).width() - $('.box_skitter').width()) / 2; 2884 2885 self.box_skitter.before('<div id="mark_position"></div>'); 2886 $('body').prepend(div); 2887 $('body').prepend(self.box_skitter); 2888 self.box_skitter 2889 .css({'top':_top, 'left':_left, 'position':'absolute', 'z-index':9999}) 2890 .animate({'top':_topFinal, 'left':_leftFinal}, 2000, 'easeOutExpo'); 2891 2892 $('#mark_position') 2893 .width($('.box_skitter').width()) 2894 .height($('.box_skitter').height()) 2895 .css({'background':'none'}) 2896 .fadeTo(300,0.3); 2897 2898 return false; 2899 }); 2900 2901 $(document).on('click', '#overlay_skitter', function() { 2902 if ( $(this).hasClass('finish_overlay_skitter') ) return false; 2903 2904 self.settings.foucs_active = false; 2905 $(this).addClass('finish_overlay_skitter'); 2906 2907 if (!self.settings.hideTools) self.box_skitter.find('.focus_button').animate({opacity:0.3}, 200); 2908 2909 self.box_skitter 2910 .stop() 2911 .animate({'top':_top, 'left':_left}, 200, 'easeOutExpo', function() { 2912 $('#mark_position').before(self.box_skitter); 2913 $(this).css({'position':'relative', 'top':0, 'left': 0}); 2914 $('#mark_position').remove(); 2915 }); 2916 2917 $('#overlay_skitter').fadeTo(self.settings.interval_out_elements, 0, function() { 2918 $(this).remove(); 2919 }); 2920 2921 return false; 2922 }); 2923 }, 2924 2925 /** 2926 * Controls: play and stop 2927 */ 2928 setControls: function() { 2929 var self = this; 2930 2931 var play_pause_button = $('<a href="#" class="play_pause_button">pause</a>'); 2932 self.box_skitter.append(play_pause_button); 2933 2934 var _left = (self.settings.width_skitter - play_pause_button.width()) / 2; 2935 2936 if (self.settings.focus) _left += 25; 2937 2938 var cssPosition = {left: _left}; 2939 2940 switch (self.settings.controls_position) 2941 { 2942 case 'leftTop' : cssPosition = {left: 5, top: 30}; break; 2943 case 'rightTop' : cssPosition = {right: 5, top: 30}; break; 2944 case 'leftBottom' : cssPosition = {left: 5, bottom: 5, top: 'auto'}; break; 2945 case 'rightBottom' : cssPosition = {right: 5, bottom: 5, top: 'auto'}; break; 2946 } 2947 2948 play_pause_button 2949 .css(cssPosition) 2950 .animate({opacity:0.3}, self.settings.interval_in_elements); 2951 2952 play_pause_button.click(function() { 2953 if (!self.settings.is_paused) { 2954 $(this).html('play'); 2955 $(this).fadeTo(100, 0.5).fadeTo(100, 1); 2956 2957 $(this).addClass('play_button'); 2958 self.pauseTime(); 2959 self.settings.is_paused = true; 2960 self.clearTimer(true); 2961 } 2962 else { 2963 if (!self.settings.is_animating && !self.box_skitter.find('.progressbar').is(':visible')) { 2964 self.settings.elapsedTime = 0; 2965 } 2966 else { 2967 self.resumeTime(); 2968 } 2969 2970 if (!self.settings.progressbar) self.resumeTime(); 2971 2972 self.settings.is_paused = false; 2973 2974 $(this).html('pause'); 2975 $(this).fadeTo(100, 0.5).fadeTo(100, 1); 2976 $(this).removeClass('play_button'); 2977 2978 if (!self.settings.stop_over) { 2979 self.clearTimer(true); 2980 if (!self.settings.is_animating && self.settings.images_links.length > 1) { 2981 self.timer = setTimeout(function() { self.completeMove(); }, self.settings.interval - self.settings.elapsedTime); 2982 self.box_skitter.find('.image_main').attr({'src': self.settings.image_atual}); 2983 self.box_skitter.find('.image a').attr({'href': self.settings.link_atual}); 2984 } 2985 } 2986 } 2987 2988 return false; 2989 }); 2990 }, 2991 2992 /** 2993 * Object size 2994 */ 2995 objectSize: function(obj) { 2996 var size = 0, key; 2997 for (key in obj) { if (obj.hasOwnProperty(key)) size++; } 2998 return size; 2999 }, 3000 3001 /** 3002 * Add progress bar 3003 */ 3004 addProgressBar: function() { 3005 var self = this; 3006 3007 var progressbar = $('<div class="progressbar"></div>'); 3008 self.box_skitter.append(progressbar); 3009 3010 if (self.objectSize(self.settings.progressbar_css) == 0) { 3011 if (parseInt(progressbar.css('width')) > 0) { 3012 self.settings.progressbar_css.width = parseInt(progressbar.css('width')); 3013 } 3014 else { 3015 self.settings.progressbar_css = {width: self.settings.width_skitter, height:5}; 3016 } 3017 } 3018 if (self.objectSize(self.settings.progressbar_css) > 0 && self.settings.progressbar_css.width == undefined) { 3019 self.settings.progressbar_css.width = self.settings.width_skitter; 3020 } 3021 3022 progressbar.css(self.settings.progressbar_css).hide(); 3023 }, 3024 3025 /** 3026 * Start progress bar 3027 */ 3028 startProgressBar: function() { 3029 var self = this; 3030 if (self.settings.is_hover_box_skitter || self.settings.is_paused || self.settings.is_blur || !self.settings.progressbar) return false; 3031 self.box_skitter.find('.progressbar') 3032 .hide() 3033 .dequeue() 3034 .width(self.settings.progressbar_css.width) 3035 .animate({width:'show'}, self.settings.interval, 'linear'); 3036 }, 3037 3038 /** 3039 * Pause progress bar 3040 */ 3041 pauseProgressBar: function() { 3042 var self = this; 3043 if (!self.settings.is_animating) { 3044 self.box_skitter.find('.progressbar').stop(); 3045 } 3046 }, 3047 3048 /** 3049 * Resume progress bar 3050 */ 3051 resumeProgressBar: function() { 3052 var self = this; 3053 3054 if (self.settings.is_hover_box_skitter || self.settings.is_paused || !self.settings.progressbar) return false; 3055 3056 self.box_skitter.find('.progressbar').dequeue().animate({width: self.settings.progressbar_css.width}, (self.settings.interval - self.settings.elapsedTime), 'linear'); 3057 }, 3058 3059 /** 3060 * Hide progress bar 3061 */ 3062 hideProgressBar: function() { 3063 var self = this; 3064 3065 if (!self.settings.progressbar) return false; 3066 3067 self.box_skitter.find('.progressbar').stop().fadeOut(300, function() { 3068 $(this).width(self.settings.progressbar_css.width); 3069 }); 3070 }, 3071 3072 /** 3073 * Start time 3074 */ 3075 startTime: function() { 3076 var self = this; 3077 3078 self.settings.is_paused_time = false; 3079 3080 var date = new Date(); 3081 self.settings.elapsedTime = 0; 3082 self.settings.timeStart = date.getTime(); 3083 3084 // Start progress bar 3085 self.startProgressBar(); 3086 }, 3087 3088 /** 3089 * Pause time 3090 */ 3091 pauseTime: function() { 3092 var self = this; 3093 3094 if (self.settings.is_paused_time) return false; 3095 self.settings.is_paused_time = true; 3096 3097 var date = new Date(); 3098 self.settings.elapsedTime += date.getTime() - self.settings.timeStart; 3099 3100 // Pause progress bar 3101 self.pauseProgressBar(); 3102 }, 3103 3104 /** 3105 * Resume time 3106 */ 3107 resumeTime: function() { 3108 var self = this; 3109 3110 self.settings.is_paused_time = false; 3111 3112 var date = new Date(); 3113 self.settings.timeStart = date.getTime(); 3114 3115 // Resume progress bar 3116 self.resumeProgressBar(); 3117 }, 3118 3119 /** 3120 * Enable navigation keys 3121 */ 3122 enableNavigationKeys: function() { 3123 var self = this; 3124 $(window).keydown(function(e) { 3125 // Next 3126 if (e.keyCode == 39 || e.keyCode == 40) { 3127 self.box_skitter.find('.next_button').trigger('click'); 3128 } 3129 // Prev 3130 else if (e.keyCode == 37 || e.keyCode == 38) { 3131 self.box_skitter.find('.prev_button').trigger('click'); 3132 } 3133 }); 3134 }, 3135 3136 /** 3137 * Get box clone with background image 3138 */
3139 getBoxCloneBackground: function(options) 3140 { 3141 var box_clone = $('<div class="box_clone"></div>'); 3142 3143 box_clone.css({ 3144 'left': options.left, 3145 'top': options.top, 3146 'width': options.width, 3147 'height': options.height, 3148 'background-image': 'url('+options.image+')', 3149 'background-position': options.position.left+'px '+options.position.top+'px' 3150 }); 3151 3152 return box_clone; 3153 }, 3154 3155 /** 3156 * Shuffle array 3157 * @author Daniel Castro Machado <[email protected]> 3158 */ 3159 shuffleArray: function (arrayOrigem) { 3160 var self = this; 3161 var arrayDestino = new Array(); 3162 var indice; 3163 while (arrayOrigem.length > 0) { 3164 indice = self.randomUnique(0, arrayOrigem.length - 1); 3165 arrayDestino[arrayDestino.length] = arrayOrigem[indice]; 3166 arrayOrigem.splice(indice, 1); 3167 } 3168 return arrayDestino; 3169 }, 3170 3171 /** 3172 * Gera números aleatórios inteiros entre um intervalo 3173 * @author Daniel Castro Machado <[email protected]> 3174 */ 3175 randomUnique: function (valorIni, valorFim) { 3176 var numRandom; 3177 do numRandom = Math.random(); while (numRandom == 1); // Evita gerar o número valorFim + 1 3178 return (numRandom * (valorFim - valorIni + 1) + valorIni) | 0; 3179 }, 3180 3181 /** 3182 * Stop on window focus out 3183 * @author Dan Partac (http://thiagosf.net/projects/jquery/skitter/#comment-355473307) 3184 */ 3185 windowFocusOut: function () { 3186 var self = this; 3187 $(window).bind('blur', function(){ 3188 self.settings.is_blur = true; 3189 self.pauseTime(); 3190 self.clearTimer(true); 3191 }); 3192 $(window).bind('focus', function(){ 3193 if ( self.settings.images_links.length > 1 ) { 3194 self.settings.is_blur = false; 3195 3196 if (self.settings.elapsedTime == 0) { 3197 self.startTime(); 3198 } 3199 else { 3200 self.resumeTime(); 3201 } 3202 3203 if (self.settings.elapsedTime <= self.settings.interval) { 3204 self.clearTimer(true); // Fix bug IE: double next 3205 self.timer = setTimeout(function() { self.completeMove(); }, self.settings.interval - self.settings.elapsedTime); 3206 self.box_skitter.find('.image_main').attr({'src': self.settings.image_atual}); 3207 self.box_skitter.find('.image a').attr({'href': self.settings.link_atual}); 3208 } 3209 } 3210 }); 3211 } 3212 3213 }); 3214 3215 /** 3216 * Helper function for cross-browser CSS3 support, prepends all possible prefixes to all properties passed in 3217 * @param {Object} props Ker/value pairs of CSS3 properties 3218 */ 3219 $.fn.css3 = function(props) { 3220 var css = {}; 3221 var prefixes = ['moz', 'ms', 'o', 'webkit']; 3222 for(var prop in props) { 3223 // Add the vendor specific versions 3224 for(var i=0; i<prefixes.length; i++) 3225 css['-'+prefixes[i]+'-'+prop] = props[prop]; 3226 // Add the actual version 3227 css[prop] = props[prop]; 3228 } 3229 this.css(css); 3230 return this; 3231 }; 3232 3233 // Monkey patch jQuery 1.3.1+ to add support for setting or animating CSS 3234 // scale and rotation independently. 3235 // 2009-2010 Zachary Johnson www.zachstronaut.com 3236 // Updated 2010.11.06 3237 var rotateUnits = 'deg'; 3238 3239 $.fn.rotate = function (val) { 3240 var style = $(this).css('transform') || 'none'; 3241 if (typeof val == 'undefined') { 3242 if (style) { 3243 var m = style.match(/rotate\(([^)]+)\)/); 3244 if (m && m[1]) { 3245 return m[1];
3246 } 3247 } 3248 return 0; 3249 } 3250 var m = val.toString().match(/^(-?\d+(\.\d+)?)(.+)?$/); 3251 if (m) { 3252 if (m[3]) rotateUnits = m[3]; 3253 $(this).css('transform', 3254 style.replace(/none|rotate\([^)]*\)/, '') + 'rotate(' + m[1] + rotateUnits + ')' 3255 ); 3256 } 3257 3258 return this; 3259 }; 3260 3261 // Note that scale is unitless. 3262 $.fn.scale = function (val, duration, options) { 3263 var style = $(this).css('transform'); 3264 if (typeof val == 'undefined') { 3265 if (style) { 3266 var m = style.match(/scale\(([^)]+)\)/); 3267 if (m && m[1]) { 3268 return m[1]; 3269 } 3270 } 3271 return 1; 3272 } 3273 $(this).css('transform', 3274 style.replace(/none|scale\([^)]*\)/, '') + 'scale(' + val + ')' 3275 ); 3276 return this; 3277 }; 3278 3279 // fx.cur() must be monkey patched because otherwise it would always 3280 // return 0 for current rotate and scale values 3281 var curProxied = $.fx.prototype.cur; 3282 $.fx.prototype.cur = function () { 3283 if (this.prop == 'rotate') { 3284 return parseFloat($(this.elem).rotate()); 3285 } 3286 else if (this.prop == 'scale') { 3287 return parseFloat($(this.elem).scale()); 3288 } 3289 return curProxied.apply(this, arguments); 3290 }; 3291 3292 $.fx.step.rotate = function (fx) { 3293 $(fx.elem).rotate(fx.now + rotateUnits); 3294 }; 3295 3296 $.fx.step.scale = function (fx) { 3297 $(fx.elem).scale(fx.now); 3298 }; 3299 3300 var animateProxied = $.fn.animate; 3301 $.fn.animate = function (prop) { 3302 if (typeof prop['rotate'] != 'undefined') { 3303 var m = prop['rotate'].toString().match(/^(([+-]=)?(-?\d+(\.\d+)?))(.+)?$/); 3304 if (m && m[5]) { 3305 rotateUnits = m[5]; 3306 } 3307 prop['rotate'] = m[1];
3308 } 3309 3310 return animateProxied.apply(this, arguments); 3311 }; 3312 3313 // Monkey patch jQuery 1.3.1+ css() method to support CSS 'transform' 3314 // property uniformly across Safari/Chrome/Webkit, Firefox 3.5+, IE 9+, and Opera 11+. 3315 // 2009-2011 Zachary Johnson www.zachstronaut.com 3316 // Updated 2011.05.04 (May the fourth be with you!) 3317 function getTransformProperty(element) { 3318 var properties = ['transform', 'WebkitTransform', 'msTransform', 'MozTransform', 'OTransform']; 3319 var p; 3320 while (p = properties.shift()) { 3321 if (typeof element.style[p] != 'undefined') { 3322 return p; 3323 } 3324 } 3325 return 'transform'; 3326 }; 3327 3328 var _propsObj = null; 3329 3330 var proxied = $.fn.css; 3331 $.fn.css = function (arg, val) { 3332 if (_propsObj === null) { 3333 if (typeof $.cssProps != 'undefined') { 3334 _propsObj = $.cssProps; 3335 } 3336 else if (typeof $.props != 'undefined') { 3337 _propsObj = $.props; 3338 } 3339 else { 3340 _propsObj = {}; 3341 } 3342 } 3343 if 3344 ( 3345 typeof _propsObj['transform'] == 'undefined' 3346 && 3347 ( 3348 arg == 'transform' 3349 || 3350 ( 3351 typeof arg == 'object' 3352 && typeof arg['transform'] != 'undefined' 3353 ) 3354 ) 3355 ) { 3356 _propsObj['transform'] = getTransformProperty(this.get(0)); 3357 } 3358 if (_propsObj['transform'] != 'transform') { 3359 // Call in form of css('transform' ...) 3360 if (arg == 'transform') { 3361 arg = _propsObj['transform']; 3362 if (typeof val == 'undefined' && jQuery.style) { 3363 return jQuery.style(this.get(0), arg); 3364 } 3365 } 3366 // Call in form of css({'transform': ...}) 3367 else if 3368 ( 3369 typeof arg == 'object' 3370 && typeof arg['transform'] != 'undefined' 3371 ) { 3372 arg[_propsObj['transform']] = arg['transform']; 3373 delete arg['transform']; 3374 } 3375 } 3376 return proxied.apply(this, arguments); 3377 }; 3378 3379})(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.