{"id":15822914,"url":"https://github.com/knowler/restart-animations-element","last_synced_at":"2026-05-16T22:02:50.493Z","repository":{"id":210265027,"uuid":"726153908","full_name":"knowler/restart-animations-element","owner":"knowler","description":"A custom element for restarting animations on the page or for another element.","archived":false,"fork":false,"pushed_at":"2023-12-01T17:53:57.000Z","size":5,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-10-12T08:12:46.250Z","etag":null,"topics":["custom-elements","web-components"],"latest_commit_sha":null,"homepage":"https://codepen.io/knowler/pen/QWYZYEv","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/knowler.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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-01T16:42:11.000Z","updated_at":"2023-12-01T18:09:41.000Z","dependencies_parsed_at":"2024-10-26T12:49:00.982Z","dependency_job_id":"634ce50b-241a-4ee3-872d-7b3eb56b80f1","html_url":"https://github.com/knowler/restart-animations-element","commit_stats":{"total_commits":4,"total_committers":1,"mean_commits":4.0,"dds":0.0,"last_synced_commit":"230365e10f7990c58bc214ec5af9083e0adda64f"},"previous_names":["knowler/restart-animations-element"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knowler%2Frestart-animations-element","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knowler%2Frestart-animations-element/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knowler%2Frestart-animations-element/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knowler%2Frestart-animations-element/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/knowler","download_url":"https://codeload.github.com/knowler/restart-animations-element/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246598198,"owners_count":20802975,"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":["custom-elements","web-components"],"created_at":"2024-10-05T08:01:47.604Z","updated_at":"2026-05-16T22:02:45.457Z","avatar_url":"https://github.com/knowler.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Restart Animations Element\n\nA custom element for restarting animations on the page or for another\nelement. This only works for animations that persist. [See a demo on CodePen](https://codepen.io/knowler/pen/QWYZYEv).\n\n## Usage\n\nHere’s how to get it into your document and a few ways you can define it:\n\n```js\nimport { RestartAnimationsElement } from \"https://esm.sh/gh/knowler/restart-animations-element/restart-animations-element.js?raw\";\n\n// 1. Use the static method. Defines element `\u003crestart-animations\u003e`\nRestartAnimationsElement.define();\n\n// 2. Set a custom tag name.\nRestartAnimationsElement.define(\"replay-animations\");\n\n// 3. The standard way\nif (!window.customElements.get(\"restart-animations\")) {\n\twindow.customElements.define(\"restart-animations\", RestartAnimationsElement);\n}\n```\n\nHere’s how to use it:\n\n```html\n\u003crestart-animations\u003e\u003c/restart-animations\u003e\n```\n\nThat’ll effectively display this:\n\n```html\n\u003cbutton type=\"button\"\u003eRestart Animations\u003c/button\u003e\n```\n\n## Scoping to a specific element\n\nBy default, the button will restart the animations for the entire page.\nYou can provide the `for` attribute an element ID to scope this to just\nthat element and it’s descedants.\n\n```html\n\u003crestart-animations for=\"my-animated-element\"\u003e\u003c/restart-animations\u003e\n\n\u003cfigure id=\"my-animated-element\"\u003e\u003c!-- ... --\u003e\u003c/figure\u003e\n```\n\n## Customize\n\nThis element has two slots:\n\n1. The unnamed slot which is used to set the text of the button. You can\n\t override it like this:\n\t ```html\n\t \u003crestart-animations\u003eReplay Animations\u003c/restart-animations\u003e\n\t ```\n2. The `button` slot. This allows you to provide your own button.\n\t ```html\n\t \u003crestart-animations\u003e\n\t\t \u003cbutton slot=\"button\" type=\"button\"\u003eReplay Animations\u003c/button\u003e\n\t \u003c/restart-animations\u003e\n\t ```\n\nThe default button is exposed with CSS Parts and you can style it like\nthis:\n\n```css\nrestart-animations::part(button) {\n\tfont-family: Comic Sans MS;\n\tcolor: DeepPink;\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fknowler%2Frestart-animations-element","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fknowler%2Frestart-animations-element","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fknowler%2Frestart-animations-element/lists"}