CALayer question regarding sequence of animations

  • Good evening all...

    Using CAAction or CATransaction, can you create a sequence of
    animation (usually changing a CALayer's property) that occur one after
    another?

    I know you can modify the duration of a single animation using
    CATransaction, even eliminate the animation all together. You can also
    group a set of animations, so that each one starts at the same time.
    However, I want to create a two or more animations that follow one
    other, without having to resort to a NSTimer or such. I want to be
    able to create this animation in single code segment (not require
    timers or callbacks).

    For example, I want to create an animation that make a hidden layer
    appear (aLayer.hidden=FALSE), moves it to a new position (aLayer.
    position=CGPointMake(100.0,100.0), and then fades it back out (aLayer.
    hidden=TRUE).

    Any thoughts?

    Steve Sheets
    Midnight Mage Software
  • On Nov 13, 2007, at 12:10 PM, Steve Sheets wrote:
    > Good evening all...
    >
    > Using CAAction or CATransaction, can you create a sequence of
    > animation (usually changing a CALayer's property) that occur one
    > after another?
    >
    > I know you can modify the duration of a single animation using
    > CATransaction, even eliminate the animation all together. You can
    > also group a set of animations, so that each one starts at the same
    > time. However, I want to create a two or more animations that follow
    > one other, without having to resort to a NSTimer or such. I want to
    > be able to create this animation in single code segment (not require
    > timers or callbacks).
    >
    > For example, I want to create an animation that make a hidden layer
    > appear (aLayer.hidden=FALSE), moves it to a new position (aLayer.
    > position=CGPointMake(100.0,100.0), and then fades it back out
    > (aLayer. hidden=TRUE).
    >
    > Any thoughts?

    See CAAnimation's "beginTime" property (part of the CAMediaTiming
    protocol to which CAAnimation conforms).

    By collecting animations in a CAAnimationGroup, and setting the
    "beginTime" and "duration" of each constituent animation as desired,
    you can set the animations up to execute however you like -- in
    contiguous sequence, or even with overlap and/or gaps in between them.

    --
    Troy Stephens
    Cocoa Frameworks
    Apple, Inc.
  • Troy,

    Thank you! It looks like what you described is exactly the type of
    control I was looking for. I had examined the CAAnimation object in
    detail, but missed the fact the object confirmed to the CAMediaTiming,
    thus giving me the beginTime property.

    Steve Sheets
    Midnight Mage Software

    On Nov 13, 2007, at 4:25 PM, Troy Stephens wrote:

    > On Nov 13, 2007, at 12:10 PM, Steve Sheets wrote:
    >> Good evening all...
    >>
    >> Using CAAction or CATransaction, can you create a sequence of
    >> animation (usually changing a CALayer's property) that occur one
    >> after another?
    >>
    >> I know you can modify the duration of a single animation using
    >> CATransaction, even eliminate the animation all together. You can
    >> also group a set of animations, so that each one starts at the same
    >> time. However, I want to create a two or more animations that
    >> follow one other, without having to resort to a NSTimer or such. I
    >> want to be able to create this animation in single code segment
    >> (not require timers or callbacks).
    >>
    >> For example, I want to create an animation that make a hidden layer
    >> appear (aLayer.hidden=FALSE), moves it to a new position (aLayer.
    >> position=CGPointMake(100.0,100.0), and then fades it back out
    >> (aLayer. hidden=TRUE).
    >>
    >> Any thoughts?
    >
    > See CAAnimation's "beginTime" property (part of the CAMediaTiming
    > protocol to which CAAnimation conforms).
    >
    > By collecting animations in a CAAnimationGroup, and setting the
    > "beginTime" and "duration" of each constituent animation as desired,
    > you can set the animations up to execute however you like -- in
    > contiguous sequence, or even with overlap and/or gaps in between them.
    >
    > --
    > Troy Stephens
    > Cocoa Frameworks
    > Apple, Inc.
    >
    >
    >
    >
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