• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Pausing an animation
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Pausing an animation


  • Subject: Re: Pausing an animation
  • From: David Duncan via Cocoa-dev <email@hidden>
  • Date: Tue, 17 Sep 2019 13:35:24 -0700


> On Sep 17, 2019, at 1:19 PM, Gabriel Zachmann via Cocoa-dev
> <email@hidden> wrote:
>
> I have a layer with two animations.
>
> I would like to pause this animation occasionally .
> To do so, I set layer.speed = 0.0;
>
> In the past, this has worked (with slightly different animations).
> However, in this case, the layer seems to just disappear.
> (the layer occupies the whole screen, and when I set speed-0, the screen is
> black)
>
> Does anyone have an idea what might be the reason why it doesn't work?
> Are there properties that do not work with speed = 0?

Setting just the speed will often return you to the “beginning of time” for
your CAMediaTiming compliant object (CALayer and CAAnimation the most common
compliant objects).

<localTime> = (<parentTime> - beginTime) * speed + timeOffset

So if you want to pause a layer, you also need to set the timeOffset to a value
that matches the current value of <localTime>

QA1673 has a proper implementation for doing this
<https://developer.apple.com/library/archive/qa/qa1673/_index.html
<https://developer.apple.com/library/archive/qa/qa1673/_index.html>>

>
> Thanks a lot in advance.
> Gabriel.
>
>
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> 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:
>
> This email sent to email@hidden

_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Pausing an animation
      • From: Gabriel Zachmann via Cocoa-dev <email@hidden>
References: 
 >Pausing an animation (From: Gabriel Zachmann via Cocoa-dev <email@hidden>)

  • Prev by Date: Pausing an animation
  • Next by Date: Why is / a metachar in regular expressions ?
  • Previous by thread: Pausing an animation
  • Next by thread: Re: Pausing an animation
  • Index(es):
    • Date
    • Thread