{"id":21462152,"url":"https://github.com/wolfpup-software/timestep-js","last_synced_at":"2025-03-17T04:51:12.036Z","repository":{"id":143851355,"uuid":"467337377","full_name":"wolfpup-software/timestep-js","owner":"wolfpup-software","description":"fixed timestep","archived":false,"fork":false,"pushed_at":"2025-03-11T20:52:31.000Z","size":35,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-03-11T21:22:13.242Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wolfpup-software.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-03-08T02:40:43.000Z","updated_at":"2024-11-21T21:35:59.000Z","dependencies_parsed_at":"2024-06-05T11:41:43.196Z","dependency_job_id":"ab4fcbf5-c320-4880-a9aa-6e67b0fd6f0e","html_url":"https://github.com/wolfpup-software/timestep-js","commit_stats":null,"previous_names":["wolfpup-software/timestep-js"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wolfpup-software%2Ftimestep-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wolfpup-software%2Ftimestep-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wolfpup-software%2Ftimestep-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wolfpup-software%2Ftimestep-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wolfpup-software","download_url":"https://codeload.github.com/wolfpup-software/timestep-js/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243976503,"owners_count":20377692,"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":[],"created_at":"2024-11-23T07:12:52.008Z","updated_at":"2025-03-17T04:51:12.031Z","avatar_url":"https://github.com/wolfpup-software.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Timestep\n\nA fixed timestep.\n\n## How to use\n\n### Integrator\n\n`Timestep` relies on an `integrator` to connect a game loop to state and renders.\n\nCreate the following interface:\n\n```ts\n// my_integrator.ts\n\nimport type { IntegratorInterface } from \"timestep\";\n\nclass Integrator implements IntegratorInterface {\n\tintegrate(msInterval: number): void {\n\t\t// tick through physics step\n\t}\n\n\trender(msInterval: number, deltaRemainder: number): void {\n\t\t// Draw to canvas or update dom.\n\t\t//\n\t\t// Interpolate between [previous state, current state]\n\t\t// with the delta remainder [0, 1].\n\t}\n\n\terror(e: Error) {\n\t\t// maximum integration time was exceeded\n\t}\n}\n```\n\nThe `integrate` function is called between renders.\n\nAfter integration, the `render` funtion is called and given the timestep remainder.\n\n### Timestep\n\nPass an `Integrator` to an instance of `Timestep`.\n\n```ts\nimport { Timestep } from \"timestep\";\nimport { Integrator } from \"my_integrator.ts\";\n\nlet msInterval = 10; // millisecond integration interval\nlet integrator = new Integrator();\nconst timestep = new Timestep({ msInterval, integrator });\n```\n\nThen call `start` or `stop` where appropriate.\n\n```ts\ntimestep.start();\ntimestep.stop();\n```\n\n### Example\n\nCheckout a\n(\n[code](https://github.com/wolfpup-software/timestep-js/tree/main/examples) |\n[live](https://wolfpup-software.github.io/timestep-js/examples/)\n) example.\n\n## License\n\nBSD 3-Clause License\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwolfpup-software%2Ftimestep-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwolfpup-software%2Ftimestep-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwolfpup-software%2Ftimestep-js/lists"}