Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-9195] Android: imageView Rotation always starts over from 0 degrees

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionInvalid
Resolution Date2012-05-24T09:48:36.000+0000
Affected Version/sRelease 1.7.6, Release 2.1.0, Release 1.8.2, Release 2.0.1
Fix Version/sn/a
ComponentsAndroid
Labelsapi, parity
ReporterFederico Casali
AssigneeNeeraj Gupta
Created2012-05-22T14:59:12.000+0000
Updated2012-05-24T10:28:07.000+0000

Description

Problem description

Animating an imageView on Android with a rotation. Each time the imageView animation is triggered, it starts over from 0 instead of going on from the last position. On iOS it works continually as expected.

Sample code (imageView file in attachment)

var win = Ti.UI.createWindow({
    backgroundColor : 'gray'
});

var iv = Ti.UI.createImageView({
    image : '/images/circ.png',
    top : 100 - 480
});

var gTrans = Ti.UI.create2DMatrix();

win.add(iv);

var btn = Ti.UI.createButton({
    title : 'amin it',
    top : 400
});

btn.addEventListener('click', function() {
    gTrans = gTrans.rotate(20);
    var a = Ti.UI.createAnimation({
        duration : 1000
    });
    a.transform = gTrans;
    iv.animate(a);
});
win.add(btn);

win.open();

Customer ticket

http://support-admin.appcelerator.com/display/APP-563796

Attachments

FileDateSize
animation.zip2012-05-22T15:00:09.000+0000775955

Comments

  1. Neeraj Gupta 2012-05-24

    Refer to Android platform notes in http://developer.appcelerator.com/apidoc/mobile/latest/Titanium.UI.Animation-object and http://developer.appcelerator.com/apidoc/mobile/latest/Titanium.UI.2DMatrix.rotate-method-1.html Android supports 2D matrix transformations. Note that the 2DMatrix.rotate method operates differently on Android. Called with a single argument, it rotates from zero to the specified angle. That is, it ignores any existing rotation. Called with two arguments, it interprets the first argument as a "from" angle and the second argument as a "to" angle.

JSON Source