Note that there are some explanatory texts on larger screens.

plurals
  1. POStopping core animation on layer when some condition is met
    primarykey
    data
    text
    <p>I'm trying to make 2 core animations that start at the same time and use the same curve but one of them need to be stopped if the condition is met. E.g. I have the following view on the left and want to transition to the right one.</p> <p><img src="https://i.stack.imgur.com/ydFvw.png" alt="enter image description here"></p> <p>The red views can be treated as overlays on top of yellow views even though in the beginning they are not intersecting. Imagine clicking 'item 3'. What I need to do is to animate movement of all rows to the top with distance <code>-item3.frame.origin.y</code> but once <code>title3</code> reaches top of the screen it should stay there so the remaining <code>item1</code> <code>item2</code> will look like they are sliding behind <code>title3</code></p> <p>I tried to animate all elements using core animation with option: <code>UIViewAnimationsOptionLayoutSubviews</code> and then in <code>layoutSubview</code> stop the animation with the following code:</p> <pre><code>-(void)layoutSubviews { CALayer* presentationLayer = (CALayer*)[self.title3.layer presentationLayer]; if (presentationLayer.frame.origin.y &lt;= 0) { [self.title3.layer removeAllAnimations]; } } </code></pre> <p>but without any success. Is there any way to make it work using core animation and without mocking with <code>CADisplayLink</code>. I can't use two seperate animations because the duration for title3 animations is hard to calculate which creates a gap between <code>title3</code> and <code>title2</code> if the animation curve is not linear.</p>
    singulars
    1. This table or related slice is empty.
    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.
    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