Note that there are some explanatory texts on larger screens.

plurals
  1. POSlow down or pause NSAnimationContext
    primarykey
    data
    text
    <p>I have an NSAnimationContext (just a scrolling view) that I would like to slow down and/or pause whenever the cursor enters the view. I have already implemented the detection for when this happens - now I just need to figure out how to slow down the animation that is already in process. I have figured out how to do this with CALayers - but I need to use the animator proxy unable to use several AppKit views within this animation so Core Animation will not work. Does anyone know how to do this? Is there a way to keep track of NSAnimationContexts and then change them later on?</p> <p>Here is a subsection of my code, The first block is cyclicly called. Everytime one agnation completes the next will begin.</p> <pre><code>[NSAnimationContext runAnimationGroup:^(NSAnimationContext *context){ context.duration = pixels/speed; [[currentTweetView animator] setFrame:endRect]; } completionHandler:^{ [currentTweetView removeFromSuperview]; currentTweetView = nil; [self nextAnimationWithAnimationIndex:currentIndex]; }]; </code></pre> <p>Here is the code in the mouseEntered: method. Whenever this is called, neither completionHandler is ever called and the app freezes. </p> <pre><code>[NSAnimationContext runAnimationGroup:^(NSAnimationContext *context){ [[[self.subviews objectAtIndex:0] animator] setFrame:finalRect]; context.duration = 100.0; } completionHandler:^{ NSLog(@"done"); }]; </code></pre> <p>Also, is there any way to end an NSAnimationContext early and not call the completion handler?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload