Git Product home page Git Product logo

animator's Introduction

#Animator: Animator is a helper class to ease your mind when working with animations on Titanium.

##Usage: In your app.js (or elsewhere), call:

// Load the animator helper
var Animator = require("Animator");

Now that you have the module initialised you can call one of these animation functions:

  • scale: increases or decreases the size of the view
  • rotate: rotates the view
  • fade: changes the opacity of the view
  • flip: flips the view (horizontally if nothing is passed)
  • moveTo: moves the view in the X and Y coordinates
  • sizeTo: resizing and positioning the view through width, height, bottom, top, left and right
  • backgroundColor: changes the backgroundColor of the view with fading effect
  • shake: shake a view like the code dots on the iOS passcode screen

Let's for example scale a window to 80% of its size

// Load the animator helper
new Animator().scale({ view: window, value: 0.8, duration: 500 }); 

##Helpers inside the helper

Queuing animations can be a pain. That is why you can also find two specials methods called:

  • sequence: uses an array of animations and queues them one after the other
  • parallel: uses an array of animations and runs them all at once

Let's do a quick example

// do a bunch of animations one after the other	
new Animator().sequence([
{ 
	type: "scale", 
	view: pink, 
	value: 1.5, 
	duration: 500 }, 
{ 
	type: "rotate", 
	view: pink, 
	value: 57, 
	duration: 500 } ,
{ 
	type: "fade", 
	view: blue, 
	value: 0.8, 
	duration: 500 } ,
{ 
	type: "moveTo", 
	view: pink, 
	value: {x: 0, y: 200 }, 
	duration: 500 }, 
]);

Without the sequence method, achieving the same result without the previous code will be a nesting nightmare.

##More examples For more information check out the examples.js file. Or browse around the Animator.js file.

##About: Created by Raul Riera, @raulriera

animator's People

Contributors

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