Home

Awesome

PowerModeInput

NPM JavaScript Style Guide

PowerModeInput can make your text input box more compelling

This project can make your input box lively. One day I saw a vscode plugin called Power Mode, so I wanted to write a similar javascript library. This project uses proton.js and it is also great.

By the way recommend a great react particle animation background component https://github.com/lindelof/particles-bg

Online demo

Install

npm install --save power-mode-input

Usage

import PowerModeInput from "power-mode-input";

const input = document.getElementById("obinput");
PowerModeInput.make(input);

// close PowerModeInput
PowerModeInput.close(input);

// destroy PowerModeInput
PowerModeInput.destroy();

// another usage
PowerModeInput.make(".phone", {
  height: 5,
  tha: [0, 360],
  g: 0.5,
  num: 5,
  radius: 6,
  circle: true,
  alpha: [0.75, 0.1],
  color: "random"
});

If you are in react, you can use it like this

componentDidMount(){
  PowerModeInput.make(this.inputRef.current);
}

You can use it like this in vue.js

mounted() {
  PowerModeInput.make(this.$refs.inputRef);
}

Of course this can be done in angular

const inputElement = this.elementRef.nativeElement.querySelector('input');
PowerModeInput.make(inputElement);

Parameter Description

PowerModeInput.make(input, {
  height: 5,
  tha: [0, 360],
  g: 0.5,
  num: 5,
  ... // Parameter
});
keydescribetypeexample
gWhether to add gravitynumber1
numThe number of particles emitted each timenumber3
radiusThe radius of every particlenumber10
alphaThe alpha of every particlenumber.1
thaThe Particle emitter anglearray[0, 360]
vThe Particle emitter Particle velocitynumber0.5
lifeThe life of every particlenumber1.2
colorParticle colorarray or string#ffcccc
randomRandom forcenumber1.2
yParticle emitter heightnumber2
heightParticle emitter height Ibidnumber2

Explanation

For some special types of input boxes, the cursor may not be positioned correctly. I am also looking for a solution to this problem. If you know, please let me know. See here for specific reasons

Contribution

I very much hope that you can work with me to modify the code. I also have a lot of fun ideas. Maybe you can join me to implement it.

License

https://opensource.org/licenses/MIT