Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-2508] iPhone animation resets to center on each execution

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionFixed
Resolution Date2011-04-17T01:59:18.000+0000
Affected Version/sn/a
Fix Version/sRelease 1.6.0 M07
ComponentsiOS
Labelsdefect, ios, iphone, release-1.6.0
ReporterKevin Whinnery
AssigneeReggie Seagraves
Created2011-04-15T03:21:31.000+0000
Updated2011-04-17T01:59:18.000+0000

Description

The following animation technique is broken in the current 1.5 continuous builds. Verified on iOS. http://developer.appcelerator.com/question/86311/ios---sdk-150---imageview-resets-to-center-before-animating"> Community question Attached movie showing behavior:

Titanium.UI.setBackgroundColor('#000');

var win = Titanium.UI.createWindow({  
    title:'Window',
    backgroundColor:'#fff',
    backButtonName:'Back'
});

var imageView=Ti.UI.createImageView({
    image:'default_app_logo.png',
    zIndex:1
});

var moveImageOneSecButton=Ti.UI.createButton({
    title:'Move: Duration 1 Sec',
    top: 10,
    width:200,
    height:40,
    zIndex:2
});

moveImageOneSecButton.addEventListener('click', function(){
        var newX=imageView.center.x + 10;
        var newY=imageView.center.y + 10;
        imageView.animate({
            center: {
                x: newX,
                y: newY
            },
            duration: 1000
        });
        imageView.center.x=newX;
        imageView.center.y=newY;
});

var moveImageOneMilliButton=Ti.UI.createButton({
    title:'Move: Duration 1 millisec',
    top: 60,
    width:200,
    height:40,
    zIndex:2
});

moveImageOneMilliButton.addEventListener('click', function(){
        var newX=imageView.center.x + 10;
        var newY=imageView.center.y + 10;
        imageView.animate({
            center: {
                x: newX,
                y: newY
            },
            duration: 1
        });

});

var resetImageButton=Ti.UI.createButton({
    title:'Reset Image',
    top: 110,
    width:200,
    height:40,
    zIndex:2
});

resetImageButton.addEventListener('click', function(){
        var newX=win.center.x;
        var newY=win.center.y;
        imageView.animate({
            center: {
                x: newX,
                y: newY
            },
            duration: 1
        });

});

win.add(imageView);
win.add(moveImageOneSecButton);
win.add(moveImageOneMilliButton);
win.add(resetImageButton);

win.open();

Attachments

FileDateSize
export_20101206-101018.mov2011-04-15T03:21:32.000+00002400339

Comments

  1. Blain Hamon 2011-04-15

    Code is being checked in, but part of the issue is that the current iphone spec ignores x and y when width or height is missing. The animation was still using x and y, against the spec, and the layout was honoring the spec, setting things fullscreen.

    Short version: After the code checkin, the animation will work, but you MUST specify a width and height to the view, even if it's 'auto' or a percentage.

  2. Jeff Haynie 2011-04-15

    (from [83683409c6e93e0977241a2fb5ca9229220ed902]) [#2508 state:fixed-in-qa] Center is properly stored into the proxy's layoutProperties, which makes animation correct https://github.com/appcelerator/titanium_mobile/commit/83683409c6e93e0977241a2fb5ca9229220ed902"> https://github.com/appcelerator/titanium_mobile/commit/83683409c6e9...

  3. Alan Leard 2011-04-15

    Successful iOS Simulator, iOS Device, and Android Emulator test on 01/26/2011

    • iOS Simulator Results: animates properly
    • iPhone Results: animates properly
    • Emulator Results: animates properly

    Mobile SDK version: 1.6.0 (01/25/11 13:33 1f1dd51...)

    Device/Version: iPhone 4 / 4.2.1

    Simulator Version: 4.2 (235)

    Emulator SDK: APIs 2.1

  4. Nikolai Derzhak 2011-04-15

    rollback wrong update

JSON Source