{"id":34622143,"url":"https://github.com/m-sarabi/rain-char","last_synced_at":"2025-12-24T15:27:12.872Z","repository":{"id":253993029,"uuid":"845162959","full_name":"m-sarabi/rain-char","owner":"m-sarabi","description":"A lightweight JavaScript library that creates a 'Matrix-style' falling character effect with depth. Customize the font, colors, character range, and animation speed for dynamic visual effects on your webpage.","archived":false,"fork":false,"pushed_at":"2025-10-06T18:56:43.000Z","size":922,"stargazers_count":8,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-06T18:59:06.797Z","etag":null,"topics":["animation-library","canvas","cdn","effect","effects","falling-code","hacking","javascript","jsdelivr","library","matrix","visual-effects"],"latest_commit_sha":null,"homepage":"http://m-sarabi.ir/rain-char/","language":"JavaScript","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/m-sarabi.png","metadata":{"files":{"readme":"readme.md","changelog":"changelog.md","contributing":null,"funding":null,"license":"LICENSE","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":"2024-08-20T17:48:32.000Z","updated_at":"2025-10-06T18:56:47.000Z","dependencies_parsed_at":"2024-08-25T11:33:11.346Z","dependency_job_id":"8599608f-ac5b-4cc1-b93a-2273b855c650","html_url":"https://github.com/m-sarabi/rain-char","commit_stats":null,"previous_names":["m-sarabi/rain-char"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/m-sarabi/rain-char","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m-sarabi%2Frain-char","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m-sarabi%2Frain-char/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m-sarabi%2Frain-char/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m-sarabi%2Frain-char/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/m-sarabi","download_url":"https://codeload.github.com/m-sarabi/rain-char/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m-sarabi%2Frain-char/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28004147,"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","status":"online","status_checked_at":"2025-12-24T02:00:07.193Z","response_time":83,"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-library","canvas","cdn","effect","effects","falling-code","hacking","javascript","jsdelivr","library","matrix","visual-effects"],"created_at":"2025-12-24T15:27:12.134Z","updated_at":"2025-12-24T15:27:12.867Z","avatar_url":"https://github.com/m-sarabi.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# RainChar - Customizable Matrix Rain Effect\n\n![NPM Version](https://img.shields.io/npm/v/rain-char?style=flat)\n![NPM Downloads](https://img.shields.io/npm/dy/rain-char?style=flat)\n![npm bundle size](https://img.shields.io/bundlephobia/min/rain-char?style=flat)\n![jsDelivr hits (npm)](https://img.shields.io/jsdelivr/npm/hy/rain-char?style=flat\u0026color=%23ff5000)\n\n![A dark background with flowing streams of Japanese characters in and green cascading downwards.](https://raw.githubusercontent.com/m-sarabi/rain-char/refs/heads/main/assets/banner.png?raw=true)\n\nBring the iconic, \"Matrix\" digital rain effect to your website with just a few lines of code.\n\nThis library is built with modern web technologies for maximum performance. It offloads all the heavy animation and rendering logic to a Web Worker, ensuring your main UI thread stays smooth and responsive.\n\n### [➡️ Check out the live demo here! ⬅️](https://m-sarabi.ir/rain-char/)\nPlay with all the settings and see it in action.\n\n![Rain Char Demo](https://raw.githubusercontent.com/m-sarabi/rain-char/refs/heads/main/assets/rain-char.gif?raw=true)\n\n### Key Features\n\n- **Blazing Fast:** Uses `OffscreenCanvas` in a Web Worker to keep your main thread free.\n- **Highly Customizable:** Colors, character sets, font sizes, rain density, trail length, and more.\n- **Easy to Use:** A simple and clean API.\n- **Responsive:** Automatically observes and adapts to the new size.\n- **Lightweight:** No dependencies, just pure JavaScript.\n\n## 💻 Quick Start\n\nThe easiest way to get started is by using the JSDelivr CDN.\n\n### 1. CDN\n\nJust add a `\u003ccanvas\u003e` element to your HTML, and include the script.\n\n```html\n\u003c!DOCTYPE html\u003e\n\u003chtml\u003e\n\u003chead\u003e\n    \u003ctitle\u003eRain Char Demo\u003c/title\u003e\n\u003c/head\u003e\n\u003cbody\u003e\n    \u003ccanvas id=\"my-canvas\"\u003e\u003c/canvas\u003e\n\n    \u003c!-- Get the library from the CDN --\u003e\n    \u003cscript src=\"https://cdn.jsdelivr.net/npm/rain-char\"\u003e\u003c/script\u003e\n\n    \u003cscript\u003e\n        // Find your canvas element\n        const canvas = document.getElementById('my-canvas');\n\n        // Create a new instance\n        const rain = new RainChar(canvas);\n\n        // Let it rain!\n        rain.start();\n    \u003c/script\u003e\n\n\u003c/body\u003e\n\u003c/html\u003e\n```\n\n### 2. NPM / Yarn\n\nIf you're using a bundler like Vite, Webpack, or Rollup:\n\n```bash\n# Using npm\nnpm install rain-char\n\n# Using yarn\nyarn add rain-char\n```\n\nThen, you can import it into your project:\n\n```javascript\nimport RainChar from 'rain-char';\n\nconst canvas = document.querySelector('#my-canvas');\n\n// Create a new instance with some custom settings\nconst rain = new RainChar(canvas, {\n    fg: '#00ccff',\n    density: 0.05,\n    charRange: '0123456789',\n});\n\n// Let it rain!\nrain.start();\n```\n\n## ⚙️ Configuration Options\n\nYou can pass a settings object as the second argument to the `RainChar` constructor. Here are all the available options:\n\n| Option           | Type                                     | Default            | Description                                                                                     |\n|------------------|------------------------------------------|--------------------|-------------------------------------------------------------------------------------------------|\n| `font`           | `string`                                 | `'monospace'`      | The CSS `font-family` to use for the characters.                                                |\n| `charSize`       | `[number, number]`                       | `[10, 40]`         | The minimum and maximum font size for the characters.                                           |\n| `charRange`      | `string` \\| `[number, number]` \\| `[][]` | `[0x0021, 0x007e]` | Characters to use. Can be a string, a single Unicode range `[min, max]`, or an array of ranges. |\n| `bg`             | `string`                                 | `'black'`          | Background color in a CSS-compatible format.                                                    |\n| `fg`             | `string`                                 | `'limegreen'`      | Font color in a CSS-compatible format.                                                          |\n| `fps`            | `number`                                 | `60`               | The maximum frames per second for the animation.                                                |\n| `density`        | `number`                                 | `0.2`              | How dense the rain is (0 to 1). A larger value means more characters.                           |\n| `trailDecay`     | `number`                                 | `0.2`              | The length of the character trails (0 to 1). A smaller value means a longer, more faded trail.  |\n| `charSpacing`    | `number`                                 | `0.5`              | The vertical gap between characters in a stream. `1` means they are tightly packed.             |\n| `charChangeFreq` | `number`                                 | `0.25`             | How often characters change (0 to 1). A lower value means characters change less frequently.    |\n\n## 🕹️ API Methods\n\nHere are the public methods you can call on your `RainChar` instance.\n\n- `rain.start()`: Starts or resumes the animation.\n\n- `rain.pause()`: Pauses the animation. Call `start()` to resume.\n\n- `rain.stop()`: Stops the animation and completely clears the canvas.\n\n- `rain.updateSetting(key, value)`: Updates a single setting on the fly.\n\n    ```javascript\n    // Make the rain trails longer\n    rain.updateSetting('trailDecay', 0.05);\n    \n    // Change the color to a nice shade of blue\n    rain.updateSetting('fg', '#3399FF');\n    ```\n\n- `rain.destroy()`: Stops the animation, terminates the Web Worker, and cleans up all resources. Use this when you're removing the effect from the page permanently, to prevent memory leaks.\n\n## 📜 License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\n\n---\nCreated by [Mohammad Sarabi](https://github.com/m-sarabi).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fm-sarabi%2Frain-char","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fm-sarabi%2Frain-char","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fm-sarabi%2Frain-char/lists"}