Dosen原創
這是我學習quartz composer,Origami,看官方文檔翻譯下來的,每天一篇,有不準確的地方希望能指出,一起交流進步。轉載請與我聯系,擅自轉載視作侵權。
Patch Organization? ? ? 模塊組織
It's easy to get lost in all the crossing cables. Here are some tips to help you organize your document.
在交錯的連線中很容易找不到頭緒,這里是一些小技巧,可以幫你組織你的文件。
Name patches ? ? ? 重命名模塊
You can give any patch a custom name by double clicking the title or selecting the patch and pressing?. It's often helpful to give patches names that describe what they're doing in the context of your prototype. For example, if you had a Switch patch responsible for switching a photo between a thumbnail (off) and full screen state (on), you could name the Switch "Photo is Fullscreen". It would be clear immediately what that chain of patches is responsible for and what the on state of the Switch represents.
你可以對任何模塊通過雙擊標題或選擇模塊并按下?來自定義名字,給模塊一個名字來形容它在你原型中的作用往往是很有用的。例如,如果你有一個開關模塊負責切換一個圖片的縮略圖和全屏狀態,你可以給Switch一個名字“圖片全屏”,它會清晰直接地表示模塊負責什么,開關代表的什么狀態。
Create notes ? ? ?創建注釋
Notes can be useful to describe what sections of patches are responsible for in your prototype. Add a node by right-clicking on the document and selectingAdd Note....
注釋對于描述模塊在原型中的作用很有用。在文件上點擊右鍵,選擇添加注釋。
Organize patches left to right ? ? ?從左到右組織模塊
Since patches take inputs from the left and output to the right, it makes sense to arrange them from left to right. Generally blue patches always on the right, since they don't have outputs.
因為模塊從左端輸入并且在右端輸出,所以有理由把它們從左至右的排列。一般藍色模塊往往在右邊,因為它們沒有輸出。
Organizing all Layers so they are vertically stacked in their Layer order will help make the document more readable. Use??or??to align patches arranged in a column.
組織所有層按照它們的順序垂直的堆疊會讓文件更有可讀性。使用 ?? 或 ?? 使模塊成一列。
Group related Layers to reduce cable clutter ?將有關聯的層成組減少混亂的線
UseLayer Groupsto hold multiple Layers that animate 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.
將一起動畫的一些層使用Layer Groups(層組)成組。例如:如果你一個有很多層在里面的窗口,把那些層放在一個Layer Groups里,你只要給這一個組動畫就可以了,而不必用線連接很多不同的層。
Use wireless patches to broadcast common values ?使用無線模塊播送通用值
Wireless BroadcasterandWireless Receivercan send values across your composition without the use of cables. A Broadcaster will make a value available anywhere in the same document. A Receiver can receive a value from any Broadcaster.
無線播送器和無線接收器可以不通過連線發送一個值越過你的組合。一個播送可以讓一個值在同一個文件中的任何地方都有效。一個接收器可以接收來自任何播送器的值。
There are a couple types of values that are particularly useful to broadcast:
這里是一些特別適用播送功能的類型的值:
~Static values?used in different places across your prototype. For example, say you had a padding value that you used to lay out a bunch of different parts of your UI. You'd just need to change one broadcaster and the different elements of your prototype would adjust accordingly.
~靜態值穿過你的原型用在不同的地方。例如:如果你有一個填充值用于展示你UI的一堆不同的部分,你只需要改變一個播送器,這些你原型的不同的組成部分就會相應的調整。
~State values?from patches like Switch, Index Switch, Counter, Conditional, etc. It's common to use the same state value in several different places in your composition - so it's often helpful to name it through the wireless system and have access to it anywhere on the graph.
~例如開關模塊的狀態值,計數,條件,等。它常用于在你的組合中幾個不同的地方使用了相同的狀態值-所以它經常在通過無線系統進行命名時很有用并且在圖表上任何地方都能進入。
Create a Broadcaster by pressingWwhile hovering on an output, or on a blank space in the document. A Broadcaster made from an output will automatically inherit the type, whereas a Broadcaster on a blank space will default to Virtual (which means you need to manually change it to a different type with Patch Settings?2if you want to assign it a value directly).
當懸停在一個輸出上或者在文檔空白的地方時按下‘w’來創建一個播送器。由輸出創建的播送器自動地繼承類型,而在空白地方創建的播送器默認是虛擬的(也就意味著,如果你想要直接給它賦值就需要手動地通過模塊設置?2改變它的類型)。
Create a Receiver by pressingWwhile hovering on an input. It will automatically be connected to the last-placed Wireless Broadcaster (however the name may not be reflected until you deselect the Receiver). You can change the Broadcaster in thePatch Settings?2in the dropdown.
當懸停在輸入時按‘w’創建一個接收器,它會自動地連接最后放置的播送器(然而直到你取消選中的接收器前名字并不能反射)。你可以在模塊設置?2的下拉菜單里改變播送器。
Macros to hide complex logic ? ? ?用宏隱藏復雜的邏輯
Similarly to grouping Layers, you can useCreate Macroto create bundles of logic. Generally you should group logic that when combined has an easily described purpose, for example "Scroll Speed Detector". You can make Macros within Macros as well.
類似于給層打組,你可以使用Create Macro創建邏輯的包。通常給有共同目的的邏輯打組,比如"滾動速度監測器"。你也可以在一個宏內創建宏。
“宏”的概念大概類似于,由幾個模塊組成可以實現一個功能或作用,那么組合以來,以后用這個功能時,直接調用這個宏,而不需要重新組合一遍模塊。
Often when you group, the labels of the ports are unhelpful and generic. Rename the ports by selecting the Macro and pressing?3to accessInput & Output Settings. Double-click on a port to rename.
經常當你打組時,接口的標簽是沒用的,選住這個宏并按下?3進入Input & Output Settings里重命名接口。在接口上雙擊重命名。
Sometimes you may have a Macro that you keep using over and over again. In these cases it may make sense to add it to yourPatch Library. Once you've made a Macro, go into the Macro, select all the patches and hitAdd to Library. Fill in the information (the patch preview will show incorrect names for the inputs/outputs at first). Once you've added it, you can re-use it anywhere — even share it with teammates.
有時候,如果你一遍又一遍地使用一個宏,把它添加進你的模塊庫也許更有意義。進入你制作的這個宏力,選擇所有模塊然后點擊Add to Library,填上信息。如果你添加到了庫,你可以在任何地方使用它,甚至把它分享給你的團隊成員。
Publishing inputs and outputs ? ? ?發布輸入和輸出
With Layer Groups and Macros, it maybe confusing at first how to send values in or out of the group. You can publish inputs/outputs up a level by right-clicking on a patch and selecting the port you want to publish, or by hovering on a port and pressingP.
Layer Groups和Macros,可能一開始會困惑如何讓一個值從一個組輸入或輸出,你可以在一個模塊上右鍵點擊發布輸入/輸出來使這個屬性在上一層級也能看到,選擇你想要發布的接口,或者懸停在一個接口上按下‘P’。
這個功能在使用層組和宏時,非常有用,比如:你有一個可以自定義位移距離的特定動畫的宏,那么這個宏需要一個接口輸入一個值,一個接口輸出結果,但是這兩個接口在宏內部,這時,你需要把這兩個接口上升一個層級,在宏上顯示,就需要用到這個功能了。
However, right-clicking does not work to send inputsfrom the outsideinto a Layer Group/Macro. Instead, you can drag any cable onto a Layer Group/Macro, and it will automatically create a splitter within that is published with the name you enter.
然后,右鍵點擊無法讓外面的輸入進入到一個層組/宏中。可替代的是,你可以拖拽任何線到一個層組/宏上,然后它會讓你輸入一個名字并自動的創建一個分流器來完成發布。
You can reorder and rename the ports on a Layer Group/Macro by accessingInput & Output Settings(select the patch,?3). Drag the port names to reorder.
你可以通過Input & Output Settings對層組/宏上的接口重新排序或命名(選中模塊,?3),拖動接口的名字重新排列。