Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-16596] Android: Animation anchorPoints not working

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionFixed
Resolution Date2018-05-07T21:20:13.000+0000
Affected Version/sRelease 3.2.1
Fix Version/sRelease 7.3.0
ComponentsAndroid
Labelsandroid, animation, reprod
ReporterRonnie Swietek
AssigneeYordan Banev
Created2014-03-04T22:32:20.000+0000
Updated2018-06-14T19:26:53.000+0000

Description

The animation anchor points are no longer working for android as of SDK 3.2.0. The demo in the docs doesn't even work. Here is the code you can use to test (copied from docs)
 
var animationType = [
  { name: 'Top Left', anchorPoint: {x:0, y:0} },
  { name: 'Top Right', anchorPoint: {x:1, y:0} },
  { name: 'Bottom Left', anchorPoint: {x:0, y:1} },
  { name: 'Bottom Right', anchorPoint: {x:1, y:1} },
  { name: 'Center', anchorPoint: {x:0.5, y:0.5} }
];
var animationTypeLength = animationType.length;
var animationCount = 0;
var animationTypePointer = 0;

var t = Ti.UI.create2DMatrix();
t = t.rotate(90);

// animation properties
var a = {
  transform: t,
  duration: 2000,
  autoreverse: true
};

Ti.UI.backgroundColor = 'white';
var win = Ti.UI.createWindow();

var view = Ti.UI.createView({
  backgroundColor:'#336699',
  width:100, height:100
});
win.add(view);

var button = Ti.UI.createButton({
  title:'Animate ' + animationType[animationTypePointer].name,
  height: (Ti.UI.Android) ? 80 : 40,
  width: (Ti.UI.Android) ? 300 : 200,
  top:30
});
win.add(button);

function updateButton(name){
  button.title = 'Animate ' + name;
}

button.addEventListener('click', function(){
  // set new anchorPoint on animation for Android
  a.anchorPoint = animationType[animationTypePointer].anchorPoint;
  
  // set new anchorPoint on view for iOS
  view.anchorPoint = animationType[animationTypePointer].anchorPoint;
  
  animationCount++;
  
  // determine position of next object in animationType array or return to first item
  // using modulus operator
  animationTypePointer = animationCount % animationTypeLength;
  
  // animate view, followed by callback to set next button title
  view.animate(a, function(){
    updateButton(animationType[animationTypePointer].name);
  });
});

win.open();
When I test, it only animated from its center point. I noticed that it works in SDK 3.1.3 but is broken as of 3.2.0

Comments

  1. Ritu Agrawal 2014-03-10

    Moving this ticket to engineering as I can reproduce this issue on Android device easily. Same code works fine on iOS platform.
  2. Be Rushton 2014-11-18

    Hoping for a fix on this issue soon.
  3. Lee Morris 2017-07-05

    I am able to reproduce this issue with the following environment; Pixel (7.1) Studio 4.9.0.201705302345 Ti SDK 6.1.1 GA Appc NPM 4.2.9 Appc CLI 6.2.2 Ti CLI 5.0.14 Alloy 1.9.11 Xcode 8.2 (8C38) Node v4.8.2 Java 1.8.0_131
  4. Yordan Banev 2018-04-19

    PR: https://github.com/appcelerator/titanium_mobile/pull/10007
  5. Lokesh Choudhary 2018-05-07

    FR Passed. Waiting for merge to be enabled.
  6. Lokesh Choudhary 2018-05-07

    PR Merged.
  7. Samir Mohammed 2018-06-14

    Closing ticket. Fix can be seen in SDK Version: 7.3.0.v20180613110103 Test and other information can be found at: https://github.com/appcelerator/titanium_mobile/pull/10007

JSON Source