Make requestAnimationFrame function take Double to avoid java.lang.ClassCastException