New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

rain-char

Package Overview
Dependencies
Maintainers
0
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rain-char

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.

  • 1.4.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
12
Maintainers
0
Weekly downloads
 
Created
Source

RainChar - Customizable Matrix-Style Rain Effect

A dark background with flowing streams of Japanese characters in and yellow cascading downwards.

RainChar is an animation effect written in JavaScript to create a Matrix-Style effect with full control over customizability.

Usage

Use CDN:


<script src="https://cdn.jsdelivr.net/npm/rain-char"></script>

Create an instance of the effect (all options are optional)

const rain = new RainChar({
    id: 'rain',
    font: 'Consolas',
    charSize: [10, 30]
});

To start the effect call the start method

rain.start();

Demo

m-sarabi.ir/rain-char A matrix-style image generator interface with options for font, character size, character range, background, foreground, speed, density factor, and resizing the effect screen.

Customization

You can customize the effect however you like with the options provided, and you can add an id to each effect individually to style them with CSS.

Most options (except for id and parentId) can be adjusted seamlessly at any time.

Options

NameDescriptionTypeDefault value
fontThe font used for Rain Charactersstring"monospace"
charSizeThe lower and upper limit for the font size[number, number][10, 40]
charRangeThe range of Unicode character, or
a list of such ranges
[number, number] or
[number, number][]
[0x0021, 0x007e]
bgBackground color of the canvasstring"#222"
fgColor of the charactersstring"yellow"
idThe id to be assigned to the canvas elementstring
fpsMaximum fps (higher means faster rainfall)number30
densityFactorHow dense the rainfall is (Lower means denser)number10
trailMultiplierDefines the length of the trail. Higher means shorter trailnumber1
charSpacingDefines the space between characters (1 means one character)number1
charChangeFreqDefines the probability of characters changing (0% - 100%)number1
parentIdid of the element which canvas is appended tostringbody element

Methods

NameDescription
startFresh starts the effect animation. It also acts as a restart
stopStops the effect and clears the canvas.
pausePause/Play the animation.

By playing with the options above, you can create a variety of effects.

An example snow effect:

Changelog

Changelog

©️ Licence

This project is licensed under the MIT License

Copyright 2024 Mohammad Sarabi

Keywords

FAQs

Package last updated on 25 Aug 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc