cube rotation for function js