{"id":13727439,"url":"https://github.com/aholachek/animate-css-grid","last_synced_at":"2025-05-14T21:09:49.050Z","repository":{"id":39495729,"uuid":"125452855","full_name":"aholachek/animate-css-grid","owner":"aholachek","description":"Painless transitions for CSS Grid","archived":false,"fork":false,"pushed_at":"2024-04-19T08:08:41.000Z","size":26614,"stargazers_count":1385,"open_issues_count":29,"forks_count":69,"subscribers_count":21,"default_branch":"master","last_synced_at":"2025-04-06T12:06:26.430Z","etag":null,"topics":["animations","css-grid","transitions"],"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/aholachek.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2018-03-16T02:31:07.000Z","updated_at":"2025-03-10T14:52:28.000Z","dependencies_parsed_at":"2024-01-10T20:10:52.497Z","dependency_job_id":"b0ca8aa1-2342-4f01-9187-d4ca98895ee0","html_url":"https://github.com/aholachek/animate-css-grid","commit_stats":{"total_commits":129,"total_committers":4,"mean_commits":32.25,"dds":"0.046511627906976716","last_synced_commit":"599ee43edb1f001d7d5555d9086dee1a1b914252"},"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aholachek%2Fanimate-css-grid","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aholachek%2Fanimate-css-grid/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aholachek%2Fanimate-css-grid/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aholachek%2Fanimate-css-grid/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aholachek","download_url":"https://codeload.github.com/aholachek/animate-css-grid/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248741201,"owners_count":21154255,"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":["animations","css-grid","transitions"],"created_at":"2024-08-03T01:03:56.340Z","updated_at":"2025-04-13T16:10:29.490Z","avatar_url":"https://github.com/aholachek.png","language":"TypeScript","readme":"# Animate CSS Grid\n\nPerformantly animate all CSS grid properties, including:\n\n### `grid-column` and `grid-row`\n\n\u003ca href=\"https://codepen.io/aholachek/pen/VXjOPB\"\u003e\n\u003cimg src=\"./examples/grid-column-optimized.gif\" alt=\"grid-column and grid-row\" width=\"500px\"\u003e\n\u003c/a\u003e\n\n\n### `grid-template-columns`\n\n\u003ca href=\"https://codepen.io/aholachek/pen/VXjOPB\"\u003e\n\u003cimg src=\"./examples/grid-template-columns-optimized-1.gif\" alt=\"grid-template-columns\" width=\"500px\"\u003e\n\u003c/a\u003e\n\n### `grid-gap`\n\n\u003ca href=\"https://codepen.io/aholachek/pen/VXjOPB\"\u003e\n\u003cimg src=\"./examples/grid-gap-optimized-1.gif\" alt=\"grid-gap\" width=\"500px\"\u003e\n\u003c/a\u003e\n\n\n#### [Fork Photo Grid Example on CodeSandbox](https://codesandbox.io/s/animate-css-grid-template-t6qsf)\n\n\n## Why use animate-css-grid?\n\nThis library uses transforms to transition between different layout states, which means, in comparison to [pure CSS animations](https://web.dev/css-animated-grid-layouts/), it offers:\n\n- better performance \n- more flexibility in terms of what properties can be animated\n- more configurable animations (easing options, staggers)\n\nWant to have a look for yourself? Feel free to check out [this Mondrian animated with CSS keyframes](https://codepen.io/aholachek/pen/poOeXBM) and compare it with  [the same UI animated with animate-css-grid.](https://codepen.io/aholachek/pen/XWPMwEx)\n\n## How to use it\n\nJust call the `wrapGrid` method on your grid container, and optionally provide a config object as a second argument.\nIf the grid is removed from the page, the animations will automatically be cleaned up as well.\n\n\n`yarn add animate-css-grid` or `npm install animate-css-grid`\n\n```js\nimport { wrapGrid } from 'animate-css-grid'\n\nconst grid = document.querySelector(\".grid\");\nwrapGrid(grid);\n```\n\nOr from a script tag:\n\n```html\n\u003cscript src=\"https://unpkg.com/animate-css-grid@latest\"\u003e\u003c/script\u003e\n\n\u003cscript\u003e\n  const grid = document.querySelector(\".grid\");\n  animateCSSGrid.wrapGrid(grid, {duration : 600});\n\u003c/script\u003e\n```\n\nOptional config object:\n\n```js\n{\n  // int: default is 0 ms\n  stagger: 100,\n  // int: default is 250 ms\n  duration: 500,\n  // string: default is 'easeInOut'\n  easing: 'backInOut',\n  // function: called with list of elements about to animate\n  onStart: (animatingElementList)=\u003e {},\n  // function: called with list of elements that just finished animating\n  // cancelled animations will not trigger onEnd\n  onEnd: (animatingElementList)=\u003e {}\n}\n```\n\nAvailable easing functions:\n\n- `'linear'`\n- `'easeIn'` / `'easeOut'` / `'easeInOut'`\n- `'circIn'` / `'circOut'` / `'circInOut'`\n- `'backIn'` / `'backOut'` / `'backInOut'`\n- `'anticipate'`\n\n[Learn more about available easing functions here.](https://popmotion.io/api/easing/)\n\nTwo functions are returned by the `wrapGrid` call that you probably won't need to use:\n\n```js\nimport { wrapGrid } from animateCSSGrid\n\nconst grid = document.querySelector(\".grid\");\nconst { unwrapGrid, forceGridAnimation } = wrapGrid(grid);\n\n// if you want the grid to transition after updating an inline style\n// you need to call forceGridAnimation\ngrid.style.width = '500px'\nforceGridAnimation()\n\n// if you want to remove animations but not the grid itself\nunwrapGrid()\n```\n\n## Requirements\n\n1.  The updates to the grid will have to come from addition or removal of a class or element. Currently, inline style updates will not trigger transitions. (Although you can manually trigger transitions in that case by calling `forceGridAnimation()`)\n2.  **Important** If a grid item has children, they should be surrounded by a single container element. This is so we can apply a counter scale and prevent children elements from getting warped during scale transitions of the parent.\n\nExample:\n\n```html\n\u003c!-- grid class --\u003e\n\u003cul class=\"some-grid-class-that-changes\"\u003e\n  \u003cli class=\"grid-item\"\u003e\n    \u003c!-- each grid item must have a single direct child --\u003e\n    \u003cdiv\u003e\n      \u003ch3\u003eItem title\u003c/h3\u003e\n      \u003cdiv\u003eItem body\u003c/div\u003e\n    \u003c/div\u003e\n  \u003c/li\u003e\n\u003cdiv\u003e\n```\n\n## How it works\n\nThe script registers a `MutationObserver` that activates when the grid or one of its children adds or loses a class or element. That means there's no need to remove the animations before removing the grid, everything should be cleaned up automatically.\nIt uses the FLIP animation technique to smoothly update the grid, applying a counter transform to the children of each item so that they do not appear distorted while the transition occurs.\n\nIt should work on container elements without CSS grid applied as well, but was developed and tested with CSS grid in mind.\n\n## Usage with Frameworks\n\nThe `animate-css-grid` library can easily be used with frameworks like React or Vue.\n\nCheck out the [React example](https://codepen.io/aholachek/pen/mxwvmV) or the [Vue example](https://codepen.io/sustained/pen/Rwbdgob) on Codepen!\n","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faholachek%2Fanimate-css-grid","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faholachek%2Fanimate-css-grid","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faholachek%2Fanimate-css-grid/lists"}