{"id":24179957,"url":"https://github.com/hoseungme/linear-gradient-element","last_synced_at":"2026-02-12T05:36:08.543Z","repository":{"id":272024999,"uuid":"915192542","full_name":"hoseungme/linear-gradient-element","owner":"hoseungme","description":"Set linear-gradient CSS background of your element, with transition animation, interpolation","archived":false,"fork":false,"pushed_at":"2025-01-20T13:25:26.000Z","size":19,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-24T14:58:56.047Z","etag":null,"topics":["animation","color","css","css-animations","css-transitions","linear-gradient","transition"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/hoseungme.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":"2025-01-11T07:50:03.000Z","updated_at":"2025-02-26T17:11:08.000Z","dependencies_parsed_at":"2025-01-11T15:20:41.940Z","dependency_job_id":"7ce34454-aa33-45f2-8d5b-f721b6c59393","html_url":"https://github.com/hoseungme/linear-gradient-element","commit_stats":null,"previous_names":["hoseungme/linear-gradient-element"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/hoseungme/linear-gradient-element","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hoseungme%2Flinear-gradient-element","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hoseungme%2Flinear-gradient-element/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hoseungme%2Flinear-gradient-element/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hoseungme%2Flinear-gradient-element/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hoseungme","download_url":"https://codeload.github.com/hoseungme/linear-gradient-element/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hoseungme%2Flinear-gradient-element/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29359566,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-12T01:03:07.613Z","status":"online","status_checked_at":"2026-02-12T02:00:06.911Z","response_time":55,"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":["animation","color","css","css-animations","css-transitions","linear-gradient","transition"],"created_at":"2025-01-13T06:11:23.739Z","updated_at":"2026-02-12T05:36:08.530Z","avatar_url":"https://github.com/hoseungme.png","language":"TypeScript","readme":"\u003cdiv align=\"center\"\u003e\n  \u003ch1\u003elinear-gradient-element\u003c/h1\u003e\n  \u003cp\u003eSet linear-gradient CSS background of your element, with transition animation, interpolation\u003c/p\u003e\n  \u003cvideo src=\"https://github.com/user-attachments/assets/4370b37d-32c0-4b12-8889-50f3633f9660\"\u003e\n\u003c/div\u003e\n\n## Install\n\n```\n$ npm install linear-gradient-element\n```\n\n## Usage\n\nSimple usage in React:\n\n```tsx\nimport { LinearGradientElement, LinearGradient, RGB } from \"linear-gradient-element\";\n```\n\n```tsx\nconst from = new LinearGradient({\n  angle: 270,\n  colorStops: [\n    [new RGB([0, 219, 222], 1), 0],\n    [new RGB([252, 0, 255], 1), 1],\n  ],\n});\n\nconst to = new LinearGradient({\n  angle: 43,\n  colorStops: [\n    [new RGB([65, 88, 208], 1), 0],\n    [new RGB([200, 80, 192], 1), 0.46],\n    [new RGB([255, 204, 112], 1), 1],\n  ],\n});\n```\n\n### Transition\n\n```tsx\nfunction Transition() {\n  const ref = useRef\u003cHTMLDivElement\u003e(null);\n\n  useEffect(() =\u003e {\n    const target = ref.current;\n    if (!target) {\n      return;\n    }\n\n    const element = new LinearGradientElement(target, from);\n    element.transition(to, { duration: 2000 });\n  }, []);\n\n  return \u003cdiv style={{ width: 500, height: 300, background: from.css() }} ref={ref} /\u003e;\n}\n```\n\nhttps://github.com/user-attachments/assets/d4321306-2601-429a-9986-f9ba5664aa2f\n\n### Transition With Easing\n\n```tsx\nfunction easeInOutQuart(x: number): number {\n  return x \u003c 0.5 ? 8 * x * x * x * x : 1 - Math.pow(-2 * x + 2, 4) / 2;\n}\n\nfunction TransitionWithEasing() {\n  const ref = useRef\u003cHTMLDivElement\u003e(null);\n\n  useEffect(() =\u003e {\n    const target = ref.current;\n    if (!target) {\n      return;\n    }\n\n    const element = new LinearGradientElement(target, from);\n    element.transition(to, { duration: 2000, easing: easeInOutQuart });\n  }, []);\n\n  return \u003cdiv style={{ width: 500, height: 300, background: from.css() }} ref={ref} /\u003e;\n}\n```\n\nhttps://github.com/user-attachments/assets/46afb840-6abc-4efc-858f-c6845973db18\n\n### Interpolation\n\n```tsx\nfunction Interpolation() {\n  const ref = useRef\u003cHTMLDivElement\u003e(null);\n  const [element, setElement] = useState\u003cLinearGradientElement | null\u003e(null);\n\n  useEffect(() =\u003e {\n    const target = ref.current;\n    if (!target) {\n      return;\n    }\n\n    setElement(new LinearGradientElement(target, from));\n  }, []);\n\n  return (\n    \u003cdiv style={{ display: \"flex\", flexDirection: \"column\", alignItems: \"center\" }}\u003e\n      \u003cdiv style={{ display: \"flex\", gap: 8 }}\u003e\n        \u003cbutton onClick={() =\u003e element?.interpolation(from, to, 0)}\u003e0%\u003c/button\u003e\n        \u003cbutton onClick={() =\u003e element?.interpolation(from, to, 0.25)}\u003e25%\u003c/button\u003e\n        \u003cbutton onClick={() =\u003e element?.interpolation(from, to, 0.5)}\u003e50%\u003c/button\u003e\n        \u003cbutton onClick={() =\u003e element?.interpolation(from, to, 0.75)}\u003e75%\u003c/button\u003e\n        \u003cbutton onClick={() =\u003e element?.interpolation(from, to, 1)}\u003e100%\u003c/button\u003e\n      \u003c/div\u003e\n      \u003cdiv style={{ width: 500, height: 300, background: from.css() }} ref={ref} /\u003e\n    \u003c/div\u003e\n  );\n}\n```\n\nhttps://github.com/user-attachments/assets/0862f614-d72f-4cff-9fef-6db108d686cf\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhoseungme%2Flinear-gradient-element","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhoseungme%2Flinear-gradient-element","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhoseungme%2Flinear-gradient-element/lists"}