Skip to content

Instantly share code, notes, and snippets.

@karlwestin
Created October 2, 2013 14:22
Show Gist options
  • Select an option

  • Save karlwestin/6794538 to your computer and use it in GitHub Desktop.

Select an option

Save karlwestin/6794538 to your computer and use it in GitHub Desktop.
iOS7 fix for morpheus.js
var matchingTimestamps;
frame(function(timestamp) {
// if we're using a high res timer, make sure timestamp is not the old epoch-based value.
// http://updates.html5rocks.com/2012/05/requestAnimationFrame-API-now-with-sub-millisecond-precision
// patch for https://github.com/ded/morpheus/issues/53
// check if timestamps are on the same scale and cache result
var argument = timestamp > 1e12,
getTime = now() > 1e12;
matchingTimestamps = argument === getTime;
});
function render(timestamp) {
var i, count = children.length
if (!matchingTimestamps) timestamp = now()
for (i = count; i--;) {
children[i](timestamp)
}
children.length && frame(render)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment