Skip to content

Instantly share code, notes, and snippets.

@Amimul100
Created July 2, 2014 09:37
Show Gist options
  • Save Amimul100/710993e15480ced4e56a to your computer and use it in GitHub Desktop.
Save Amimul100/710993e15480ced4e56a to your computer and use it in GitHub Desktop.
2DMatrix in Titanium
/*
Hi, I have tested this issue in Ti SDK 3.3.0.RC. It’s working good.
Testing Environment:
Titanium SDK: 3.3.0.RC, 3.2.3.GA
Titanium CLI: 3.2.3
Android and iOS device
Appcelerator Studio, build: 3.3.0.201406271159
Step to Reproduce
Create a sample Ti Classic project from AppC Studio
Update app.js file with test code
Run on Android and iOS device
Click the animate button to see 2D animation
*/
var win = Ti.UI.createWindow({
backgroundColor: 'white'
});
var label = Ti.UI.createLabel({
font:{fontSize:50},
text:'Titanium',
textAlign:'center',
top: 100
});
win.add(label);
var button = Ti.UI.createButton({
title:'Animate',
bottom:20,
width:200, height:40
});
win.add(button);
button.addEventListener('click', function(){
var t1 = Ti.UI.create2DMatrix();
t1 = t1.translate(0, 300);
var a1 = Ti.UI.createAnimation();
a1.transform = t1;
a1.duration = 800;
label.animate(a1);
});
win.open();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment