Re: Servicing Core Animations?

2008-07-14 Thread Jens Alfke


On 14 Jul '08, at 11:52 AM, Bill Dudney wrote:

You can of course override this but in the example below you are  
doing the animation yourself so there is no reason for CA. i.e.  
tracking mouse movements is not something you want to do with CA  
animations anyway.


It's fine to use CA while tracking mouse movements — that's how you  
let the user drag a layer around. But you should disable animations on  
that layer while doing so, at least on the 'position' property, as the  
animations are really counterproductive. They cause the layer to lag  
behind the mouse.


My GeekGameBoard sample code shows how to do this. Look at the  
BoardView class.



—Jens

smime.p7s
Description: S/MIME cryptographic signature
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Re: Servicing Core Animations?

2008-07-14 Thread Bill Dudney

Hi Chilton,

The animator does not commit its transaction until back in the event  
loop so you won't see any animation until you return to the main event  
loop.


You can of course override this but in the example below you are doing  
the animation yourself so there is no reason for CA. i.e. tracking  
mouse movements is not something you want to do with CA animations  
anyway.


HTH,

-bd-
http://bill.dudney.net/roller/objc

On Jul 12, 2008, at 4:54 PM, Chilton Webb wrote:


Hi Professor Savant,

Confirmation that it should work was what I was after, so after  
reading your email, I decided to write up a test app, and it happens  
there, too. This is the problem distilled to its simplest form. I  
welcome any feedback, mockery, etc.


If I use the option in (1) below, it works fine. If I use the option  
in (2), which is what I WANT to use, no animation occurs until after  
the mouseup happens.


-Chilton

- (void) mouseDown: (NSEvent *) theEvent
{
while (1) {

   theEvent = [[self window] nextEventMatchingMask: 
(NSAnyEventMask)];

if (([theEvent type]==NSLeftMouseDragged) ||
([theEvent type]==NSLeftMouseUp) ||
([theEvent type]==NSLeftMouseDown))
{


// (1) If I use this, it works fine. No zooom zooom 
though.
//[button setFrameOrigin:[theEvent locationInWindow]];

// (2) If I use this, it doesn't work.
//[[button animator] setFrameOrigin:[theEvent 
locationInWindow]];

if ([theEvent type]==NSLeftMouseUp) {
break;
}
}

}

}


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/bdudney%40mac.com

This email sent to [EMAIL PROTECTED]


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Servicing Core Animations?

2008-07-13 Thread I. Savant

 I welcome any feedback, mockery, etc.


  Feedback I can give, mockery requires creativity which I'm fresh  
out of today ... long day yesterday. ;-)


If I use the option in (1) below, it works fine. If I use the option  
in (2), which is what I WANT to use, no animation occurs until after  
the mouseup happens.


  Okay, I can't say for sure (because I've not done what you're  
doing), but short-circuiting the run loop in this way can have some  
strange (though not altogether unexpected) side-effects.


  What happens if you use -mouseDragged: via the "three-method"  
approach below? That is, update the position of your button *once* on - 
mouseDown: and *once* on -mouseDragged:?


  The three-method approach:

http://developer.apple.com/documentation/Cocoa/Conceptual/EventOverview/HandlingMouseEvents/chapter_5_section_4.html#/ 
/apple_ref/doc/uid/1060i-CH6-SW3


  I suspect the animation machinery will work as expected but I could  
be wrong. :-) I still have yet to do anything fancy with it.


--
I.S.


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Servicing Core Animations?

2008-07-12 Thread Chilton Webb
Hi Professor Savant,

Confirmation that it should work was what I was after, so after reading your 
email, I decided to write up a test app, and it happens there, too. This is the 
problem distilled to its simplest form. I welcome any feedback, mockery, etc.

If I use the option in (1) below, it works fine. If I use the option in (2), 
which is what I WANT to use, no animation occurs until after the mouseup 
happens.

-Chilton

- (void) mouseDown: (NSEvent *) theEvent
{
while (1) {

theEvent = [[self window] nextEventMatchingMask:(NSAnyEventMask)];
if (([theEvent type]==NSLeftMouseDragged) || 
([theEvent type]==NSLeftMouseUp) || 
([theEvent type]==NSLeftMouseDown))
{


// (1) If I use this, it works fine. No zooom zooom 
though.
//[button setFrameOrigin:[theEvent locationInWindow]];

// (2) If I use this, it doesn't work.
//[[button animator] setFrameOrigin:[theEvent 
locationInWindow]];

if ([theEvent type]==NSLeftMouseUp) {
break;
}
}

}

}


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Servicing Core Animations?

2008-07-12 Thread I. Savant
I have a core animation layer backed view that doesn't animate. It  
only happens to not animate during mousedown events. Is there  
something I have to do to make it work, or is it likely I'm short  
circuiting something, somewhere?


  Hard to say with what you've provided. Do you have custom - 
mouse...: methods in your view? If so, post your code.


--
I.S.


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Servicing Core Animations?

2008-07-12 Thread Chilton Webb
Hi,

I have a core animation layer backed view that doesn't animate. It only happens 
to not animate during mousedown events. Is there something I have to do to make 
it work, or is it likely I'm short circuiting something, somewhere?

It doesn't animate, or move at all. But when I release the mouse, the animated 
object just 'shows up' at the target location. If I don't create any mousedown 
event during the transition, it fires and animates properly. 

Thank you for any suggestions!
-Chilton
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]