Pastebin launched a little side project called HostCabi.net, check it out ;-)Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 23rd, 2010  |  syntax: JavaScript  |  size: 1.55 KB  |  hits: 116  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1.  
  2. //factoid dimensions and alpha
  3. var factoid_w = 423;
  4. var factoid_h = 348;
  5. var factoid_a = 0;
  6.  
  7. //social chat dimensions and alpha
  8. var socialchat_w = 275;
  9. var socialchat_h = 400;
  10. var socialchatwin_a = 100;
  11.  
  12. //footer details
  13. var footer_w = 0;
  14. var footer_h = 0;
  15. var footer_a = 0;
  16.  
  17. //header details
  18.  
  19. var header_w = 0;
  20. var header_h = 0;
  21. var header_exp_h = 0;
  22. var img_index = 0;
  23.  
  24. function drawImageOnCanvas(context, src, x, y) {
  25.        
  26.        
  27.        
  28.         img_index++;
  29.        
  30.         var theImg = ['img'+img_index];
  31.        
  32.         console.log(theImg);
  33.        
  34.         theImg = new Image();
  35.         theImg.style.zIndex = img_index;
  36.         theImg.src = src;
  37.        
  38.         theImg.onload = function()
  39.         {
  40.                 context.drawImage(theImg, x, y);
  41.         }
  42. }
  43.  
  44.  
  45. function init() {
  46.        
  47.        
  48.         var a = document.getElementById('stage');
  49.        
  50.         //select the canvas and get it's drawing context
  51.         var a_cont = a.getContext('2d');
  52.        
  53.        
  54.         drawStage(a, a_cont);
  55.         drawFactoid(a, a_cont);
  56.        
  57.        
  58. }
  59.  
  60.  
  61.  
  62. function drawStage(canvas, context) {
  63.         drawImageOnCanvas(context, 'images/bg/main_bg.jpg', 0, 0);
  64. }
  65.  
  66.  
  67.  
  68. function drawFactoid(canvas, context) {
  69.        
  70.                 //apply shadowing
  71.                 context.shadowOffsetX = 0;
  72.                 context.shadowOffsetY = 3;
  73.                 context.shadowBlur = 3;
  74.        
  75.                 var the_grad = context.createLinearGradient(0,0,0,0);
  76.                
  77.                 the_grad.addColorStop(0, "#76a833");
  78.                 the_grad.addColorStop(1, "#8dc63f");
  79.                
  80.                
  81.                 //drawImageOnCanvas(context, 'images/card/box_bg.png', 384, 75);
  82.                 drawImageOnCanvas(context, 'images/card/bg_shadow.png', 384, 75);
  83.                
  84.                 //draw a rect on screen- x,y,w,h
  85.                 context.fillRect(384, 75, factoid_w, factoid_h);
  86.                
  87.                
  88.                
  89.                
  90.        
  91. }