MediaWiki:Skin/Kamel:Ungott.js: Unterschied zwischen den Versionen

aus Kamelopedia, der wüsten Enzyklopädie
Zur Navigation springen Zur Suche springen
K (Textersetzung - „"http://kamelopedia.mormo.org/images/“ durch „"../images/“)
 
(5 dazwischenliegende Versionen von einem anderen Benutzer werden nicht angezeigt)
Zeile 2: Zeile 2:
 
var anim_bilder = new Array();
 
var anim_bilder = new Array();
 
var bild_info = [
 
var bild_info = [
     { "src": "http://kamelopedia.mormo.org/images/6/6c/BunchieViola.gif",    "width": 53,  "height": 66 }
+
     { "src": "../images/6/6c/BunchieViola.gif",    "width": 53,  "height": 66 }
 
]
 
]
  
Zeile 15: Zeile 15:
  
 
$(function() {
 
$(function() {
    $('#content').css({'position': 'relative', 'overflow' : 'hidden'});
 
 
     for ( var i = 0; i < anz_bilder; i++ ){
 
     for ( var i = 0; i < anz_bilder; i++ ){
         $('#content').append(anim_bilder[i]);
+
         $('div.wimu').append(anim_bilder[i]);
         $('#content img').last().css({'position': 'absolute', 'z-index': '1'});
+
         $('div.wimu img').last().addClass('anim');
         var bottom = Math.round( ( ( $('#content').outerHeight() + anim_bilder[i].height ) * Math.random() ) - anim_bilder[i].height );
+
         var bottom = Math.round( ( ( $('div.wimu').outerHeight() + anim_bilder[i].height ) * Math.random() ) - anim_bilder[i].height );
         var left  = Math.round( ( ( $('#content').outerWidth() + anim_bilder[i].width ) * Math.random() ) - anim_bilder[i].width );
+
         var left  = Math.round( ( ( $('div.wimu').outerWidth() + anim_bilder[i].width ) * Math.random() ) - anim_bilder[i].width );
         $('#content img').last().css('bottom', bottom + 'px');
+
         $('div.wimu img').last().css('bottom', bottom + 'px');
         $('#content img').last().css('left', left + 'px');
+
         $('div.wimu img').last().css('left', left + 'px');
         $('#content img').last().animate(
+
         $('div.wimu img').last().animate(
             { bottom: '+' + $('#content').outerHeight() }, {
+
             { bottom: '+' + $('div.wimu').outerHeight() }, {
 
             duration: Math.round(7000 * Math.random() + 7000) - bottom * 15,
 
             duration: Math.round(7000 * Math.random() + 7000) - bottom * 15,
 
             easing: 'linear',
 
             easing: 'linear',
Zeile 30: Zeile 29:
 
             queue: false }
 
             queue: false }
 
         );
 
         );
         swing($('#content img').last(),  
+
         swing($('div.wimu img').last(),  
             $('#content img').last().width() / 8 + ($('#content img').last().width() / 8 * Math.random()),
+
             $('div.wimu img').last().width() / 8 + ($('div.wimu img').last().width() / 8 * Math.random()),
 
             400 * Math.random() + 250);
 
             400 * Math.random() + 250);
 
     }
 
     }
Zeile 37: Zeile 36:
  
 
function resetimage(anim_bild) {
 
function resetimage(anim_bild) {
     var left  = ( ( $('#content').outerWidth() + anim_bilder[i].width ) * Math.random() ) - anim_bilder[i].width;
+
     var left  = ( ( $('div.wimu').outerWidth() + anim_bilder[i].width ) * Math.random() ) - anim_bilder[i].width;
 
     anim_bild.css('left', left + 'px');   
 
     anim_bild.css('left', left + 'px');   
 
     anim_bild.css('bottom', '-' + anim_bild.height() + 'px');
 
     anim_bild.css('bottom', '-' + anim_bild.height() + 'px');
 
     anim_bild.animate(
 
     anim_bild.animate(
         { bottom: '+' + $('#content').outerHeight() }, {
+
         { bottom: '+' + $('div.wimu').outerHeight() }, {
 
         duration: Math.round(7000 * Math.random() + 7000),
 
         duration: Math.round(7000 * Math.random() + 7000),
 
         easing: 'linear',
 
         easing: 'linear',

Aktuelle Version vom 23. November 2013, 20:58 Uhr

var anz_bilder  = 20;
var anim_bilder = new Array();
var bild_info = [
    { "src": "../images/6/6c/BunchieViola.gif",    "width": 53,  "height": 66 }
]

for ( var i = 0; i < anz_bilder; i++ ){
    var size              = Math.random() * 2;
    var src               = Math.floor(Math.random() * bild_info.length);
    anim_bilder[i]        = new Image;
    anim_bilder[i].src    = bild_info[src].src;
    anim_bilder[i].width  = bild_info[src].width * size;
    anim_bilder[i].height = bild_info[src].height * size;    
}

$(function() {
    for ( var i = 0; i < anz_bilder; i++ ){
        $('div.wimu').append(anim_bilder[i]);
        $('div.wimu img').last().addClass('anim');
        var bottom = Math.round( ( ( $('div.wimu').outerHeight() + anim_bilder[i].height ) * Math.random() ) - anim_bilder[i].height );
        var left   = Math.round( ( ( $('div.wimu').outerWidth() + anim_bilder[i].width ) * Math.random() ) - anim_bilder[i].width );
        $('div.wimu img').last().css('bottom', bottom + 'px');
        $('div.wimu img').last().css('left', left + 'px');
        $('div.wimu img').last().animate(
            { bottom: '+' + $('div.wimu').outerHeight() }, {
            duration: Math.round(7000 * Math.random() + 7000) - bottom * 15,
            easing: 'linear',
            complete: function(){ resetimage($(this)); },
            queue: false }
        );
        swing($('div.wimu img').last(), 
            $('div.wimu img').last().width() / 8 + ($('div.wimu img').last().width() / 8 * Math.random()),
            400 * Math.random() + 250);
    }
});

function resetimage(anim_bild) {
    var left   = ( ( $('div.wimu').outerWidth() + anim_bilder[i].width ) * Math.random() ) - anim_bilder[i].width;
    anim_bild.css('left', left + 'px');   
    anim_bild.css('bottom', '-' + anim_bild.height() + 'px');
    anim_bild.animate(
        { bottom: '+' + $('div.wimu').outerHeight() }, {
        duration: Math.round(7000 * Math.random() + 7000),
        easing: 'linear',
        complete: function(){ resetimage($(this)); },
        queue: false }
    );
}

function swing(anim_bild, amount,  duration) {
    anim_bild.animate(
        { marginLeft: amount }, {
        duration: duration,
        queue: false,
            complete: function(){ 
                $(this).animate(
                    { marginLeft: 0 }, {
                    duration: duration,
                    queue: false,
                    complete: function(){ swing($(this), amount, duration) }
                    }
                )
            }
        }
    );
}