{ "id": "172658", "key": "TIMOB-26590", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "19882", "name": "Release 8.0.0", "archived": false, "released": true, "releaseDate": "2019-03-14" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2018-11-29T14:39:40.000+0000", "created": "2018-11-22T05:08:14.000+0000", "priority": { "name": "Low", "id": "4" }, "labels": [ "animation", "ios", "rotation" ], "versions": [], "issuelinks": [], "assignee": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2018-11-30T12:21:56.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "*Summary:*\r\nWhen attempting to rotate a view via an animation set to {{-180}}, it will wrongly rotate clockwise instead of counter-clockwise. Only {{180}} should rotate clockwise.\r\n\r\nAlso, when setting up animation property \"autoreverse\" to {{true} and with a rotation of {{180}}, the initial animation will correctly rotate clockwise, but incorrectly autoreverse clockwise as well (doing a 360) instead of rotating backwards counter-clockwise. If \"repeat\" is set, then this autoreverse rotation bug will only happen on the final rotation. All of the other auto-reversed rotation will rotate in the correct direction.\r\n\r\nThis is not an issue on Android. This is only an iOS issue.\r\n\r\n*Steps to reproduce:*\r\n# Build and run the below code on iOS.\r\n# Note that blue square rotate clockwise instead of counter-clockwise.\r\n\r\n{code:javascript}\r\nvar SQUARE_SIZE = 160;\r\nvar window = Ti.UI.createWindow({\r\n\tbackgroundColor: \"white\",\r\n\tfullscreen: true,\r\n});\r\nvar squareView = Ti.UI.createLabel({\r\n\ttext: \"Test\",\r\n\ttextAlign: Ti.UI.TEXT_ALIGNMENT_CENTER,\r\n\tcolor: \"white\",\r\n\tbackgroundColor: \"blue\",\r\n\twidth: SQUARE_SIZE,\r\n\theight: SQUARE_SIZE,\r\n});\r\nwindow.add(squareView);\r\nwindow.addEventListener(\"postlayout\", function onLayout() {\r\n\twindow.removeEventListener(\"postlayout\", onLayout);\r\n\tvar animation = Ti.UI.createAnimation({\r\n\t\ttransform: Ti.UI.create2DMatrix().rotate(-180),\r\n//\t\ttransform: Ti.UI.create2DMatrix().rotate(180),\r\n\t\tduration: 2000,\r\n\t\tautoreverse: true,\r\n//\t\trepeat: 2,\r\n\t});\r\n\tsquareView.animate(animation);\r\n});\r\nwindow.open();\r\n{code}\r\n\r\n*Note:*\r\nThis is an issue on Apple's end. Their animation feature will always take the shortest route to the animation's destination. Since the rotation range is -180 to 180 on iOS, this becomes a boundary issue and iOS will always choose to rotate clockwise instead of counter-clockwise.\r\n\r\n*Work-around:*\r\nInstead of setting rotation to {{-180}}, set it to {{-180 + 0.01}} instead. This makes counter-clockwise the shortest route. This appear to be the only solution natively as well when using a transformation matrix for rotation.\r\n", "attachment": [], "flagged": false, "summary": "iOS: Animation never rotates counter-clockwise when set to -180 degrees", "creator": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "443830", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "PR (master): https://github.com/appcelerator/titanium_mobile/pull/10486", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-11-22T05:38:48.000+0000", "updated": "2018-11-22T05:38:48.000+0000" }, { "id": "444093", "author": { "name": "smohammed", "key": "smohammed", "displayName": "Samir Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "body": "*Closing ticket*. Fix verified in SDK Version {{8.0.0.v20181129161342}}.\r\n\r\nTest and other information can be found at: \r\nhttps://github.com/appcelerator/titanium_mobile/pull/10486", "updateAuthor": { "name": "smohammed", "key": "smohammed", "displayName": "Samir Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-11-30T12:21:49.000+0000", "updated": "2018-11-30T12:21:49.000+0000" } ], "maxResults": 2, "total": 2, "startAt": 0 } } }