Celestia/Celx 指令碼/CELX Lua 方法/CEL 命令中心
外觀
center { time <duration> }
在 <duration> 秒內將當前選定的物件置於顯示器中心。您必須先使用 select 命令選擇要居中的物件。
引數
- time <duration>
- 將物件居中所需的時間(秒)。預設值為 1.0 秒。
CELX 等效項
基於 observer:center() 方法。
- 查詢並選擇名為 <string> 的目標物件以居中,並將其儲存在“objectname”中
objectname = celestia:find( <string> )
- 獲取活動檢視的觀察者例項並居中 objectname。
如果沒有給出 <duration>,則預設時間為 5.0 秒!
obs = celestia:getobserver() obs:center(objectname, <duration> )
- 等待 <duration> 秒。
wait( <duration> )
總結
objectname = celestia:find( <string> ) obs = celestia:getobserver() obs:center(objectname, <duration> ) wait( <duration> )
示例
以下示例選擇地球,並在 5.5 秒內將其置於螢幕中央。如果您沒有看到地球,請按鍵盤上的 [G] 鍵,您應該會看到地球從顯示器中心放大。
CEL
select { object "Sol/Earth" }
center { time 5.5 }
CELX
earth = celestia:find("Sol/Earth")
celestia:select(earth)
obs = celestia:getobserver()
obs:center(earth, 5.5)
wait(5.5)