{"id":17993042,"url":"https://github.com/leostera/hooke","last_synced_at":"2025-10-25T19:43:54.259Z","repository":{"id":212535239,"uuid":"731736778","full_name":"leostera/hooke","owner":"leostera","description":"Spring-based animation library for OCaml","archived":false,"fork":false,"pushed_at":"2023-12-29T20:43:59.000Z","size":82,"stargazers_count":10,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-06T17:37:43.359Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"OCaml","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/leostera.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","contributing":null,"funding":null,"license":"LICENSE.md","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":"2023-12-14T18:57:49.000Z","updated_at":"2024-02-22T15:34:50.000Z","dependencies_parsed_at":"2023-12-29T22:33:27.069Z","dependency_job_id":"0f84e805-6850-43e5-ae72-bd68a5fd9b0b","html_url":"https://github.com/leostera/hooke","commit_stats":null,"previous_names":["leostera/hooke"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/leostera/hooke","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leostera%2Fhooke","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leostera%2Fhooke/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leostera%2Fhooke/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leostera%2Fhooke/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leostera","download_url":"https://codeload.github.com/leostera/hooke/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leostera%2Fhooke/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281012083,"owners_count":26429437,"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","status":"online","status_checked_at":"2025-10-25T02:00:06.499Z","response_time":81,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-10-29T20:10:01.133Z","updated_at":"2025-10-25T19:43:54.228Z","avatar_url":"https://github.com/leostera.png","language":"OCaml","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Hooke\n\u003e ut tensio, sic vis\n\nA simple, efficient spring animation library for smooth, natural motion.\n\n\u003cimg src=\"./examples/tui/demo.gif\" /\u003e\n\n## Usage\n\nHooke is framework-agnostic and works well in 2D and 3D contexts. Simply call\n`Spring.make` with your settings to initialize and `Spring.update` on each\nframe to animate.\n\n```ocaml\nopen Hooke\n\n(* A thing we want to animate. *)\nlet sprite_x = Spring.zero_snapshot in\n\n(* A spring to animate it with *)\nlet spring = Spring.make ~delta_time:0.016 ~angular_freq:6. ~damping_ratio:0.5 in\n\n(* Where we want to animate it. *)\nlet target_pos = 50.0 in\n\n(* Animate! *)\nwhile true do\n  let new_sprite_x = Spring.update spring sprite_x in\n  (* throttle frames *)\n  animate ()\ndone\n\n...\n```\n\n## Creating Springs\n\n`Spring.make` takes three values:\n\n* `delta_time`: the time step to operate on. Game engines typically provide\n  a way to determine the time delta, however if that's not available you can\n  simply set the framerate with `1_000 /. fps`. Make\n  sure the framerate you set here matches your actual framerate.\n* `angular_freq`: this translates roughly to the speed. Higher values are\n  faster.\n* `damping_ratio`: the springiness of the animation, generally between `0`\n  and `1`, though it can go higher. Lower values are springier. For details,\n  see below.\n\n## Damping Ratios\n\nThe damping ratio affects the motion in one of three different ways depending\non how it's set.\n\n### Under-Damping\n\nA spring is under-damped when its damping ratio is less than `1`. An\nunder-damped spring reaches equilibrium the fastest, but overshoots and will\ncontinue to oscillate as its amplitude decays over time.\n\n### Critical Damping\n\nA spring is critically-damped the damping ratio is exactly `1`. A critically\ndamped spring will reach equilibrium as fast as possible without oscillating.\n\n### Over-Damping\n\nA spring is over-damped the damping ratio is greater than `1`. An over-damped\nspring will never oscillate, but reaches equilibrium at a slower rate than\na critically damped spring.\n\n## Acknowledgements\n\nThis library is a fairly straightforward port of [Charm][charm]'s\n[Harmonica][harmonica], which is a port of [Ryan Juckett][juckett]’s excellent\ndamped simple harmonic oscillator originally written in C++ in 2008 and\npublished in 2012. [Ryan’s writeup][writeup] on the subject is fantastic.\n\n[charm]: https://charm.sh/\n[harmonica]: https://github.com/charmbracelet/harmonica/\n[juckett]: https://www.ryanjuckett.com/\n[writeup]: https://www.ryanjuckett.com/damped-springs/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleostera%2Fhooke","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleostera%2Fhooke","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleostera%2Fhooke/lists"}