{"id":22710568,"url":"https://github.com/smallhelm/simple-timestepper","last_synced_at":"2025-08-07T15:31:20.607Z","repository":{"id":23925758,"uuid":"27306472","full_name":"smallhelm/simple-timestepper","owner":"smallhelm","description":"simply pass in two callbacks, one that get's called at a fixed time step i.e. 60 fps, the other is called on every animation frame","archived":false,"fork":false,"pushed_at":"2014-12-03T23:42:54.000Z","size":148,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-17T10:12:54.604Z","etag":null,"topics":["animation","game","simulation"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/smallhelm.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-11-29T15:40:32.000Z","updated_at":"2019-02-17T02:55:16.000Z","dependencies_parsed_at":"2022-07-20T23:33:19.380Z","dependency_job_id":null,"html_url":"https://github.com/smallhelm/simple-timestepper","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smallhelm%2Fsimple-timestepper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smallhelm%2Fsimple-timestepper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smallhelm%2Fsimple-timestepper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smallhelm%2Fsimple-timestepper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/smallhelm","download_url":"https://codeload.github.com/smallhelm/simple-timestepper/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":229057638,"owners_count":18013289,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["animation","game","simulation"],"created_at":"2024-12-10T12:10:31.494Z","updated_at":"2024-12-10T12:10:32.342Z","avatar_url":"https://github.com/smallhelm.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# What it does\n\nMakes your games and simulations update smoothly at a constant time step.\n\nIt separates update ticks and rendering frames. This way when writing games and simulations the state of the game updates at a constant time step while the rendering happens as fast as the browsers requestAnimationFrame updates.\n\n# How to use it\n\n```js\nvar onUpdate = function(){\n\t//update the state (i.e. update positions, do physics etc...)\n};\nvar onRender = function(){\n\t//render to the canvas or whatever your render target is\n};\nvar t = timestepper(onUpdate, onRender);\n\nt.start();//start the loop\n...\nt.stop();//pause the loop\n...\nt.start();//start the loop again\n```\nBy default it calls update 60 times a second, however you can customize this rate. For example: if you want it to update 30 times a second do this\n```js\nvar t = timestepper(onUpdate, onRender, 1/30);\n```\nBy default the frame rate is the native requestAnimationFrame, however you can customize this interval.\n```js\nvar t = timestepper(onUpdate, onRender, 1/30, 1000/30);\n```\n\nThere are 3 ways to include this library\n\n## With browserify\n\n```js\nvar timestepper = require('simple-timestepper');\n...\n```\n\n## With a script tag\n\nDownload [this](https://github.com/smallhelm/simple-timestepper/blob/master/simple-timestepper.min.js) script then include it in your html\n```html\n\u003cscript src=\"simple-timestepper.min.js\"\u003e\u003c/script\u003e\n```\n\nThen use it\n```js\nvar timestepper = SIMPLE_TIMESTEPPER;\n...\n```\n\n## With RequireJS\n\n```js\nrequire(['simple-timestepper'], function(timestepper) {\n\t...\n});\n```\n\n# License\nThe MIT License (MIT)\n\nCopyright (c) 2014 Small Helm LLC\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmallhelm%2Fsimple-timestepper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsmallhelm%2Fsimple-timestepper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmallhelm%2Fsimple-timestepper/lists"}