Giter Site home page Giter Site logo

ustymukhman / imagedrawer.js Goto Github PK

View Code? Open in Web Editor NEW
12.0 3.0 2.0 12.32 MB

:pencil2: A jQuery plugin to animate a drawing image :art:

Home Page: http://35.158.218.205/experiments/ImageDrawer

License: MIT License

CSS 27.91% JavaScript 65.91% HTML 6.17%
jquery jquery-plugin draw picture animation

imagedrawer.js's Introduction

A jQuery plugin to animate a drawing image

ImageDrawer.js build ImageDrawer.js release Bower version GitHub license

ImageDrawer.js is a simple plugin for jQuery with CSS animations which can be called as described below to imitate an accelerated drawn image.
The drawing process is made of two parts: the first one defines all image borders by using "a black pencil" and the second one draws all the colors to the picture.

Demo

You can try ImageDrawer.js here.

Download

To download the full plugin just click here or install it from bower:

bower install UstymUkhman/ImageDrawer.js

Requirements

Usage

First, you have to include both, JavaScript and CSS files in your project:

<head>
  <script type="text/javascript" src="http://code.jquery.com/jquery-1.12.0.min.js"></script>
  <script type="text/javascript" src="js/imagedrawer.js"></script>

  <link rel="stylesheet" type="text/css" href="css/imagedrawer.css" />
</head>

or minified versions of those files

<head>
  <script type="text/javascript" src="http://code.jquery.com/jquery-1.12.0.min.js"></script>
  <script type="text/javascript" src="js/imagedrawer.min.js"></script>

  <link rel="stylesheet" type="text/css" href="css/imagedrawer.min.css" />
</head>

Once that is done, to actually use the plugin, you have to call .drawImge() function by selecting the parent element of the picture you want to draw and pass the options object.
So let's suppose we have this is our HTML:

<body>
  <div id="container">
  	<img id="imageto-draw" src="./img/myImage.jpg" />
  </div>
</body>

So, the JS part would be like this:

$('#container').drawImge(options);

The variable options is just an object which may contain all or some of this parameters:

duration: drawing time for the whole animation or for each step of it, expressed in seconds
background: color to put on the picture while it's been drawing
callback: function to call once the painting is over

pencil: object of options for a drawing pencil image
width: pencil image width
height: pencil image height
marginTop: pencil image top margin on the picture
marginLeft: pencil image left margin on the picture

disappear: seconds it's take to make the pencil disappear once the drawing is finished
fromBottom: start drawing from the bottom of the picture
invertAxis: draw image vertically
src: path to pencil's image

You can check options' description and their data types here or visit the demo page and try to configure them by yourself.

License

ImageDrawer.js is licensed under the MIT license.

imagedrawer.js's People

Contributors

ustymukhman avatar acrossbinary avatar

Stargazers

PlatformKit avatar Iacopo Ciao avatar Komo avatar Marcos Sader avatar  avatar  avatar marco pretelli avatar charlie avatar Ming avatar yefan avatar simon.du avatar Miki Lombardi avatar

Watchers

James Cloos avatar  avatar  avatar

Forkers

wylkl00 3dhead

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.