Giter Club home page Giter Club logo

weave's Introduction

weave

weave.js is a JavaScript library for drawing a weave pattern on HTML5 Canvas.

QuickSettings Panel

You create a Weave object with:

var weave = Weave.create(tileSize, bandSize);

The bandSize is the width of the strip of material that is woven in both directions. The tileSize is the distance between the center of two bands.

You can immediately render the weave to an HTML5 Canvas with:

weave.render(context, x, y, width, height);

This is simply the 2d rendering context you are drawing to and the rectangular area that you are filling with a weave.

Properties that control how the weave is drawn:

	fillStyle       // the fill color of the bands
	strokeStyle     // the stroke color of the bands.
	lineWidth       // the size of the stroke.
	drawFill        // should the bands be drawn with a fill?
	drawStroke      // should the bands be drawn with a stroke?
	shadowColor     // shadow color, obvious.
	shadowOffsetX   // totally obvious.
	shadowOffsetY   // painfully obvious.
	shadowBlur      // mostly obvious, but can be set to "auto".

The only thing that really needs a comment here is the shadow blur. Because the weave is drawn as discreet tiles, if the blur extends off of the edge of a tile, you'll wind up with a hard edge, rather than a smooth blur. Setting shadowBlur to "auto" calculates the blur size so this won't happen, at least if the offset x and y are 0. Feel free to override this, as long as you're happy with the results.

demo

(uses QuickSettings https://github.com/bit101/quicksettings)

http://htmlpreview.github.io/?https://github.com/bit101/weave/blob/master/demos/demo.html

weave's People

Contributors

bit101 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.