Git Product home page Git Product logo

jquery-dom-line's Introduction

jQuery DOM Line

Draw a line between any two arbitrary points, using a simple DOM element.

Full documentation and examples available at http://gilmoreorless.github.io/jquery-dom-line/

Requirements

Usage

$.line(fromPoint, toPoint[, options]);

fromPoint and toPoint are required objects with x and y numeric properties, relative to the top left of the page. options is an optional object, as listed below.

Return value is a jQuery object containing the element used for the line.

Options

The options object passed to $.line is an object with the following available properties:

  • elem - jQuery selector of the element to use for the line, useful for re-using a single element for subsequent lines (default: empty - creates a new div)
  • className - CSS class added to the line div element (default: "jquery-line") - not used if elem option is provided
  • lineWidth - Thickness of the line in pixels (default: 1)
  • lineColor - CSS color of the line (default: black)
  • returnValues - If true, returns an object with the calculated dimensions for the line (see below), instead of a jQuery object (default: false)

Return Values

If the returnValues option is set to true, a plain object is returned with the following defined properties:

  • from - The fromPoint argument passed to the function
  • to - The toPoint argument passed to the function
  • center - The centre point of the line (and also the point of rotation) - contains x and y properties
  • rotation - The amount of rotation applied to the line - contains deg (degrees) and rad (radians) properties

Todo List

  • Add option to calculate CSS props without creating the line elem - can be used for animation positions

jquery-dom-line's People

Contributors

anthonyzou avatar gilmoreorless avatar

Watchers

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