topical media & game development
mobile-query-game-tests-benchmark-animation-randomMovementNoTransformation.htm / htm
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
<script src="../../../jquery.gamequery.js"></script>
<script src="benchmark.setup.js"></script>
<script>
$(function(){
$("#message").html("This is "+NUMBER_OF_RUNS+" frames for "+NUMBER_OF_ELEMENT+" sprites. The average time for each frame will be displayed at the end:");
var animation = new .gameQuery.ANIMATION_VERTICAL, numberOfFrame: 4, delta: 32, rate: REFRESH_RATE});
$("#playground").playground({height: 500, width: 500, refreshRate: REFRESH_RATE});
for(var i = NUMBER_OF_ELEMENT; i > 0; i--){
.playground().registerCallback(function(){
// Count time between call
sum += (new Date()).getTime()-lastCall;
if(count++ > NUMBER_OF_RUNS){
$("#message").append("<span style='color: red'>"+Math.round(sum / count)+"ms</span>");
$(".sprite").remove();
return true;
} else {
$(".sprite").each(function(){ this.css({top: Math.random()*468, left: Math.random()*468})});
}
lastCall=(new Date()).getTime();
}, REFRESH_RATE);
(C) Æliens
04/09/2009
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.