Vanilla JS Plugin change background color depending the mouse position
// usage
const bg = new MousemoveBGColors();
or
// with options
const bg = new MousemoveBGColors({
target : '.selector' //(string) element selector // default : 'body'
,transition : .2 //(float|int) transition duration // default: .09
,delay:2 //(float|int) transition delay // default: 0
,center: [255, 255, 255] //(array) rgb color in the center // default : [168, 218, 218]
,topMiddle: [168, 218, 218] //(array) rgb color in top middle // default : [168, 218, 218]
,leftMiddle: [236, 236, 236] //(array) rgb color in the center // default : [168, 218, 218]
,rightMiddle: [255, 128, 63] //(array) rgb color in the center // default : [255, 128, 63]
,bottomMiddle: [204, 177, 218] //(array) rgb color in the center // default : [168, 218, 218]
});
Inspired by @JeWaVe Regis Portalez answer on StackOverflow