Skip to content

joestrong/triangle-background

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

63 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Triangle Background

Creates a tessellating triangle background for your web page, with rollover highlight effect

Demo

Usage

new TriangleBackground(
    containerElement,    // A DOM element, or CSS selector
    options              // Object containing options
);

Option Reference

options: {
    color: [],                   // Specify the colours to use for the triangles, must be an array of hexadecimal style colours, defaults to a selection of greys
    mouseHoverHighlight: {       // Options for the hover highlight effect, replace with false to disable
        color: '#ffffff'         // Hover highlight colour in hex format (default '#ffffff')
        radius: 100              // Hover highlight radius (default 100)
    }
}

Installing

With NPM

npm install --save triangle-background

Without NPM

Download and extract the latest zip file into your project: https://github.com/joestrong/triangle-background/releases

Getting Started

With Browserify

var TriangleBackground = require('triangle-background');

new TriangleBackground('#background');

Without Browserify

<!doctype html>
<html>
<body>
<div id="background"></div>
<script src="node_modules/triangle-background/dist/triangle-background.min.js"></script>
<script>
    new TriangleBackground('#background');
</script>
</body>
</html>

Notes

As the background DOM element will be given position fixed, other elements will need to be positioned (e.g. relative) to appear above the background.

About

Creates interactive web page background of tesselating triangles using HTML Canvas

Resources

License

Stars

Watchers

Forks

Packages

No packages published