| OLD | NEW |
| (Empty) | |
| 1 (function(scope) { |
| 2 'use strict'; |
| 3 |
| 4 var tokens = null; |
| 5 var transform = null; |
| 6 var opacity = null; |
| 7 var scroll = null; |
| 8 |
| 9 // An extremely cheesy animation. |
| 10 function tick(context) { |
| 11 var seconds = context.timestamp / 1000.0; |
| 12 var matrix = context.getMatrix(transform); |
| 13 matrix.m14 = 200.0 + context.getScalar(scroll); //Math.sin(seconds); |
| 14 |
| 15 console.log('tick'); |
| 16 |
| 17 context.setMatrix(transform, matrix); |
| 18 context.setScalar(opacity, 0.5 + 0.5 * (Math.sin(seconds * 2.0))); |
| 19 // context.setScalar(opacity, 0.5 + 0.05 * context.getScalar(scroll)); |
| 20 //context.setScalar(scroll, 200.0 + 100.0 * (Math.sin(seconds * 0.75))); |
| 21 |
| 22 scope.teleportMessage(context, tick); |
| 23 } |
| 24 |
| 25 scope.onmessage = function(e) { |
| 26 tokens = e.data; |
| 27 transform = tokens[0]; |
| 28 opacity = tokens[1]; |
| 29 scroll = tokens[2]; |
| 30 var context = new TeleportContext(tokens); |
| 31 scope.teleportMessage(context, tick); |
| 32 }; |
| 33 |
| 34 })(self); |
| OLD | NEW |