{"id":19528620,"url":"https://github.com/swanie21/css-animations","last_synced_at":"2025-04-26T11:33:15.152Z","repository":{"id":132551326,"uuid":"80746892","full_name":"swanie21/css-animations","owner":"swanie21","description":"CSS button animation examples","archived":false,"fork":false,"pushed_at":"2017-03-07T00:43:33.000Z","size":160,"stargazers_count":3,"open_issues_count":0,"forks_count":4,"subscribers_count":1,"default_branch":"gh-pages","last_synced_at":"2025-04-04T12:01:44.325Z","etag":null,"topics":["css","css-transforms","css-transitions","css3-animations","responsive-design","sass"],"latest_commit_sha":null,"homepage":"http://kirstenswanson.io/css-animations/","language":"CSS","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/swanie21.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":"2017-02-02T16:59:58.000Z","updated_at":"2020-05-08T22:59:56.000Z","dependencies_parsed_at":null,"dependency_job_id":"6dd12254-1bc1-416f-84fb-66e13bd18b74","html_url":"https://github.com/swanie21/css-animations","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/swanie21%2Fcss-animations","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swanie21%2Fcss-animations/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swanie21%2Fcss-animations/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swanie21%2Fcss-animations/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/swanie21","download_url":"https://codeload.github.com/swanie21/css-animations/tar.gz/refs/heads/gh-pages","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250980722,"owners_count":21517712,"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":["css","css-transforms","css-transitions","css3-animations","responsive-design","sass"],"created_at":"2024-11-11T01:19:26.440Z","updated_at":"2025-04-26T11:33:15.145Z","avatar_url":"https://github.com/swanie21.png","language":"CSS","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CSS Animations using Transitions \u0026amp; Transforms\n\n## CSS transitions can enrich user experiences by adding animations to elements by smoothly changing CSS values over a specified duration\n\n## CSS transforms change the shape and position of the content by rotation, skewing, scaling and translation in 2D and 3D space\n\n[Live animations demo](http://kirstenswanson.io/css-animations/)\n\n## Transition Examples:\n\n```\nbutton {\n  transition-duration: 0.3s;\n  transition-property: background;\n  transition-timing-function: ease;\n}\n```\nShorthand:\n```\nbutton {\n  transition: background 0.3s ease;\n}\n```\n\nThe `transition-timing-function` value allows the speed of the transition to change over time. There are 6 values for this property: `ease`, `linear`, `ease-in`, `ease-out`, `ease-in-out` and `cubic-bezier`. The `ease` value is the default value.\n\nAdd a `transition-delay` property to delay the transition the moment the change of state is triggered\n\n```\nbutton {\n  transition-delay: 0.5\n  transition-duration: 0.3s;\n  transition-property: background;\n  transition-timing-function: ease;\n}\n```\n\nShorthand:\n```\nbutton {\n  transition: background 0.3s ease 0.5;\n}\n```\n\nYou might think that the transition property goes on the pseudo-class like the `:hover` state, but you might want the transition triggered on other states like `:focus`, so you should only declare the transition on the normal state.\n\n```\nbutton {\n  background: #2b5ea2;\n  transition-delay: 0.5\n  transition-duration: 0.3s;\n  transition-property: background;\n  transition-timing-function: ease;\n  \u0026:hover, \u0026:focus {\n    background: darken(#2b5ea2, 15%);\n  }\n}\n```\n\nYou can chain multiple transition properties\n\n```\nbutton {\n  transition: background 0.5s ease, color 0.5s linear;\n}\n```\n\nShorthand:\n```\nbutton {\n  transition: all 0.5s ease;`\n}\n```\nBoth the background and the color would be transitioned\n\nBy stating the `all` value you can target all the available properties so they all have the same duration and timing function on all the pseudo-class states (:hover, :focus, :active).\n\nSome other CSS properties that can be transitioned include `width`, `opacity`, `position` and `font-size`. Click [here](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_animated_properties) for the complete list of properties that can be animated.\n\n## Transform Examples:\n\n`scale()` increases or decreases the size of an element    \n\n```\nbutton:hover {\n  transform: scale(2);\n}\n```\nThe button will be twice the original size when you hover over it\n\nYou can pass in two values into `scale(x, y)`  \n```\nbutton:hover {\n  transform: scale(2, 3);\n}\n```\nThe button will be twice its original width and triple its original height\n\n## Animation Example:\n\nCSS3 animations use `keyframes` to specify what styles the element will have at certain times. To specify when the styling changes should occur you can use percentages or the keywords \"from\" (0%) and \"to\" (100%). Additionally, the animation needs an identifier or name in order to reference the animation when you want to call it. The animation identifier in the example below is `hover-pulse`.\n\n```\nbutton:hover {\n  animation-name: hover-pulse;\n  animation-duration: 1s;\n  animation-timing-function: linear;\n  animation-iteration-count: infinite;\n}\n\n@keyframes hover-pulse {\n  25% {\n    transform: scale(1.1);\n  }\n  75% {\n    transform: scale(0.9);\n  }\n}\n```\n\nShorthand:\n```\nbutton:hover {\n  animation: hover-pulse 1s linear infinite;\n}\n```\nThis button will infinitely pulse increasing and decreasing in size when hovered on\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fswanie21%2Fcss-animations","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fswanie21%2Fcss-animations","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fswanie21%2Fcss-animations/lists"}