GithubHelp home page GithubHelp logo

michaelquiapos / path.animator Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tonylukasavage/path.animator

0.0 2.0 0.0 87 KB

Appcelerator Titanium iOS module that uses CABasicAnimations to add full rotations to views

License: Other

path.animator's Introduction

path.animator by @tonylukasavage

A simple Appcelerator Titanium iOS module for adding CABasicAnimation rotations to standard Titanium Views.

Why?

iOS transforms are specified as matrices. These matrices are the result of trigonometric calculations, which results in a limitation in the range of values you can specify for rotation values. For example, on iOS, the transforms can't make distinction between a rotation of 180 degrees or 0 degrees. The matrix values are the same.

Android does not have this limitation. This is not a result of how Titanium implements these features, it is a limitation of iOS. A quick google search will show that native developers have issues with this as well.

In order to work around iOS's limitations, this module uses the more powerful CABasicAnimation class to perform more advanced animations. The only one we will be leveraging in this module, as this module is specific to the pathmenu.js project, is the ability to support rotations greater than 180 degrees, just like Android can already do.

How?

Check out the exmaple/app.js for usage. In case you are too lazy to look...

var window = Ti.UI.createWindow({
    backgroundColor:'white'
});

var my_module = require('path.animator');
var foo = my_module.createView({
  	backgroundColor: '#f00',
  	width: 100,
  	height: 100
});

var image = Ti.UI.createImageView({
	image: 'http://appcodingeasy.com/cms.design/images/appcelerator.png',
  	width: 100,
  	height: 100
});
foo.add(image);


foo.addEventListener('click', function() {
	foo.rotate({
		angle: 720,
		duration: 3000,
		delay: 1000,
		timingFunction: Ti.UI.iOS.ANIMATION_CURVE_EASE_OUT
	});
});
 
window.add(foo);
window.open();

Be sure to add the module entry in tiapp.xml in your own project:

<modules>
    <module platform="iphone" version="1.0">path.animator</module>
</modules>

Problems?

Leave an issue in the Issues section of this project. Be as specific as possible. Please include the following information:

  • Titanium SDK version
  • Target platform (better be iOS!)
  • Any relevant code
  • A test case

HINT: If you provide a repeatable test case, your issue goes right to the top of my todo list.

path.animator's People

Contributors

tonylukasavage avatar

Watchers

Mike Q. avatar James Cloos 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.