MCPcopy Create free account
hub / github.com/microsoft/SandDance / AnimationLoop

Function AnimationLoop

docs/tests/v2/es6/js/sanddance.js:29055–29120  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

29053 * @param {HTMLCanvasElement} canvas - if provided, width and height will be passed to context
29054 */
29055 function AnimationLoop() {
29056 var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
29057 (0, _classCallCheck2.default)(this, AnimationLoop);
29058 var _props$onCreateContex = props.onCreateContext,
29059 onCreateContext = _props$onCreateContex === void 0 ? function (opts) {
29060 return (0, _webglContext.createGLContext)(opts);
29061 } : _props$onCreateContex,
29062 _props$onAddHTML = props.onAddHTML,
29063 onAddHTML = _props$onAddHTML === void 0 ? null : _props$onAddHTML,
29064 _props$onInitialize = props.onInitialize,
29065 onInitialize = _props$onInitialize === void 0 ? function () {} : _props$onInitialize,
29066 _props$onRender = props.onRender,
29067 onRender = _props$onRender === void 0 ? function () {} : _props$onRender,
29068 _props$onFinalize = props.onFinalize,
29069 onFinalize = _props$onFinalize === void 0 ? function () {} : _props$onFinalize,
29070 _props$gl = props.gl,
29071 gl = _props$gl === void 0 ? null : _props$gl,
29072 _props$glOptions = props.glOptions,
29073 glOptions = _props$glOptions === void 0 ? {} : _props$glOptions,
29074 _props$debug = props.debug,
29075 debug = _props$debug === void 0 ? false : _props$debug,
29076 _props$createFramebuf = props.createFramebuffer,
29077 createFramebuffer = _props$createFramebuf === void 0 ? false : _props$createFramebuf,
29078 _props$autoResizeView = props.autoResizeViewport,
29079 autoResizeViewport = _props$autoResizeView === void 0 ? true : _props$autoResizeView,
29080 _props$autoResizeDraw = props.autoResizeDrawingBuffer,
29081 autoResizeDrawingBuffer = _props$autoResizeDraw === void 0 ? true : _props$autoResizeDraw;
29082 var _props$useDevicePixel = props.useDevicePixels,
29083 useDevicePixels = _props$useDevicePixel === void 0 ? true : _props$useDevicePixel;
29084
29085 if ('useDevicePixelRatio' in props) {
29086 _utils.log.deprecated('useDevicePixelRatio', 'useDevicePixels')();
29087
29088 useDevicePixels = props.useDevicePixelRatio;
29089 }
29090
29091 this.props = {
29092 onCreateContext: onCreateContext,
29093 onAddHTML: onAddHTML,
29094 onInitialize: onInitialize,
29095 onRender: onRender,
29096 onFinalize: onFinalize,
29097 gl: gl,
29098 glOptions: glOptions,
29099 debug: debug,
29100 createFramebuffer: createFramebuffer
29101 }; // state
29102
29103 this.gl = gl;
29104 this.needsRedraw = null;
29105 this._initialized = false;
29106 this._running = false;
29107 this._animationFrameId = null;
29108 this._startPromise = null;
29109 this.setProps({
29110 autoResizeViewport: autoResizeViewport,
29111 autoResizeDrawingBuffer: autoResizeDrawingBuffer,
29112 useDevicePixels: useDevicePixels

Callers

nothing calls this directly

Calls 2

deprecatedMethod · 0.45
setPropsMethod · 0.45

Tested by

no test coverage detected