Dosen原创
这是我学习quartz composer,Origami,看官方文档翻译下来的,每天一篇,有不准确的地方希望能指出,一起交流进步。转载请与我联系,擅自转载视作侵权。
Layers 层
Layers show content, like images, in the viewer. They work like layers in Sketch and Photoshop: every layer has style attributes (e.g. position, size, an Image or Color to show...), can be different types (see list below), and can be layered on top of each other.
层是个容器,像在查看器中的图片,它们的作用像是在Sketch和Photoshop中的图层一样:每个图层有一套属性样式(比如:位置,尺寸,一张位图或是颜色),可以是不同类型,互相之间可以有层级。
Add a layer with the patch library “ ⌘ ⏎ ” , or their keyboard shortcuts. Quickly add an image as a layer by dragging and dropping the image on to the Editor.
用模块库 “ ⌘ ⏎ ” 添加一个层,或者通过快捷键。通过拖拽把图片拖进编辑器来快速添加一个图片作为一个层。
1. Layer patches 层模块
Layer → “ L ”
Display a rectangle or image. For non-rectangle shapes, use patches like Circle Image or Rounded Rectangle that create an image to plug into a Layer.
显示一个矩形或图片。对于非矩形形状来说,使用像Circle Image(圆形图片)或者Rounded Rectangle(圆角矩形)这样的模块来把一个图片放入一个层中。
In most situations, you'll be working with an image from your designs by copy-pasting or drag-and-dropping into the editor. This will automatically create a layer patch for you with the image connected.
在大多数情况下,你会用 复制-粘贴 或者 拖拽-放入 的方式把你设计中的图片放入编辑器,这样会自动地为你创建一个连接了图片的层模块。
Text Layer → “ ⇧ T ”
Display text with adjustable font settings.
显示文字,可调节字体设置。
Completely fill the containing Layer Group with a color.
用一个颜色填充满Layer Group(层组)。
2. Layer position 层位置
Layers in Origami are positioned in the center by default. You can easily position the layer in different corners of the layer group by changing the Anchor Position. Be aware that some patches (like Scroll) expect Layers to have a center anchor position.
在Origami中,层默认的位置在中心。用changing the Anchor Position(改变锚点位置)可以让你很容易的把层放置在层组的不同的角落里。
X Position behaves like Sketch and Photoshop, where increasing it moves right, and decreasing moves left. Y Position is reversed: increasing it moves up, and decreasing moves down.
X坐标就像Sketch和Photoshop中一样,向右移动它的值增加,向左移动值减少。Y坐标是向上移动值增加,向下移动值减少。
Read more about the Coordinate System.
阅读更多关于坐标系统。
3. Layer order 层顺序
Unlike the other attributes of a Layer, the order is specified with a dropdown at the top right of the Patch. You can also change the order by selecting the layer and hitting “ ⌘ [ ” or “ ⌘ ] ” .
不同于层的其他属性,在模块的右上角通过下拉指定顺序。你也可以选住层,按 “ ⌘ [ ” 或 “ ⌘ ] ” 改变顺序。
To change the order of a Layer using patches, simply tweak the Z Position by a small amount (like 0.0001 pixels).
使用模块改变一个层的顺序,稍微调整Z坐标一点点(比如0.0001像素)就可以了。
4. Layer Groups 层组
Layer Groups help you organize your Layers together. Create one from the patch library or simply hit “ G ” (tip: you can do this while hovered over an image patch to quickly group it). You can double-click or “ ⌘ ▼ ” to get into a Layer Group, and click Edit Parent in the toolbar or “ ⌘ ▲ ” to exit a Layer Group.
层组帮你组织你的层在一起。从模块库创建一个或者按 “ G ” (提示:你可以在悬停在一个图片模块上的时候,按 “ G ”,把它组在一起),你可以双击或者用 “ ⌘ ▼ ” 来成组,点击工具栏的Edit Parent(编辑父物体) 或者 “ ⌘ ▲ ” 来退出层组。
Make sure to group layers whenever you want to animate multiple layers together. For example, if you're sliding up a window with multiple layers inside of it, putting those layers in a layer group will let you just animate up that one group up instead of needing to have cables connected to several different layers.
确保任何时候你想要动起来层都在一个层组。举个例子,如果你想上滑一个里面有很多层的窗口,把这些层放在一个层组,会让你只需要动一个层组就能可以,而不需要给许多不同的层连线。