{
 "slug": "granim-js",
 "name": "Granim.js",
 "author": "Benjamin Blonde (sarcadass)",
 "density": "full",
 "status": "active",
 "status_note": null,
 "alternatives_page": null,
 "one_liner": "Tiny library for fluid animated gradient backgrounds on canvas, with gradient states, image blending and transitions.",
 "category": {
  "slug": "video-backgrounds",
  "name": "Video references and motion backgrounds"
 },
 "tags": [
  "Code library",
  "Open source"
 ],
 "styles": [
  "gradient",
  "minimal"
 ],
 "logo_url": "https://agentgid.com/media/avatars/sarcadass.png",
 "logo_letter": "G",
 "links": {
  "repo": "https://github.com/sarcadass/granim.js",
  "website": "https://sarcadass.github.io/granim.js/",
  "api_docs": null
 },
 "preview": {
  "kind": "image_grid",
  "src": "https://agentgid.com/assets/granim-js/demo.jpg",
  "alt": "A hero block on a diagonal gradient that cycles through three color pairs, a card with a radial gradient, and a card with three color stops at set positions, each drawn by Granim on a canvas.",
  "caption": "Made by AgentGid with granim 2.0.0 (npm, hash checked against the registry). MIT license; the colors are taken from the examples page and the texts are our own placeholders."
 },
 "verdicts": [
  {
   "key": "price",
   "label": "Price",
   "value": "Free",
   "status": "yes",
   "sub": "No paid plan",
   "quote": null,
   "note": "Fully free.",
   "source": {
    "label": "sarcadass.github.io/granim.js",
    "url": "https://sarcadass.github.io/granim.js/"
   },
   "n": 1
  },
  {
   "key": "commercial",
   "label": "Commercial use",
   "value": "Yes",
   "status": "yes",
   "sub": "MIT",
   "quote": "to use, copy, modify, merge, publish, distribute, sublicense, and/or sell",
   "note": "MIT allows use in paid products without a fee.",
   "source": {
    "label": "raw.githubusercontent.com",
    "url": "https://raw.githubusercontent.com/sarcadass/granim.js/master/LICENSE"
   },
   "n": 2
  },
  {
   "key": "credit",
   "label": "Credit the author",
   "value": "Not needed",
   "status": "yes",
   "sub": "Keep the notice in code copies",
   "quote": "The above copyright notice and this permission notice shall be included in all",
   "note": "No credit on screen. Keep the license notice inside the code you ship.",
   "source": {
    "label": "raw.githubusercontent.com",
    "url": "https://raw.githubusercontent.com/sarcadass/granim.js/master/LICENSE"
   },
   "n": 3
  },
  {
   "key": "agent_access",
   "label": "Agent access",
   "value": "npm package",
   "status": "info",
   "sub": "Installs without a key",
   "quote": null,
   "note": "An agent can install it by itself with npm install granim. No key or account is needed.",
   "source": {
    "label": "github.com/sarcadass/granim.js",
    "url": "https://github.com/sarcadass/granim.js"
   },
   "n": 4
  }
 ],
 "license": {
  "name": "MIT",
  "url": "https://raw.githubusercontent.com/sarcadass/granim.js/master/LICENSE",
  "summary": "Free to use in personal and paid sites, and you may change and share the code. No visible credit is needed; keep the license notice when you pass the code on.",
  "pages_read": 1,
  "rules": [
   "Keep the MIT notice if you redistribute the code."
  ],
  "rows": [
   {
    "label": "Commercial use",
    "value": "Yes",
    "status": "yes",
    "quote": "to use, copy, modify, merge, publish, distribute, sublicense, and/or sell",
    "source": {
     "label": "raw.githubusercontent.com",
     "url": "https://raw.githubusercontent.com/sarcadass/granim.js/master/LICENSE"
    },
    "note": null
   },
   {
    "label": "Credit",
    "value": "Not needed",
    "status": "yes",
    "quote": "The above copyright notice and this permission notice shall be included in all",
    "source": {
     "label": "raw.githubusercontent.com",
     "url": "https://raw.githubusercontent.com/sarcadass/granim.js/master/LICENSE"
    },
    "note": null
   },
   {
    "label": "Inside your app or game",
    "value": "Can ship inside your app",
    "status": "yes",
    "quote": "to use, copy, modify, merge, publish, distribute, sublicense, and/or sell",
    "source": {
     "label": "raw.githubusercontent.com",
     "url": "https://raw.githubusercontent.com/sarcadass/granim.js/master/LICENSE"
    },
    "note": null
   },
   {
    "label": "Pass the files on to your users",
    "value": "Allowed",
    "status": "yes",
    "quote": "to use, copy, modify, merge, publish, distribute, sublicense, and/or sell",
    "source": {
     "label": "raw.githubusercontent.com",
     "url": "https://raw.githubusercontent.com/sarcadass/granim.js/master/LICENSE"
    },
    "note": null
   },
   {
    "label": "AI training",
    "value": "Not stated",
    "status": "unknown",
    "quote": null,
    "source": null,
    "note": null
   },
   {
    "label": "Bots and bulk downloads",
    "value": "Not stated",
    "status": "unknown",
    "quote": null,
    "source": null,
    "note": null
   }
  ],
  "checked_at": "2026-11-05",
  "commercial_use_page": "https://agentgid.com/assets/granim-js/commercial-use/"
 },
 "overview": {
  "heading": "Granim.js: slowly shifting color gradients behind your content",
  "body": "Granim.js is a small free code library that fills a box on a web page with a color gradient that slowly changes from one set of colors to the next. You pick the colors and the direction, and it draws them behind your headline or card. It can also blend the colors with a picture and switch to other colors when a visitor clicks something."
 },
 "uses": [
  {
   "title": "A moving background for a hero",
   "text": "Put a slowly shifting gradient behind the big headline at the top of a landing page, so the first screen feels alive without a video.",
   "idea": false,
   "image": "https://agentgid.com/assets/granim-js/demo.jpg"
  },
  {
   "title": "Colors that answer a click",
   "text": "Switch the background to another set of colors when a visitor picks a plan, a mood or a dark theme, with a smooth fade between them.",
   "idea": false,
   "image": null
  },
  {
   "title": "Colored light over a photo",
   "text": "Lay the moving colors over your own photo with a blend mode such as multiply or screen, for a tinted header picture.",
   "idea": false,
   "image": null
  },
  {
   "title": "A logo or title filled with moving color",
   "text": "Show the moving gradient only inside a shape, such as your logo or a large word, by placing a cut-out picture over the canvas.",
   "idea": false,
   "image": null
  },
  {
   "title": "Text that stays readable on any color",
   "text": "Let the library mark the page as dark or light while the colors change, so your styles can switch the text between white and black.",
   "idea": false,
   "image": null
  },
  {
   "title": "A calm backdrop for a waiting screen",
   "text": "Fill a loading, sign-in or \"coming soon\" screen with slow color changes, so the empty page looks finished while people wait.",
   "idea": true,
   "image": null
  }
 ],
 "start": {
  "prompt": "Add granim 2.0.0 to the hero section of my landing page as an animated background on a full-size canvas behind the headline, with three color pairs from my brand, isPausedWhenNotInView set to true, and a still gradient for visitors who prefer reduced motion.",
  "install": "npm install granim --save",
  "install_note": null,
  "code": [
   {
    "tab": "Step 1",
    "intro": "Add a canvas where the gradient should appear, load the script and create a Granim instance with at least one state of gradients.",
    "source": "<!-- Create a <canvas> element -->\n<canvas id=\"granim-canvas\"></canvas>\n\n<!-- Call the script -->\n<script src=\"granim.min.js\"></script>\n\n<!-- Create a Granim instance -->\n<script>\nvar granimInstance = new Granim({\n   element: '#granim-canvas',\n   name: 'granim',\n   opacity: [1, 1],\n   states : {\n       \"default-state\": {\n           gradients: [\n               ['#834D9B', '#D04ED6'],\n               ['#1CD8D2', '#93EDC7']\n           ]\n       }\n   }\n});\n</script>"
   }
  ]
 },
 "mistakes": [
  {
   "dont": "gradients: [['#ff9966', '#ff5e62'], ['#00f260', '#0575e6', '#e1eec3']]",
   "fix": "Give every gradient in every state the same number of colors",
   "why": "Gradients with different numbers of colors are not supported.",
   "dont_code": false,
   "fix_code": false
  },
  {
   "dont": "A bare <canvas> with no CSS size, expecting it to cover the section",
   "fix": "Stretch the canvas over its box with position absolute, width 100% and height 100%, and put the content above it",
   "why": "The docs' examples size the canvas with CSS; our demo canvases only filled their boxes with these rules.",
   "dont_code": false,
   "fix_code": false
  },
  {
   "dont": "Leaving several animated canvases running while they are scrolled out of view",
   "fix": "Set isPausedWhenNotInView: true, and call destroy() when the block is removed from the page",
   "why": "By default the animation keeps running off screen; it only pauses on a tab change.",
   "dont_code": false,
   "fix_code": false
  },
  {
   "dont": "image: { blendingMode: 'multiply' } with no source, or an image with no gradients",
   "fix": "Pass both image.source and the gradients",
   "why": "The blend only works with an image and gradients set.",
   "dont_code": false,
   "fix_code": false
  }
 ],
 "agent": {
  "self_serve": true,
  "self_serve_text": "Agent installs a package or loads it from a CDN",
  "install": "npm install granim",
  "repo": "https://github.com/sarcadass/granim.js",
  "api_docs": null,
  "api_account": "Not needed. Everything runs on your side.",
  "get_files": "npm install granim (or CDN), add a <canvas>, new Granim({element, states}).",
  "formats": [
   "js",
   "html"
  ],
  "limits": null,
  "mcp": null,
  "mcp_url": null,
  "credit_line": "Animated gradient: Granim.js (MIT License)",
  "rules_text": "- Granim.js (Video references and motion backgrounds, Backgrounds, patterns and shapes). Tiny library for fluid animated gradient backgrounds on canvas, with gradient states, image blending and transitions. Price: free; commercial use OK; no credit needed. Style: gradient, minimal.\n  Connect: npm granim.\n  Get files: npm install granim (or CDN), add a <canvas>, new Granim({element, states}) (js, html).\n  Rule: Keep the MIT notice if you redistribute the code.\n  License: https://raw.githubusercontent.com/sarcadass/granim.js/master/LICENSE (checked 2026-11-05; details: https://agentgid.com/assets/granim-js/)",
  "agent_md": "https://agentgid.com/assets/granim-js/agent.md",
  "card_json": "https://agentgid.com/assets/granim-js/card.json"
 },
 "popularity": {
  "gid_score": 22,
  "stars": 5295,
  "downloads_7d": 3733,
  "downloads_7d_label": "3,733",
  "downloads_change_4w_pct": -22.8,
  "eco": "npm",
  "package": "granim",
  "repo": "sarcadass/granim.js",
  "agent_projects": null,
  "agent_projects_total": null,
  "downloads_unconfirmed": false,
  "series": {
   "downloads_weekly": [
    [
     "2025-11-17",
     3128
    ],
    [
     "2025-11-24",
     3171
    ],
    [
     "2025-12-01",
     3383
    ],
    [
     "2025-12-08",
     4657
    ],
    [
     "2025-12-15",
     4864
    ],
    [
     "2025-12-22",
     3451
    ],
    [
     "2025-12-29",
     3669
    ],
    [
     "2026-01-05",
     3950
    ],
    [
     "2026-01-12",
     4212
    ],
    [
     "2026-01-19",
     5253
    ],
    [
     "2026-01-26",
     4770
    ],
    [
     "2026-02-02",
     6166
    ],
    [
     "2026-02-09",
     6466
    ],
    [
     "2026-02-16",
     6426
    ],
    [
     "2026-02-23",
     6441
    ],
    [
     "2026-03-02",
     6001
    ],
    [
     "2026-03-09",
     6503
    ],
    [
     "2026-03-16",
     6394
    ],
    [
     "2026-03-23",
     6495
    ],
    [
     "2026-03-30",
     4662
    ],
    [
     "2026-04-06",
     4565
    ],
    [
     "2026-04-13",
     4627
    ],
    [
     "2026-04-20",
     4392
    ],
    [
     "2026-04-27",
     3806
    ],
    [
     "2026-05-04",
     12946
    ],
    [
     "2026-05-11",
     5394
    ],
    [
     "2026-05-18",
     5856
    ],
    [
     "2026-05-25",
     4955
    ],
    [
     "2026-06-01",
     4586
    ],
    [
     "2026-06-08",
     4315
    ],
    [
     "2026-06-15",
     6369
    ],
    [
     "2026-06-22",
     4544
    ],
    [
     "2026-06-29",
     3354
    ],
    [
     "2026-07-06",
     3867
    ],
    [
     "2026-07-13",
     4810
    ],
    [
     "2026-07-20",
     4473
    ],
    [
     "2026-07-27",
     4832
    ],
    [
     "2026-08-03",
     7980
    ],
    [
     "2026-08-10",
     5318
    ],
    [
     "2026-08-17",
     4877
    ],
    [
     "2026-08-24",
     4138
    ],
    [
     "2026-08-31",
     4736
    ],
    [
     "2026-09-07",
     3285
    ],
    [
     "2026-09-14",
     4029
    ],
    [
     "2026-09-21",
     3886
    ],
    [
     "2026-09-28",
     6273
    ],
    [
     "2026-10-05",
     3804
    ],
    [
     "2026-10-12",
     4040
    ],
    [
     "2026-10-19",
     2984
    ],
    [
     "2026-10-26",
     3431
    ],
    [
     "2026-11-02",
     3749
    ],
    [
     "2026-11-09",
     3733
    ]
   ],
   "stars": [
    [
     "2026-11-07",
     5296
    ],
    [
     "2026-11-08",
     5296
    ],
    [
     "2026-11-09",
     5296
    ],
    [
     "2026-11-10",
     5297
    ],
    [
     "2026-11-11",
     5297
    ],
    [
     "2026-11-12",
     5297
    ],
    [
     "2026-11-13",
     5297
    ],
    [
     "2026-11-14",
     5296
    ],
    [
     "2026-11-15",
     5296
    ],
    [
     "2026-11-16",
     5296
    ],
    [
     "2026-11-17",
     5295
    ]
   ]
  },
  "stars_flat_since": null,
  "updated_at": "2026-11-17"
 },
 "alternatives": [
  {
   "slug": "granim-js",
   "name": "Granim.js",
   "why": null,
   "current": true,
   "price": "Free",
   "commercial": {
    "value": "Commercial OK",
    "status": "yes"
   },
   "access": "npm"
  },
  {
   "slug": "vanta-js",
   "name": "Vanta.js",
   "why": "Pick Vanta.js when you want a moving 3D scene such as waves, fog or birds instead of a flat color gradient.",
   "current": false,
   "price": "Free",
   "commercial": {
    "value": "Commercial OK",
    "status": "yes"
   },
   "access": "npm"
  },
  {
   "slug": "shadergradient",
   "name": "ShaderGradient",
   "why": "Pick ShaderGradient for a soft 3D gradient shaped like waves or a sphere, set up in a visual editor and used from React or Vue.",
   "current": false,
   "price": "Free",
   "commercial": {
    "value": "Commercial OK",
    "status": "yes"
   },
   "access": "npm"
  },
  {
   "slug": "tsparticles",
   "name": "tsParticles",
   "why": "Pick tsParticles when the background should be moving dots, stars, confetti or fireworks rather than colors.",
   "current": false,
   "price": "Free",
   "commercial": {
    "value": "Commercial OK",
    "status": "yes"
   },
   "access": "npm"
  },
  {
   "slug": "threejs-examples",
   "name": "three.js examples",
   "why": "Hundreds of official three.js WebGL/WebGPU examples (shaders, particles, post-processing, loaders) with full source in the repo's examples folder.",
   "current": false,
   "price": "Free",
   "commercial": {
    "value": "Commercial OK",
    "status": "yes"
   },
   "access": "npm"
  },
  {
   "slug": "react-three-fiber-examples",
   "name": "React Three Fiber examples",
   "why": "Gallery of React Three Fiber scenes (shaders, portals, caustics, scroll, physics, glass) linked to runnable sandboxes with source.",
   "current": false,
   "price": "Free",
   "commercial": {
    "value": "Commercial OK",
    "status": "yes"
   },
   "access": "npm"
  }
 ],
 "faq": [
  {
   "q": "Which color formats can I use?",
   "a": "Hex, rgb, rgba, hsl and hsla. You can also set where each color sits in the gradient with a position from 0 to 1."
  },
  {
   "q": "Which directions are there?",
   "a": "Diagonal (the default), left to right, top to bottom, radial, and a custom direction set in pixels or percentages."
  },
  {
   "q": "Can I stop or change the animation from my own code?",
   "a": "Yes. The instance has play, pause, clear, changeState, changeDirection, changeBlendingMode and destroy methods."
  },
  {
   "q": "How fast do the colors change?",
   "a": "By default each change between two gradients takes 5 seconds, and a switch to another state takes 1 second; both are settings in milliseconds."
  },
  {
   "q": "Can I use it in a paid product?",
   "a": "Yes. The MIT license allows use, change and sale of copies; keep the license notice with the code."
  }
 ],
 "at_a_glance": {
  "latest_version": "2.0.0",
  "last_release": "2018-11-11",
  "last_commit": "2022-12-06",
  "runtime": "Any browser with canvas; no other packages; works from a plain script tag or a bundler.",
  "key_needed": false,
  "formats": "js, html"
 },
 "good_to_know": [
  "The last release, 2.0.0, came out in 2018. The library is small and has no other packages, but expect no new features or fixes.",
  "Every gradient in one setup must have the same number of colors. Mixing two-color and three-color gradients does not work.",
  "The animation pauses on its own when the visitor switches browser tabs. It keeps running while scrolled out of view unless you turn on the pause option.",
  "Blending with a picture works only when you give it both a picture and gradients, and the picture must be your own or one you may use."
 ],
 "stack_snippets": [],
 "claims": [],
 "checked": {
  "license_read": "2026-11-05",
  "overview_checked": "2026-11-12",
  "numbers_updated": "2026-11-17",
  "sources": [
   {
    "label": "sarcadass.github.io/granim.js",
    "url": "https://sarcadass.github.io/granim.js/"
   },
   {
    "label": "sarcadass.github.io/granim.js/examples.html",
    "url": "https://sarcadass.github.io/granim.js/examples.html"
   },
   {
    "label": "sarcadass.github.io/granim.js/api-v2.0.0.html",
    "url": "https://sarcadass.github.io/granim.js/api-v2.0.0.html"
   },
   {
    "label": "github.com/sarcadass/granim.js",
    "url": "https://github.com/sarcadass/granim.js"
   },
   {
    "label": "README on GitHub",
    "url": "https://github.com/sarcadass/granim.js/blob/master/README.md"
   },
   {
    "label": "LICENSE on GitHub",
    "url": "https://github.com/sarcadass/granim.js/blob/master/LICENSE"
   },
   {
    "label": "npm: granim",
    "url": "https://registry.npmjs.org/granim"
   },
   {
    "label": "raw.githubusercontent.com",
    "url": "https://raw.githubusercontent.com/sarcadass/granim.js/master/LICENSE"
   },
   {
    "label": "npm: granim/latest",
    "url": "https://registry.npmjs.org/granim/latest"
   }
  ],
  "unverified": null
 },
 "user_reports": null,
 "url": "https://agentgid.com/assets/granim-js/",
 "note": "Written by AgentGid from the official pages in checked.sources; quotes are copied from those pages. status: yes | cond | no | unknown | info. Prices and vendor claims are as reported on the checked date. Not legal advice."
}
