GithubHelp home page GithubHelp logo

mharrvic / brusher Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kamranahmedse/brusher

0.0 1.0 0.0 21.3 MB

A lightweight library to create interactive backgrounds

Home Page: http://kamranahmed.info/brusher

License: MIT License

JavaScript 100.00%

brusher's Introduction

Little vanilla JS library to add interactive backgrounds to your webpages - View Demo

Installation

Install it using yarn or npm

yarn add brusher

Or you may use unpkg

http://unpkg.com/brusher/dist/brusher.min.js

Usage

For the basic usage, all you need to do is create an instance of Brusher and provide an image

import Brusher from 'brusher';

const brusher = new Brusher({
  image: 'abstract.png'
});

brusher.init();

Available Options

Here is the list of options that you may use

const brusher = new Brusher({
  image: 'abstract.png', // Path of the image to be used as a brush
  keepCleared: true,     // Put the blur back after user has cleared it
  stroke: 80,            // Stroke size for the brush
  lineStyle: 'round',    // Brush style (round, square, butt)
  autoBlur: false,       // Brusher will use the provided image for the blurry background
  autoBlurValue: 15,     // Blur strength in pixels
});

brusher.init();

A note on blurry background: although brusher is capable of generating blurry background by itself, it is recommended that you blur the image yourself and apply it to the body for improved performance. Brusher relies on CSS blur for the background. And rendering performance for the pre-provided blurred image would be of-cource much better than that applied using CSS. Here is the sample CSS that you may use for the background

body {
  background-size: cover;
  background-position: 0 0;
  background-attachment: fixed;
  background-image: url(path/to/blurred/image.jpg);
}

License

MIT © Kamran Ahmed

brusher's People

Contributors

kamranahmedse avatar ztickm avatar

Watchers

Mac Chic avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.