core-animation
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCore Animation Reference
Core Animation 参考文档
Search these docs to answer questions about Core Animation (the QuartzCore framework). Use this skill when working directly with , layer-backed UIKit/AppKit views, explicit keyframe or spring animations on layer properties, particle systems, or per-frame callbacks via .
CALayerCADisplayLinkFor SwiftUI's declarative animation API (, , , transitions), use instead. For SwiftUI immediate-mode drawing, use and .
withAnimationAnimation.animation(_:value:)guide-swiftui-animationsswiftui/canvas.mdswiftui/graphicscontext.md搜索这些文档以获取关于 Core Animation(QuartzCore 框架)的问题解答。当你直接使用 、基于图层的 UIKit/AppKit 视图、图层属性的显式关键帧或弹性动画、粒子系统,或通过 实现逐帧回调时,可以使用此技能。
CALayerCADisplayLink对于 SwiftUI 的声明式动画 API(、、、转场效果),请改用 。对于 SwiftUI 即时模式绘图,请使用 和 。
withAnimationAnimation.animation(_:value:)guide-swiftui-animationsswiftui/canvas.mdswiftui/graphicscontext.mdReturn Format
返回格式
Always include:
- Summary — answer the question concisely.
- File paths — list relevant files for full details, e.g.:
- for layer geometry, contents, hierarchy
calayer.md - for animating a single property between two values
cabasicanimation.md - for batching, disabling implicit animations, or changing default duration
catransaction.md
请始终包含以下内容:
- 摘要 — 简洁回答问题。
- 文件路径 — 列出相关文件以获取详细信息,例如:
- :图层几何结构、内容、层级
calayer.md - :在两个值之间动画单个属性
cabasicanimation.md - :批量处理、禁用隐式动画或修改默认时长
catransaction.md
Files
文件
| File | Content |
|---|---|
| Full QuartzCore framework index — layer basics, animation classes, transactions, layer subclasses |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| 文件 | 内容 |
|---|---|
| 完整的 QuartzCore 框架索引 — 图层基础、动画类、事务、图层子类 |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
When to Reach for Core Animation
何时使用 Core Animation
- You need to animate a layer property SwiftUI/UIKit doesn't expose declaratively (e.g., ,
CAGradientLayer.colors,CAShapeLayer.strokeEnd).CAEmitterLayer.birthRate - You need explicit keyframe or spring control with timing functions () per segment.
CAMediaTimingFunction - You want to batch implicit animations off ().
CATransaction.setDisableActions(true) - You need a per-frame callback (custom drawing loops, scrubbing, physics).
CADisplayLink - You're rendering thousands of particles with or replicating sublayers with
CAEmitterLayer.CAReplicatorLayer
If your problem fits inside in SwiftUI or in UIKit, prefer those — Core Animation sits underneath both and is rarely the right starting point in 2026-era code.
withAnimation { ... }UIView.animate { ... }- 你需要动画化 SwiftUI/UIKit 未以声明方式暴露的图层属性(例如 、
CAGradientLayer.colors、CAShapeLayer.strokeEnd)。CAEmitterLayer.birthRate - 你需要对每个片段使用时序函数()进行显式关键帧或弹性控制。
CAMediaTimingFunction - 你想要批量关闭隐式动画()。
CATransaction.setDisableActions(true) - 你需要通过 实现逐帧回调(自定义绘图循环、 scrubbing、物理效果)。
CADisplayLink - 你正在使用 渲染数千个粒子,或使用
CAEmitterLayer复制子图层。CAReplicatorLayer
如果你的问题可以通过 SwiftUI 中的 或 UIKit 中的 解决,请优先使用这些方法——Core Animation 是两者的底层实现,在 2026 年的代码中很少是正确的起点。
withAnimation { ... }UIView.animate { ... }Fetching More Docs
获取更多文档
- Search this skill's local files first.
.md - If the topic is not here, check the other installed Apple skills, then grep their local files.
- If no installed skill has the page, the QuartzCore path on Apple's site is — fetch via the
/documentation/quartzcore/<symbol>Markdown mirror (e.g.sosumi.ai) or by runninghttps://sosumi.ai/documentation/quartzcore/camediatimingfunctionagainst the apple-skills tooling.pnpm fetch-doc
- 首先搜索此技能的本地 文件。
.md - 如果此处没有相关主题,请检查其他已安装的 Apple 技能,然后搜索它们的本地文件。
- 如果没有已安装的技能包含该页面,Apple 网站上的 QuartzCore 路径为 — 可通过
/documentation/quartzcore/<symbol>Markdown 镜像(例如sosumi.ai)或通过https://sosumi.ai/documentation/quartzcore/camediatimingfunction命令调用 apple-skills 工具来获取。pnpm fetch-doc