{"id":17689920,"url":"https://github.com/cdaein/timeline","last_synced_at":"2025-05-13T01:42:37.744Z","repository":{"id":62006845,"uuid":"556492040","full_name":"cdaein/timeline","owner":"cdaein","description":"Timeline class to help creating keyframe-based animation with JavaScript/TypeScript","archived":false,"fork":false,"pushed_at":"2023-04-22T05:19:11.000Z","size":919,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-01T05:41:27.316Z","etag":null,"topics":["animation","keyframe"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/cdaein.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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-10-24T00:37:08.000Z","updated_at":"2023-06-09T09:03:50.000Z","dependencies_parsed_at":"2024-10-24T14:28:32.822Z","dependency_job_id":"ebf46a3d-8fad-4e63-a1b4-2bbdc9c8bda7","html_url":"https://github.com/cdaein/timeline","commit_stats":{"total_commits":30,"total_committers":2,"mean_commits":15.0,"dds":"0.33333333333333337","last_synced_commit":"d6cd3d33545fa02a8f82092ff9a03e3511d54746"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdaein%2Ftimeline","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdaein%2Ftimeline/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdaein%2Ftimeline/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdaein%2Ftimeline/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cdaein","download_url":"https://codeload.github.com/cdaein/timeline/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253856577,"owners_count":21974573,"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","keyframe"],"created_at":"2024-10-24T11:49:17.906Z","updated_at":"2025-05-13T01:42:37.699Z","avatar_url":"https://github.com/cdaein.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @daeinc/timeline\n\nA Timeline object can hold multiple properties with keyframes. ex. position, rotation, color, etc., and makes it easy to group things together. In my own projects, I create multiple Timeline objects, one for each graphical object.\n\nIt builds on top of [`keyframes`](https://github.com/mattdesl/keyframes), but does not expose Keyframes library to user - user only needs to provide a minimum amount of necessary data. ex. `{ time, value, ... }`\n\nIn development, and breaking changes are expected in the future.\n\n## Installation\n\n```\nnpm i @daeinc/timeline\n```\n\nThen,\n\n```js\nimport Timeline from \"@daeinc/timeline\";\n```\n\n## Examples\n\nPass a timeline name and a single property object (`{name, keyframes}`) or an array of property objects (`[{name, keyframes}, {name, keyframes}]`):\n\n```js\nconst tl = new Timeline(\"my-timeline\", {\n  name: \"position\",\n  keyframes: [\n    { time: 0, value: 5 },\n    { time: 1, value: 10 },\n  ],\n});\n\nconst v1 = tl.value(\"position\", 0.5); // returns 7.5\n```\n\nPass a custom interpolator function:\n\nJS:\n\n```js\nconst easeInQuad = (a, b, t) =\u003e {\n  return lerp(a.value, b.value, t * t);\n};\n\nconst v2 = tl.value(\"position\", 0.5, easeInQuad);\nconsole.log(v2); // 6.25\n```\n\nTS:\n\n```ts\nimport type { Keyframe } from \"@daeinc/timeline\";\n\nconst easeInQuad = (a: Keyframe, b: Keyframe, t: number) =\u003e {\n  return lerp(a.value, b.value, t * t);\n};\n\nconst v2 = tl.value(\"position\", 0.5, easeInQuad);\nconsole.log(v2); // 6.25\n```\n\n## Methods\n\n```ts\nconstructor(propOrProps?: InputProp | InputProp[]);\n\npropExists(propName: string): boolean;\n\naddKeyframe(propName: string, newKey: Keyframe): void;\n\naddKeyframes(propName: string, ...newKeys: Keyframe[]): void;\n\ngetKeyframe(propName: string, timeStamp: number): Keyframe;\n\ngetKeyframes(propName: string): Keyframe[];\n\ngetName(): string;\n\ngetPropertyNames(): string[];\n\nvalue(propName: string, timeStamp: number, interpolator?: Interpolator): any;\n\naddProperty(propName: string, ...newKeys: Keyframe[]): void;\n\nremoveKeyframes(propName: string, index: number, howmany: number): void;\n\nnearest(propName: string, timeStamp: number, radius?: number): Keyframe;\n\nnearestIndex(propName: string, timeStamp: number, radius?: number): number;\n\nnext(propName: string, timeStamp: number): Keyframe;\n\nprevious(propName: string, timeStamp: number): Keyframe;\n\nstatic fromJSON(file: string): Promise\u003cvoid | Timeline\u003e;\n\nstatic from(data: {\n  name: string;\n  properties: InputProp[];\n}): Timeline;\n\ntoJSON(): string;\n```\n\n## To Dos\n\n- add more examples\n  - how to add keyframes\n  - how to import and export\n- implement the rest of the methods from `keyframes` package\n- add a separate `.d.ts` for `keyframes` JS package, or, create a TS version of the keyframes package as a `class`.\n- throw errors or return null or guard against them?\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcdaein%2Ftimeline","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcdaein%2Ftimeline","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcdaein%2Ftimeline/lists"}