Core Animation学习笔记—第八节Layer Style Property Animations

各位iOS开发大佬们好:
我是一名swift+swiftUI栈的iOS小白,目前还在上大三,最近准备实习,面试的过程中发现现在大公司很多还在用OC + UIKit的技术栈,OC我还在考虑要不要学,目前想先把UIKit学完,这是我在官网学习UIKit英文文档时摘录的本人认为的重点,如果你们也觉得对你们有用的话欢迎持续关注,我大概一天更一节,有事除外。格式什么的我也就不做了,翻译都是我自己翻译的,哪里不对欢迎在评论区指正,感谢各位大佬支持

今天2021年12月8日
这一章叫做Layer Style Property Animations

Layer的渲染顺序如下
Geometry Properties
Background Properties
Layer Content
Sublayers Content
Border Attributes
Filters Property
Shadow Properties
Opacity Property
Mask Properties
尺寸形状
背景
layer内容
子layer内容
边框
滤镜
阴影
透明度
遮罩
本章结束,感谢收看,明天再见

哈哈哈哈,主要的内容真就这么多,其余的都是一些小知识点
The following CALayer properties specify a layer’s geometry:
bounds
position
frame (computed from the bounds and position and is not animatable)
anchorPoint
cornerRadius
transform
zPosition
iOS Note: The cornerRadius property is supported only in iOS 3.0 and later.

这些属性指定了形状大小,iOS中cornerRadius仅支持3.0以后版本

The background filter is applied to the content that lies behind the layer, which primarily consists of the parent layer’s content. You might use a background filter to make the foreground layer content stand out; for example, by applying a blur filter.
The following CALayer properties affect the display of a layer’s background:
backgroundColor
backgroundFilters (not supported in iOS)
Platform Note: In iOS, the backgroundFilters property is exposed in the CALayer class but the filters you assign to this property are ignored.

背景滤镜往往应用于父layer的内容上,iOS不支持,就算能添加但iOS也不鸟你

You can provide layer content by setting a bitmap directly, by using a delegate to specify the content, or by subclassing the layer and drawing the content directly. And you can use many different drawing technologies (including Quartz, Metal, OpenGL, and Quartz Composer) to provide that content.
可以通过直接设置位图,使用代理指定内容,创建layer的子类,直接赋值为image都是提供内容的方法,可以通过很多技术来渲染内容
The following CALayer properties affect the display of a layer’s content:
contents
contentsGravity
masksToBounds

Core Animation applies the parent layer’s sublayerTransform to each sublayer relative to the parent layer’s anchor point. You can use the sublayer transform to apply perspective and other effects to all of the layers equally.
Core Animation将父层的子层转换应用于相对于父层锚点的每个子层。您可以使用子层转换将透视和其他效果平等地应用于所有图层。
The following CALayer properties affect the display of a layer’s sublayers:
sublayers
masksToBounds
sublayerTransform

The following CALayer properties affect the display of a layer’s borders:
borderColor
borderWidth
Platform Note: The borderColor and borderWidth properties are supported only in iOS 3.0 and later.

The following CALayer property specifies a layers content filters:
filters
compositingFilter
Platform Note: In iOS, layers ignore any filters you assign to them.

If you do not specify a custom shadow shape, the shadow is based on the portions of the layer that are not fully transparent.
The following CALayer properties affect the display of a layer’s shadow:
shadowColor
shadowOffset
shadowOpacity
shadowRadius
shadowPath
Platform Note: The shadowColor, shadowOffset, shadowOpacity, and shadowRadius properties are supported in iOS 3.2 and later. The shadowPath property is supported in iOS 3.2 and later and in OS X v10.7 and later.

You can use a mask to obscure all or part of a layer’s contents. The mask is itself a layer object whose alpha channel is used to determine what is blocked and what is transmitted. Opaque portions of the mask layer’s contents allow the underlying layer content to show through while transparent portions partially or fully obscure the underlying content.
遮罩的alpha channe用来决定哪里需要显示哪里需要被遮挡。掩码层内容的不透明部分允许底层内容显示,而透明部分部分部分或完全模糊了基础内容。

猜你喜欢

转载自blog.csdn.net/Programmer_Roy/article/details/121703956