Created
          April 2, 2012 22:11 
        
      - 
      
- 
        Save InternetExplorer/2287565 to your computer and use it in GitHub Desktop. 
    Justafriend.ie - Scoreboard Projection Example
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | function scoreboardProjection(frame_offset) { | |
| if (frame_offset == null) frame_offset = 0; | |
| var canvas, proj; | |
| var score_img_1, | |
| score_img_2, | |
| overlay, | |
| board_canvas, | |
| score_canvas_1, | |
| score_canvas_2; | |
| // View in the following line is a Backbone.js (http://documentcloud.github.com/backbone/#View) view. | |
| var self = view.extend({ | |
| template:'<div class="scene HD" id="scoreboard_projection"></div>&', | |
| name:'scoreboardProjection', | |
| pageName: 'Bowling Scoreboard', | |
| onInit:onInit | |
| }); | |
| return self; | |
| function onInit() { | |
| // First we load our images. "media" on the following lines are Media objects from http://www.justafriend.ie/cdn/js/jv/media.js | |
| score_img_1 = media.getImage('img/bowlingscore1.png'); | |
| score_img_2 = media.getImage('img/bowlingscore2.png'); | |
| overlay = media.getImage('img/bowlingscore_overlay.png'); | |
| var scale_down_to_blur = .75; | |
| board_canvas = canvasUtil.create(Math.floor(800 * scale_down_to_blur), Math.floor(450 * scale_down_to_blur)); | |
| score_canvas_1 = canvasUtil.create(800, 450); | |
| score_canvas_2 = canvasUtil.create(800, 450); | |
| canvas = canvasUtil.create(10, 10); | |
| // projection is part of the canvas projection library at http://www.justafriend.ie/cdn/js/jv/projection.js | |
| proj = projection(board_canvas, canvas, null, { | |
| wireframe:false, | |
| subdivisionLimit:3, | |
| patchSize:32 | |
| }); | |
| } | |
| // There's more to this, and you can find the full code at http://www.justafriend.ie/cdn/js/jv/scenes/scoreboardProjection.js | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment