Difference between revisions of "Widget:Logo"

From Hackerspace ACKspace
Jump to: navigation, search
(added auto-season functionality)
(added some preparations/todo for performance enhancement for when I have time to actually fix it)
Line 46: Line 46:
 
     var alphaDir = 0.01;
 
     var alphaDir = 0.01;
 
     var alpha = 0;
 
     var alpha = 0;
 +
    var buffer;
 +
    var bufferContext;
  
 
     function blink()
 
     function blink()
Line 103: Line 105:
 
                     dynamicImage.data[ pixelPos + 2 ] = 255;
 
                     dynamicImage.data[ pixelPos + 2 ] = 255;
 
                     dynamicImage.data[ pixelPos + 3 ] = 255;
 
                     dynamicImage.data[ pixelPos + 3 ] = 255;
 +
 +
                    //TODO: updateFlakeCanvas( flake, ctx )
 +
                    //drawFlake( bufferContext )
  
 
                     // Generate new flake
 
                     // Generate new flake
Line 113: Line 118:
 
                 // Draw the dynamic image
 
                 // Draw the dynamic image
 
                 ctx.putImageData( dynamicImage, 0, 0 );
 
                 ctx.putImageData( dynamicImage, 0, 0 );
 +
                //ctx.drawImage( buffer, 0, 0 );
 +
 
             }
 
             }
  
Line 262: Line 269:
 
         var logo = document.getElementById( "logo" );
 
         var logo = document.getElementById( "logo" );
 
         ctx = logo.getContext("2d");
 
         ctx = logo.getContext("2d");
 +
 +
        buffer = document.createElement('canvas');
 +
        buffer.width = logo.width;
 +
        buffer.height = logo.height;
 +
        bufferContext = buffer.getContext('2d');
 +
        bufferContext.drawImage( logo, 0, 0, w, h );
 +
 
         var img = document.getElementById("img");
 
         var img = document.getElementById("img");
 
         ctx.drawImage( img, 0, offsetY );
 
         ctx.drawImage( img, 0, offsetY );

Revision as of 15:09, 12 January 2016

This widget creates an animated themed ACKspace logo.

Created by xopr

Using this widget

To insert this widget, use the following code:

{{#widget:Logo
|image=https://ackspace.nl/w/images/e/e9/ACKsmass_logo.png
|width=600px
|height=200px
|padding=8px
|float=right
}}

This will give the following result:

Note that image is mandatory, the rest is optional. Also, you must provide a unit for the sizes (i.e. px, %, etc.)

Copy to your site

To use this widget on your site, just install MediaWiki Widgets extension and copy full source code of this page to your wiki as Widget:Logo article.