CATextLayer question

  • Hi All,

    I have an issue with CATextLayer that I'd like to explore.  The basic
    question is this: why does a CATextLayer that has a 'duration'
    specified for it, not draw anything?

    I've included a small spike application that shows this, it can be
    downloaded from the following address:
        http://idisk.mac.com/john_clayton-Public?view=web
    there is a directory called 'CATextLayer' in which there is a .zipped
    XCode 3.0 leopard project.

    If I don't specify a duration for the CATextLayer instance, then it'll
    draw itself properly.  As soon as a duration is there; bam - it fades
    out and won't draw. (just try changing the default duration using the
    text box).

    Anyone know why this is the case?

    Thanks,
    --
    John Clayton
    http://www.coderage-software.com/
  • On Nov 13, 2007, at 1:41 PM, John Clayton wrote:

    > I have an issue with CATextLayer that I'd like to explore.  The
    > basic question is this: why does a CATextLayer that has a 'duration'
    > specified for it, not draw anything?

    Because the beginTime attribute is sometime in the past, likely the
    distant past. Since the sum of the beginTime and your duration says
    that the animation has expired, the layer is hidden. Generally, if you
    want to set a layer's duration, you should also set its beginTime.
    --
    David Duncan
    Apple DTS Animation and Printing
    <david.duncan...>
  • Correct, thanks.  I modified the program to include a button that
    reset the beginTime to the CACurrentMediaTime() value, and then when I
    type something into the duration (like 4) the text appears, and after
    4 seconds, fades out.

    Thanks for the tip.

    --
    John Clayton
    http://www.coderage-software.com/

    On 13/11/2007, at 11:45 PM, David Duncan wrote:

    > On Nov 13, 2007, at 1:41 PM, John Clayton wrote:
    >
    >> I have an issue with CATextLayer that I'd like to explore.  The
    >> basic question is this: why does a CATextLayer that has a
    >> 'duration' specified for it, not draw anything?
    >
    >
    > Because the beginTime attribute is sometime in the past, likely the
    > distant past. Since the sum of the beginTime and your duration says
    > that the animation has expired, the layer is hidden. Generally, if
    > you want to set a layer's duration, you should also set its beginTime.
    > --
    > David Duncan
    > Apple DTS Animation and Printing
    > <david.duncan...>
    >
    >
    >
  • Actually, I'm going to back on up a wee bit.

    I am writing an app that composes various bits of media together using
    the CAnim system to store the composition model.  The CA system has a
    really nice fit for this, i.e. layering, beginTime, duration, super/
    child relationships, layout mgrs, child positioning relative to parent
    - all the kind of stuff that makes modelling media in space *and* time
    relatively easy.

    For this app, I need to be able to describe my model (i.e. a piece of
    text that has a duration of 10 seconds), and then to be able to place
    that text into the root CALayer instance with a beginTime of Z (which
    is arbitrary).

    I'm then using a custom rendering solution that renders a single frame
    of any arbitrary CALayer at any given point in time to pick out an
    image (based on CALayerRenderer).

    Does this mean I'd have to set my root layer beginTime to the
    following (note the minus):

    ( - CACurrentMediaTime() + aTimeThatIWantToRenderAt )

    in order to see the frame?  Seems so... because the internal
    CACurrentMediaTime() is ticking away quite happily in the background,
    whereas I want to render at a given point in time, regardless of what
    the CACurrentMediaTime() value is.

    I will try this out anyway...

    --
    John Clayton

    On 14/11/2007, at 7:13 AM, John Clayton wrote:

    > Correct, thanks.  I modified the program to include a button that
    > reset the beginTime to the CACurrentMediaTime() value, and then when
    > I type something into the duration (like 4) the text appears, and
    > after 4 seconds, fades out.
    >
    > Thanks for the tip.
    >
    > --
    > John Clayton
    > http://www.coderage-software.com/
    >
    >
    > On 13/11/2007, at 11:45 PM, David Duncan wrote:
    >
    >> On Nov 13, 2007, at 1:41 PM, John Clayton wrote:
    >>
    >>> I have an issue with CATextLayer that I'd like to explore.  The
    >>> basic question is this: why does a CATextLayer that has a
    >>> 'duration' specified for it, not draw anything?
    >>
    >>
    >> Because the beginTime attribute is sometime in the past, likely the
    >> distant past. Since the sum of the beginTime and your duration says
    >> that the animation has expired, the layer is hidden. Generally, if
    >> you want to set a layer's duration, you should also set its
    >> beginTime.
    >> --
    >> David Duncan
    >> Apple DTS Animation and Printing
    >> <david.duncan...>
    >>
    >>
    >>

previous month november 2007 next month
MTWTFSS
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30    
Go to today