{"id":19051656,"url":"https://github.com/nickgraffis/ng-spring","last_synced_at":"2025-11-11T19:03:39.524Z","repository":{"id":57749341,"uuid":"524466595","full_name":"nickgraffis/ng-spring","owner":"nickgraffis","description":"1.8kb function that replaces Angular animation's keyframes with springKeyframes, for physics based animations.","archived":false,"fork":false,"pushed_at":"2022-08-13T19:42:45.000Z","size":880,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-02T15:03:03.309Z","etag":null,"topics":["angular","angular-animations","animations","keyframes","physics","spring","spring-keyframes","spring-physics"],"latest_commit_sha":null,"homepage":"https://nickgraffis.github.io/ng-spring","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/nickgraffis.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}},"created_at":"2022-08-13T17:36:56.000Z","updated_at":"2024-10-07T02:45:07.000Z","dependencies_parsed_at":"2022-08-27T00:10:51.201Z","dependency_job_id":null,"html_url":"https://github.com/nickgraffis/ng-spring","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nickgraffis%2Fng-spring","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nickgraffis%2Fng-spring/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nickgraffis%2Fng-spring/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nickgraffis%2Fng-spring/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nickgraffis","download_url":"https://codeload.github.com/nickgraffis/ng-spring/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240109572,"owners_count":19749171,"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":["angular","angular-animations","animations","keyframes","physics","spring","spring-keyframes","spring-physics"],"created_at":"2024-11-08T23:19:09.591Z","updated_at":"2025-11-11T19:03:39.495Z","avatar_url":"https://github.com/nickgraffis.png","language":"TypeScript","readme":"# Documentation\nFull docs can be found at [nickgraffis.github.io/ng-spring](https://nickgraffis.github.io/ng-spring/)\n\n# Installation\n\n```bash\nyarn add ng-spring\n```\n\nOr use `npm` or `pnpm`.\n\n# Usage\nUseage is extreamly simple, just replace `keyframes` from `@angular/animations` with the default export from `ng-spring`. \n\n## Basic \n\n```ts{8-11}\nimport springKeyframes from 'ng-spring'\n\n@Component({\n  selector: 'app-hello',\n  animations: [\n    trigger('openClose', [ \n      transition('open =\u003e closed', [\n        animate('500ms', springKeyframes({\n          from: {opacity: 0, transform: 'translateY(-100px)'},\n          to: {opacity: 1, transform: 'translateY(0)'}\n        }))\n      ]),\n    ])\n  ]\n})\nexport class HelloComponent {\n  @HostBinding('@openClose')\n  public animate = true\n}\n```\n\nIt works the same in more advanced use cases:\n\n```ts{10-13}\nimport springKeyframes from 'ng-spring'\n\n@Component({\n  selector: 'app-hello',\n  animations: [\n    trigger('helloAnimation', [\n      transition(':enter', [\n        query('.hero', [\n          stagger(30, [\n            animate('500ms', springKeyframes({\n              from: {opacity: 0, transform: 'translateY(-100px)'},\n              to: {opacity: 1, transform: 'translateY(0)'}\n            }))\n          ])\n        ])\n      ])\n    ])\n  ]\n})\nexport class HelloComponent {\n  @HostBinding('@helloAnimation')\n  public animate = true\n}\n```\n\n## Options\n\nThe first option of `springKeyframes` is an object with two properties, `from` and `to`. The `from` property is an object with the properties that you want to animate from, and the `to` property is an object with the properties that you want to animate to.\n\nThe second option of `springKeyframes` is the options object.\n\n```ts\ninterface Options {\n  stiffness: number\n  damping: number\n  precision: number\n  unit: string\n}\n```\n\n### Stiffness\n**Default: 100**\n\nThe attraction force of a spring. Higher values create faster, sharper movement.\n\n### Damping\n**Default: 10**\n\nThe opposing force of a spring. Higher values reduce the bounciness of the spring.\n\n### Precision\n**Default: 0.001**\n\nThe precision of values that are being animated.\n\n### Unit\n**Default: 'px'**\n\nThe unit of measurement for the css properties.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnickgraffis%2Fng-spring","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnickgraffis%2Fng-spring","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnickgraffis%2Fng-spring/lists"}