Giter Club home page Giter Club logo

path-to-animation's Introduction

path-to-animation

synopsis

This module is meant to do only one thing - having an object of paths as an input and returning a generated @keyframes and css classes output.

This tool is free of automated task runners like gulp and grunt. You could use it in your nodejs project without setting automated tools.

Why would you need this?

  • Do you want to have smooth css animations you don't want to handle by java script?
  • Do you need to pause them?
  • Do you need to resize and keep the animated element's position?
  • Do you want to write such animation manually? And rewrite them every time the client changes the design?
  • Animations using translate instead of top/left positioning are considered as better performance and calculating translate movement manually could be painfully sometimes.

path-to-animation needs just an object containing animations paths you would need and it will interpolate them and generate predefined @keyframes animations you need in a string.

usage

var pathToAnimation = require('path-to-animation');

var generatedCssContent = pathToAnimation.generateCss(
	arrayOfPaths,
	namespace,
	elementWidth,
	elementHeight
	[, sassMixin]
);

pathToAnimation.generateCss(arguments)

return:

  • Description: Generated css content
  • Type: String
  • Example:
@keyframes namespace-name-animation1 {
	0% { transform: translate(0%, 0%); }
	100% { transform: translate(100.00%, 100.00%); }
}

.animated-namespace-name-animation1 {
	@include curved-animation(namespace-name-animation1);
}

arguments:

path

  • Description: The object containing the animation paths. This array will be interpolated.
  • Type: Object
  • Example:
{
	// the array with the animation points could be flat: [x, y, x, y]
	"animation1" : [100, 100, 200, 200],
	
	// it could be nested path as well: [[x,y], [x,y]]
	"animation2": [ [100,100], [200,200] ]
}

namespace

  • Description: The namespace is used to generate the @keyframes and css class name
  • Type: String

elementWidth

  • Description: Animated element's width. It's needed in order to calculate the path related to its size in percentages.
  • Type: Number|String

elementHeight

  • Description: Animated element's height. It's needed in order to calculate the path related to its size in percentages.
  • Type: Number|String

sassMixin

  • Description: The name of the sass mixin to be used for the generated css class.
  • optional
  • Type: String
  • Default: curved-animation

Dependancies

We depend on SASS. We expect the developers to use SASS in the project they plan to use path-to-animation

We will generate sass content and you will be able to save it into your project. We expect you to have defined sass mixin which name you could provide via the arguments described above. The default is mixin name is curved-animation.

Test

In order to asure everything works as expected, run:

npm install
npm test

Other tools:

Changelog

  • 0.1.1 - Synchronize version numbers between the path-to-animation modules
  • 0.0.1 - Initial version

Contributions

If you have any suggestions or the tool doesn't cover your needs, don't hasitate to fork us or send us an email [email protected]. Every comment or contribution will be very appreciated.

MIT License

Copyright (c) 2016 Mobile Wave Solutions ([email protected])

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

path-to-animation's People

Contributors

ibetovski avatar nedjalko avatar

Stargazers

 avatar

Watchers

James Cloos 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.