Plugin month - triangles

The triangles plugin

I've written a few jQuery plugins recently, so this is going to turn into a bit of a plugin month. First up, a very pretty but fairly useless mouse/tilting device effect, using triangles.

This plugin very simply allows you to designate an area on a page within which the effect will occur and generate a trail of triangles within the element that follow the mouse. Or, if you're using a phone or a tablet, the trail of triangles will roll around depending on the orientation and angle of the device. It's easier to observe than explain. Move your mouse over the below, or tip your device if you're on a tablet.

Neat, huh? It works by drawing triangles on a HTML5 canvas based on the mouse position, or as we in the web industry like to call it, 'well obviously'. There's not a lot to explain, really. It does have a few options for controlling the triangle size and colour, you can have multiple instances of it on a page and you can also have other elements partially obscure the canvas but still have the effect working. It's also responsive, whoo.

I wrote this plugin for the new Tangent Snowball website, where it's used to good effect.

Details and code are on my github page as usual.


This article is tagged with