Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-24193] iOS: Chained transform is reset on animation

GitHub Issuen/a
TypeBug
PriorityHigh
StatusResolved
ResolutionHold
Resolution Date2017-02-08T00:49:25.000+0000
Affected Version/sRelease 6.0.0, Release 5.5.1
Fix Version/sn/a
ComponentsiOS
Labelsanimation, ios, transform
ReporterIvan Markovic
AssigneeVijay Singh
Created2016-12-04T15:44:20.000+0000
Updated2017-03-10T16:46:47.000+0000

Description

If you apply a transform to a view and subsequently animate that view with a compound transform (a translate & scale or a translate and rotate) it starts the animation from the default transform and NOT from the current transform. This works if you just use translates and do not have a compound transform. Here is a simple example:
var win = Ti.UI.createWindow({
    backgroundColor: '#fff'
});

var view1 = Ti.UI.createView({
    transform: Ti.UI.create2DMatrix().translate(100, 200),
    width: 50,
    height: 50,
    left: 0,
    top: 0,
    backgroundColor: 'blue'
});
win.add(view1);

var view2 = Ti.UI.createView({
    transform: Ti.UI.create2DMatrix().translate(100, 200),
    width: 50,
    height: 50,
    left: 0,
    top: 0,
    backgroundColor: 'green'
});
win.add(view2);

var btn = Ti.UI.createButton({
    title: 'Trigger Animation'
});

btn.addEventListener('click', function() {
	var rotation = Ti.UI.create2DMatrix().translate(200, 200).rotate(33);
	view2.animate({ 
	    transform: rotation,
	    duration: 5000
	});

});

win.add(btn);
win.open();

Attachments

FileDateSize
TestAnimation.zip2017-01-18T11:25:13.000+000061152

Comments

  1. Ivan Markovic 2016-12-11

    Chee, any movement on this issue? It's pretty much an App-halter for me. Is someone looking into this and if so when do you think a fix might be included in a release?
  2. Chee Kiat Ng 2016-12-27

    Sorry we haven't had a chance to look into this in detail. But just to be clear, is it necessary to have the transform property in createView? in this example, I'm sure putting left: 100, top: 200 and omitting the transform property, it'll work correctly?
  3. Ivan Markovic 2016-12-27

    Chee, that won't work I am afraid. The idea is for a floating window that the user moves around, for that to work you have to animate on the transform otherwise it's very jerky. So at the end of the movement when they close it you need to perform the close transform and that is where the problem is. The problem also occurs then, when you subsequently open the window with the existing transform. But the main issue is when you close the window. I did try to set the left and right and the transform to the default just before the close but you get the window moving all over the place! I spent a LOT of time attempting to find a workaround for this, sadly it's just not something I could find a workable solution to. I really hope we can get this wrapped up into a release sooner rather than later; thanks.
  4. Ivan Markovic 2017-01-03

    Chee, any thoughts on this? It's a bit of a showstopper for me... thanks
  5. Vijay Singh 2017-01-18

    I have attached a native iOS app in swift with same use case as mentioned in this ticket. Native app and Titanium app have same behavior. So in my view this is not an issue and expected behavior.
  6. Ivan Markovic 2017-01-18

    Vijay, okay that is strange... I am not sure how developers achieve some of their UI behaviour. They must be coding around this limitation because it's quite limiting as it stands. So it's not a bug, but it's a limitation. Can we make it a feature request? It's killing me at the moment!
  7. Eric Merriman 2017-01-19

    Hello [~imarkovi] Sorry to say, but our general policy is that we avoid trying to develop behavior that doesn't exist on the native platform. This extends as well to parity between the mobile platforms. At one time we would try to implement features across all supported platforms, if they existed or not. As an example, this is why there are tab groups on Android devices. What we have found however is that this approach was very problematic and fragile over time. This caused us to spend much time to maintain these features, and less time fixing issues and implementing new features. For now we can put this on hold if you want, but I would not plan for much, if any movement on it any time soon.

JSON Source