topical media & game development
graphic-canvas-example-raycaster-trace.js / js
var MAX_LINES = 12;
var begin = '<ul><li>';
var middle = '</li><li>';
var end = '</li></ul>';
function trace(msg) {
var output_window = document.getElementById("trace");
var lines = output_window.innerHTML.toLowerCase();
var lineList;
if (lines.length > 0) {
lineList = lines.substring(begin.length, lines.length - end.length).split(middle);
while (lineList.length >= MAX_LINES) { lineList.shift(); }
lineList.push(msg);
}
else {
lineList = [ msg ];
}
output_window.innerHTML = begin +lineList.join(middle) +end;
}
(C) Æliens
20/2/2008
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.