Layer time-level relationship time and layer-level relationship

Source: Internet
Author: User

Layer time-level relationship time and layer-level relationship

Each animation and layer has its own hierarchical concept in terms of time, which is measured relative to its father. Adjusting the Time of the layer will affect the animation of the layer itself and the child layer, but will not affect the parent layer.

PairCALayerOrCAGroupAnimationAdjustmentdurationAndrepeatCount/repeatDurationAttributes do not affect the sub-animation. HoweverbeginTime,timeOffsetAndspeedAttributes will affect the sub-animation.

Global time and local time

The system provides a functionCACurrentMediaTimeTo obtainMachTime, that is, absolute time. It is actually the number of seconds since the last start of the device. All processes on the device are global. It can be used as a reference for animation. However, this time will be paused during sleep.

EachCALayerAndCAAnimationBoth have the concept of local time. Is based on the parent layer/animation hierarchybeginTime,timeOffsetAndspeedAttribute calculation.

- (CFTimeInterval)convertTime:(CFTimeInterval)t fromLayer:(CALayer *)l; - (CFTimeInterval)convertTime:(CFTimeInterval)t toLayer:(CALayer *)l;
After the pause or backward turn quickforward animation is added to the layer, it cannot be modified.

AddCAAnimationIn fact, an unchangeable copy is made to the animation object. Therefore, changing the attributes of the original animation object does not affect the real animation. Instead, use-animationForKey:You can return the correct animation object to retrieve ongoing layers, but modifying its attributes will throw an exception.

  • Pause
    If you setspeedIf it is set to 0, it pauses any animation added to the layer.
  • Reverse
    SetspeedA negative value will be converted back to the animation.
  • Fast forward
    SetspeedMore than 1.0 will be fast forward

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.