DashboardItemText

Inherits DashboardItem

Members

Name

Documentation

Type

Description

Optional

FontName

This value is the name of the font that is used. It can either refer to an internal name registered previously, or it can refer to a path that is used.

String

Value of type ‘String’

Yes

FontSize

This value determines the size of the font that is used to render the distance.

Double

Value of type ‘Double’

Yes

Text

The text to be displayed.

String

Value of type ‘String’

Yes

Asset Examples

  1asset.require("spice/core") -- openspace.time.advancedTime depends on SPICE
  2asset.require("scene/solarsystem/planets/earth/atmosphere")
  3
  4
  5
  6-- Function to advance a time stamp in the given number of days, hours, minutes and
  7-- seconds. returns the new time stamp
  8local function advance(time, days, hours, minutes, seconds)
  9  local result = openspace.time.advancedTime(time, tostring(days) .. "d")
 10  result = openspace.time.advancedTime(result, tostring(hours) .. "h")
 11  result = openspace.time.advancedTime(result, tostring(minutes) .. "m")
 12  result = openspace.time.advancedTime(result, tostring(seconds) .. "s")
 13
 14  return result
 15end
 16
 17local LaunchTime = "2021-12-25T12:20:00.000"
 18local DetachTime = "2021-12-25T12:50:00.000"
 19
 20-- JWST timelapse timeline, forwards
 21local function createForwardTimelapse()
 22  local timelapse = [[
 23    -- Mission start, setup 2 sec after, reset night layer
 24    openspace.scriptScheduler.loadScheduledScript("]] ..
 25      advance(LaunchTime, 0, 0, 0, 2) .. [[",
 26      "openspace.setPropertyValueSingle(\"Scene.Earth.Renderable.Layers.NightLayers.Earth_at_Night_2012.Settings.Gamma\", 1.0)" ..
 27      "openspace.setPropertyValueSingle(\"Scene.EarthAtmosphere.Renderable.Enabled\", true)"
 28    )
 29
 30    -- Mission start, GO 3 sec after
 31    openspace.scriptScheduler.loadScheduledScript("]] ..
 32      advance(LaunchTime, 0, 0, 0, 3) .. [[",
 33      "openspace.time.interpolateDeltaTime(5)" ..
 34      "openspace.setPropertyValueSingle(\"Dashboard.JWSTStateText.Text\", \"Time speed: 5 seconds/second\")"
 35    )
 36
 37    -- Speed up when reaching higher altitude
 38    openspace.scriptScheduler.loadScheduledScript("]] ..
 39      advance(LaunchTime, 0, 0, 2, 0) .. [[",
 40      "openspace.time.interpolateDeltaTime(300)" ..
 41      "openspace.setPropertyValueSingle(\"Dashboard.JWSTStateText.Text\", \"Time speed: 5 minutes/second\")"
 42    )
 43
 44    -- array deploy
 45    openspace.scriptScheduler.loadScheduledScript("]] ..
 46      advance(LaunchTime, 0, 0, 30 - 2, 20 - 40) .. [[", -- 2 min 40 sec pre delay
 47      "openspace.time.interpolateDeltaTime(1)" ..
 48      "openspace.setPropertyValueSingle(\"Dashboard.JWSTStateText.Text\", \"Time speed: 1 second/second\")"
 49    )
 50
 51    -- array complete
 52    openspace.scriptScheduler.loadScheduledScript("]] ..
 53      advance(LaunchTime, 0, 0, 30, 42) .. [[",
 54      "openspace.time.interpolateDeltaTime(2400)" ..
 55      "openspace.setPropertyValueSingle(\"Dashboard.JWSTStateText.Text\", \"Time speed: 40 minutes/second\")"
 56    )
 57
 58    -- Make night layer more visible, at around 14:00
 59    openspace.scriptScheduler.loadScheduledScript("]] ..
 60      advance(DetachTime, 0, 1, 10, 0) .. [[",
 61      "openspace.time.interpolateDeltaTime(7200)" ..
 62      "openspace.setPropertyValueSingle(\"Dashboard.JWSTStateText.Text\", \"Time speed: 2 hours/second\")" ..
 63      "openspace.setPropertyValueSingle(\"Scene.Earth.Renderable.Layers.NightLayers.Earth_at_Night_2012.Settings.Gamma\", 0.7)" ..
 64      "openspace.setPropertyValueSingle(\"Scene.EarthAtmosphere.Renderable.Enabled\", false)"
 65    )
 66
 67    -- antenna deploy
 68    openspace.scriptScheduler.loadScheduledScript("]] ..
 69    advance(LaunchTime, 0, 18, 0, 0) .. [[",
 70      "openspace.time.interpolateDeltaTime(1800)" ..
 71      "openspace.setPropertyValueSingle(\"Dashboard.JWSTStateText.Text\", \"Time speed: 30 minutes/second\")"
 72    )
 73
 74    -- antenna complete
 75    openspace.scriptScheduler.loadScheduledScript("]] ..
 76      advance(LaunchTime, 0, 23, 39, 0) .. [[",
 77      "openspace.time.interpolateDeltaTime(18000)" ..
 78      "openspace.setPropertyValueSingle(\"Dashboard.JWSTStateText.Text\", \"Time speed: 5 hours/second\")"
 79    )
 80
 81    -- fw palette deploy
 82    openspace.scriptScheduler.loadScheduledScript("]] ..
 83      advance(LaunchTime, 2, 18 - 2, 20, 35) .. [[", -- 2h pre delay so time to interpolate
 84      "openspace.time.interpolateDeltaTime(3600)" ..
 85      "openspace.setPropertyValueSingle(\"Dashboard.JWSTStateText.Text\", \"Time speed: 1 hour/second\")"
 86    )
 87
 88    -- fw palette complete
 89    openspace.scriptScheduler.loadScheduledScript("]] ..
 90      advance(LaunchTime, 3, 6, 0, 0) .. [[",
 91      "openspace.time.interpolateDeltaTime(1800)" ..
 92      "openspace.setPropertyValueSingle(\"Dashboard.JWSTStateText.Text\", \"Time speed: 30 minutes/second\")"
 93    )
 94
 95    -- r palette deploy
 96    openspace.scriptScheduler.loadScheduledScript("]] ..
 97      advance(LaunchTime, 3, 8, 51, 0) .. [[",
 98      "openspace.time.interpolateDeltaTime(1800)" ..
 99      "openspace.setPropertyValueSingle(\"Dashboard.JWSTStateText.Text\", \"Time speed: 30 minutes/second\")"
100    )
101
102    -- r palette complete
103    openspace.scriptScheduler.loadScheduledScript("]] ..
104      advance(LaunchTime, 3, 12, 0, 0) .. [[",
105      "openspace.time.interpolateDeltaTime(120)" ..
106      "openspace.setPropertyValueSingle(\"Dashboard.JWSTStateText.Text\", \"Time speed: 2 minutes/second\")"
107    )
108
109    -- base rise deploy
110    openspace.scriptScheduler.loadScheduledScript("]] ..
111      advance(LaunchTime, 3, 12, 22, 0) .. [[",
112      "openspace.time.interpolateDeltaTime(7200)" ..
113      "openspace.setPropertyValueSingle(\"Dashboard.JWSTStateText.Text\", \"Time speed: 2 hours/second\")"
114    )
115
116    -- base rise complete
117    openspace.scriptScheduler.loadScheduledScript("]] ..
118      advance(LaunchTime, 4, 17, 35, 0) .. [[",
119      "openspace.time.interpolateDeltaTime(1800)" ..
120      "openspace.setPropertyValueSingle(\"Dashboard.JWSTStateText.Text\", \"Time speed: 30 minutes/second\")"
121    )
122
123    -- aft flap deploy
124    openspace.scriptScheduler.loadScheduledScript("]] ..
125      advance(LaunchTime, 4, 21, 0, 0) .. [[",
126      "openspace.time.interpolateDeltaTime(600)" ..
127      "openspace.setPropertyValueSingle(\"Dashboard.JWSTStateText.Text\", \"Time speed: 10 minutes/second\")"
128    )
129
130    -- aft flap complete
131    openspace.scriptScheduler.loadScheduledScript("]] ..
132      advance(LaunchTime, 5, 1, 37, 0) .. [[",
133      "openspace.time.interpolateDeltaTime(3600)" ..
134      "openspace.setPropertyValueSingle(\"Dashboard.JWSTStateText.Text\", \"Time speed: 1 hour/second\")"
135    )
136
137    -- mid booms extend
138    openspace.scriptScheduler.loadScheduledScript("]] ..
139      advance(LaunchTime, 5, 11, 29, 43) .. [[",
140      "openspace.time.interpolateDeltaTime(1800)" ..
141      "openspace.setPropertyValueSingle(\"Dashboard.JWSTStateText.Text\", \"Time speed: 30 minutes/second\")"
142    )
143
144    -- first boom stop
145    openspace.scriptScheduler.loadScheduledScript("]] ..
146      advance(LaunchTime, 5, 12, 16, 16) .. [[",
147      "openspace.time.interpolateDeltaTime(1800)" ..
148      "openspace.setPropertyValueSingle(\"Dashboard.JWSTStateText.Text\", \"Time speed: 30 minutes/second\")"
149    )
150
151    -- right boom complete
152    openspace.scriptScheduler.loadScheduledScript("]] ..
153      advance(LaunchTime, 5, 17, 42, 5) .. [[",
154      "openspace.time.interpolateDeltaTime(1800)" ..
155      "openspace.setPropertyValueSingle(\"Dashboard.JWSTStateText.Text\", \"Time speed: 30 minutes/second\")"
156    )
157
158    -- left booms complete
159    openspace.scriptScheduler.loadScheduledScript("]] ..
160      advance(LaunchTime, 5, 22, 6, 0) .. [[",
161      "openspace.time.interpolateDeltaTime(30)" ..
162      "openspace.setPropertyValueSingle(\"Dashboard.JWSTStateText.Text\", \"Time speed: 30 seconds/second\")"
163    )
164
165    -- tension sun shield membranes
166    openspace.scriptScheduler.loadScheduledScript("]] ..
167      advance(LaunchTime, 5, 22, 9, 14) .. [[",
168      "openspace.time.interpolateDeltaTime(60)" ..
169      "openspace.setPropertyValueSingle(\"Dashboard.JWSTStateText.Text\", \"Time speed: 1 minute/second\")"
170    )
171
172    -- membrane tension complete
173    openspace.scriptScheduler.loadScheduledScript("]] ..
174      advance(LaunchTime, 5, 22, 20, 0) .. [[",
175      "openspace.time.interpolateDeltaTime(7200)" ..
176      "openspace.setPropertyValueSingle(\"Dashboard.JWSTStateText.Text\", \"Time speed: 2 hours/second\")"
177    )
178
179    -- membranes separate
180    openspace.scriptScheduler.loadScheduledScript("]] ..
181      advance(LaunchTime, 6, 12, 36, 49) .. [[",
182      "openspace.time.interpolateDeltaTime(3600)" ..
183      "openspace.setPropertyValueSingle(\"Dashboard.JWSTStateText.Text\", \"Time speed: 1 hour/second\")"
184    )
185
186    -- secondary mirror deploy
187    openspace.scriptScheduler.loadScheduledScript("]] ..
188      advance(LaunchTime, 7, 0, 0, 0) .. [[",
189      "openspace.time.interpolateDeltaTime(18000)" ..
190      "openspace.setPropertyValueSingle(\"Dashboard.JWSTStateText.Text\", \"Time speed: 5 hours/second\")"
191    )
192
193    -- secondary mirror complete
194    openspace.scriptScheduler.loadScheduledScript("]] ..
195      advance(LaunchTime, 11, 10, 33, 0) .. [[",
196      "openspace.time.interpolateDeltaTime(1200)" ..
197      "openspace.setPropertyValueSingle(\"Dashboard.JWSTStateText.Text\", \"Time speed: 20 minutes/second\")"
198    )
199
200    -- aft radiator deploy
201    openspace.scriptScheduler.loadScheduledScript("]] ..
202      advance(LaunchTime, 11, 12, 20, 48) .. [[",
203      "openspace.time.interpolateDeltaTime(1800)" ..
204      "openspace.setPropertyValueSingle(\"Dashboard.JWSTStateText.Text\", \"Time speed: 30 minutes/second\")"
205    )
206
207    -- aft radiator complete, forward
208    openspace.scriptScheduler.loadScheduledScript("]] ..
209      advance(LaunchTime, 11, 16, 5, 0) .. [[",
210      "openspace.time.interpolateDeltaTime(7200)" ..
211      "openspace.setPropertyValueSingle(\"Dashboard.JWSTStateText.Text\", \"Time speed: 2 hours/second\")"
212    )
213
214    -- rt cord fold wings deploy
215    openspace.scriptScheduler.loadScheduledScript("]] ..
216      advance(LaunchTime, 12, 9, 30, 0) .. [[",
217      "openspace.time.interpolateDeltaTime(7200)" ..
218      "openspace.setPropertyValueSingle(\"Dashboard.JWSTStateText.Text\", \"Time speed: 2 hours/second\")"
219    )
220
221    -- rt cord fold wings complete
222    openspace.scriptScheduler.loadScheduledScript("]] ..
223      advance(LaunchTime, 13, 12, 40, 48) .. [[",
224      "openspace.time.interpolateDeltaTime(7200)" ..
225      "openspace.setPropertyValueSingle(\"Dashboard.JWSTStateText.Text\", \"Time speed: 2 hours/second\")"
226    )
227
228    -- lft cord fold wings deploy
229    openspace.scriptScheduler.loadScheduledScript("]] ..
230      advance(LaunchTime, 13, 23, 0, 0) .. [[",
231      "openspace.time.interpolateDeltaTime(7200)" ..
232      "openspace.setPropertyValueSingle(\"Dashboard.JWSTStateText.Text\", \"Time speed: 2 hours/second\")"
233    )
234
235    -- lft cord fold wings complete
236    openspace.scriptScheduler.loadScheduledScript("]] ..
237      advance(LaunchTime, 14, 19, 0, 0) .. [[",
238      "openspace.time.interpolateDeltaTime(1)" ..
239      "openspace.setPropertyValueSingle(\"Dashboard.JWSTStateText.Text\", \"\")" ..
240      "openspace.setPropertyValueSingle(\"Scene.Earth.Renderable.Layers.NightLayers.Earth_at_Night_2012.Settings.Gamma\", 1.0)" ..
241      "openspace.setPropertyValueSingle(\"Scene.EarthAtmosphere.Renderable.Enabled\", true)"
242    )
243
244    -- Finished, slow down, 1 sec after end
245    openspace.scriptScheduler.loadScheduledScript("]] ..
246      advance(LaunchTime, 14, 19, 0, 2) .. [[",
247      "openspace.scriptScheduler.clear(0)"
248    )
249  ]]
250
251  return timelapse
252end
253
254
255
256
257
258-- JWST timelapse timeline, backwards
259local function createBackwardTimelapse()
260  local timelapse = [[
261    -- Finished
262    openspace.scriptScheduler.loadScheduledScript("]] ..
263      advance(LaunchTime, 0, 0, 30, 20) .. [[",
264      "",
265      "openspace.setPropertyValueSingle(\"Dashboard.JWSTStateText.Text\", \"\")" ..
266      "openspace.scriptScheduler.clear(0)"
267    )
268
269    -- array complete
270    openspace.scriptScheduler.loadScheduledScript("]] ..
271      advance(LaunchTime, 0, 0, 30 + 1, 42 + 10) .. [[", -- 1 min 10 sec pre delay so time to interpolate
272      "",
273      "openspace.time.interpolateDeltaTime(-1)" ..
274      "openspace.setPropertyValueSingle(\"Dashboard.JWSTStateText.Text\", \"Time speed: -1 second/second\")"
275    )
276    -- array complete, prepare
277    openspace.scriptScheduler.loadScheduledScript("]] ..
278      advance(LaunchTime, 0, 0 + 1, 30 + 10, 42) .. [[", -- 1h 10 min delay for interpolation
279      "",
280      "openspace.time.interpolateDeltaTime(-120)" ..
281      "openspace.setPropertyValueSingle(\"Dashboard.JWSTStateText.Text\", \"Time speed: -2 minutes/second\")"
282    )
283
284    -- Reset night layer, at around 14:00
285    openspace.scriptScheduler.loadScheduledScript("]] ..
286      advance(DetachTime, 0, 1 + 1, 10, 0) .. [[", -- 1h pre delay so time to interpolate
287      "",
288      "openspace.time.interpolateDeltaTime(-2400)" ..
289      "openspace.setPropertyValueSingle(\"Dashboard.JWSTStateText.Text\", \"Time speed: -40 minutes/second\")" ..
290      "openspace.setPropertyValueSingle(\"Scene.Earth.Renderable.Layers.NightLayers.Earth_at_Night_2012.Settings.Gamma\", 1.0)" ..
291      "openspace.setPropertyValueSingle(\"Scene.EarthAtmosphere.Renderable.Enabled\", true)"
292    )
293
294    -- antenna deploy
295    openspace.scriptScheduler.loadScheduledScript("]] ..
296    advance(LaunchTime, 0, 18, 0, 0) .. [[",
297      "",
298      "openspace.time.interpolateDeltaTime(-7200)" ..
299      "openspace.setPropertyValueSingle(\"Dashboard.JWSTStateText.Text\", \"Time speed: -2 hours/second\")"
300    )
301
302    -- antenna complete
303    openspace.scriptScheduler.loadScheduledScript("]] ..
304      advance(LaunchTime, 0, 23 + 1, 39, 0) .. [[", -- 1h pre delay so time to interpolate
305      "",
306      "openspace.time.interpolateDeltaTime(-1800)" ..
307      "openspace.setPropertyValueSingle(\"Dashboard.JWSTStateText.Text\", \"Time speed: -30 minutes/second\")"
308    )
309
310    -- fw palette deploy
311    openspace.scriptScheduler.loadScheduledScript("]] ..
312      advance(LaunchTime, 2, 18, 20, 35) .. [[",
313      "",
314      "openspace.time.interpolateDeltaTime(-18000)" ..
315      "openspace.setPropertyValueSingle(\"Dashboard.JWSTStateText.Text\", \"Time speed: -5 hours/second\")"
316    )
317
318    -- fw palette complete
319    openspace.scriptScheduler.loadScheduledScript("]] ..
320      advance(LaunchTime, 3, 6, 0, 0) .. [[",
321      "",
322      "openspace.time.interpolateDeltaTime(-3600)" ..
323      "openspace.setPropertyValueSingle(\"Dashboard.JWSTStateText.Text\", \"Time speed: -1 hour/second\")"
324    )
325
326    -- r palette deploy
327    openspace.scriptScheduler.loadScheduledScript("]] ..
328      advance(LaunchTime, 3, 8, 51, 0) .. [[",
329      "",
330      "openspace.time.interpolateDeltaTime(-1800)" ..
331      "openspace.setPropertyValueSingle(\"Dashboard.JWSTStateText.Text\", \"Time speed: -30 minutes/second\")"
332    )
333
334    -- r palette complete
335    openspace.scriptScheduler.loadScheduledScript("]] ..
336      advance(LaunchTime, 3, 12, 0, 0) .. [[",
337      "",
338      "openspace.time.interpolateDeltaTime(-1800)" ..
339      "openspace.setPropertyValueSingle(\"Dashboard.JWSTStateText.Text\", \"Time speed: -30 minutes/second\")"
340    )
341
342    -- base rise deploy
343    openspace.scriptScheduler.loadScheduledScript("]] ..
344      advance(LaunchTime, 3, 12, 22, 0) .. [[",
345      "",
346      "openspace.time.interpolateDeltaTime(-120)" ..
347      "openspace.setPropertyValueSingle(\"Dashboard.JWSTStateText.Text\", \"Time speed: -2 minutes/second\")"
348    )
349
350    -- base rise complete
351    openspace.scriptScheduler.loadScheduledScript("]] ..
352      advance(LaunchTime, 4, 17, 35, 0) .. [[",
353      "",
354      "openspace.time.interpolateDeltaTime(-7200)" ..
355      "openspace.setPropertyValueSingle(\"Dashboard.JWSTStateText.Text\", \"Time speed: -2 hours/second\")"
356    )
357
358    -- aft flap deploy
359    openspace.scriptScheduler.loadScheduledScript("]] ..
360      advance(LaunchTime, 4, 21, 0, 0) .. [[",
361      "",
362      "openspace.time.interpolateDeltaTime(-1800)" ..
363      "openspace.setPropertyValueSingle(\"Dashboard.JWSTStateText.Text\", \"Time speed: -30 minutes/second\")"
364    )
365
366    -- aft flap complete
367    openspace.scriptScheduler.loadScheduledScript("]] ..
368      advance(LaunchTime, 5, 1, 37 + 30, 0) .. [[", -- 30 min pre delay so time to interpolate
369      "",
370      "openspace.time.interpolateDeltaTime(-600)" ..
371      "openspace.setPropertyValueSingle(\"Dashboard.JWSTStateText.Text\", \"Time speed: -10 minutes/second\")"
372    )
373
374    -- mid booms extend
375    openspace.scriptScheduler.loadScheduledScript("]] ..
376      advance(LaunchTime, 5, 11, 29, 43) .. [[",
377      "",
378      "openspace.time.interpolateDeltaTime(-3600)" ..
379      "openspace.setPropertyValueSingle(\"Dashboard.JWSTStateText.Text\", \"Time speed: -1 hour/second\")"
380    )
381
382    -- first boom stop
383    openspace.scriptScheduler.loadScheduledScript("]] ..
384      advance(LaunchTime, 5, 12, 16, 16) .. [[",
385      "",
386      "openspace.time.interpolateDeltaTime(-1800)" ..
387      "openspace.setPropertyValueSingle(\"Dashboard.JWSTStateText.Text\", \"Time speed: -30 minutes/second\")"
388    )
389
390    -- right boom complete
391    openspace.scriptScheduler.loadScheduledScript("]] ..
392      advance(LaunchTime, 5, 17, 42, 5) .. [[",
393      "",
394      "openspace.time.interpolateDeltaTime(-1800)" ..
395      "openspace.setPropertyValueSingle(\"Dashboard.JWSTStateText.Text\", \"Time speed: -30 minutes/second\")"
396    )
397
398    -- left booms complete
399    openspace.scriptScheduler.loadScheduledScript("]] ..
400      advance(LaunchTime, 5, 22, 6, 0) .. [[",
401      "",
402      "openspace.time.interpolateDeltaTime(-1800)" ..
403      "openspace.setPropertyValueSingle(\"Dashboard.JWSTStateText.Text\", \"Time speed: -30 minutes/second\")"
404    )
405
406    -- tension sun shield membranes
407    openspace.scriptScheduler.loadScheduledScript("]] ..
408      advance(LaunchTime, 5, 22, 9, 14) .. [[",
409      "",
410      "openspace.time.interpolateDeltaTime(-30)" ..
411      "openspace.setPropertyValueSingle(\"Dashboard.JWSTStateText.Text\", \"Time speed: -30 seconds/second\")"
412    )
413
414    -- membrane tension complete
415    openspace.scriptScheduler.loadScheduledScript("]] ..
416      advance(LaunchTime, 5, 22, 20, 0) .. [[",
417      "",
418      "openspace.time.interpolateDeltaTime(-60)" ..
419      "openspace.setPropertyValueSingle(\"Dashboard.JWSTStateText.Text\", \"Time speed: -1 minute/second\")"
420    )
421
422    -- membranes separate
423    openspace.scriptScheduler.loadScheduledScript("]] ..
424      advance(LaunchTime, 6, 12, 36, 49) .. [[",
425      "",
426      "openspace.time.interpolateDeltaTime(-7200)" ..
427      "openspace.setPropertyValueSingle(\"Dashboard.JWSTStateText.Text\", \"Time speed: -2 hours/second\")"
428    )
429
430    -- secondary mirror deploy
431    openspace.scriptScheduler.loadScheduledScript("]] ..
432      advance(LaunchTime, 7, 0, 0, 0) .. [[",
433      "",
434      "openspace.time.interpolateDeltaTime(-3600)" ..
435      "openspace.setPropertyValueSingle(\"Dashboard.JWSTStateText.Text\", \"Time speed: -1 hour/second\")"
436    )
437
438    -- secondary mirror complete
439    openspace.scriptScheduler.loadScheduledScript("]] ..
440      advance(LaunchTime, 11, 10, 33, 0) .. [[",
441      "",
442      "openspace.time.interpolateDeltaTime(-18000)" ..
443      "openspace.setPropertyValueSingle(\"Dashboard.JWSTStateText.Text\", \"Time speed: -5 hours/second\")"
444    )
445
446    -- aft radiator deploy
447    openspace.scriptScheduler.loadScheduledScript("]] ..
448      advance(LaunchTime, 11, 12, 20, 48) .. [[",
449      "",
450      "openspace.time.interpolateDeltaTime(-1200)" ..
451      "openspace.setPropertyValueSingle(\"Dashboard.JWSTStateText.Text\", \"Time speed: -20 minutes/second\")"
452    )
453
454    -- aft radiator complete
455    openspace.scriptScheduler.loadScheduledScript("]] ..
456      advance(LaunchTime, 11, 16 + 1, 5, 0) .. [[", -- 1h pre delay so time to interpolate
457      "",
458      "openspace.time.interpolateDeltaTime(-1800)" ..
459      "openspace.setPropertyValueSingle(\"Dashboard.JWSTStateText.Text\", \"Time speed: -30 minutes/second\")"
460    )
461
462    -- rt cord fold wings deploy
463    openspace.scriptScheduler.loadScheduledScript("]] ..
464      advance(LaunchTime, 12, 9, 30, 0) .. [[",
465      "",
466      "openspace.time.interpolateDeltaTime(-7200)" ..
467      "openspace.setPropertyValueSingle(\"Dashboard.JWSTStateText.Text\", \"Time speed: -2 hours/second\")"
468    )
469
470    -- rt cord fold wings complete
471    openspace.scriptScheduler.loadScheduledScript("]] ..
472      advance(LaunchTime, 13, 12, 40, 48) .. [[",
473      "",
474      "openspace.time.interpolateDeltaTime(-7200)" ..
475      "openspace.setPropertyValueSingle(\"Dashboard.JWSTStateText.Text\", \"Time speed: -2 hours/second\")"
476    )
477
478    -- lft cord fold wings deploy
479    openspace.scriptScheduler.loadScheduledScript("]] ..
480      advance(LaunchTime, 13, 23, 0, 0) .. [[",
481      "",
482      "openspace.time.interpolateDeltaTime(-7200)" ..
483      "openspace.setPropertyValueSingle(\"Dashboard.JWSTStateText.Text\", \"Time speed: -2 hours/second\")"
484    )
485
486    -- lft cord fold wings complete
487    openspace.scriptScheduler.loadScheduledScript("]] ..
488      advance(LaunchTime, 14, 19, 0, 0) .. [[",
489      "",
490      "openspace.time.interpolateDeltaTime(-7200)" ..
491      "openspace.setPropertyValueSingle(\"Dashboard.JWSTStateText.Text\", \"Time speed: -2 hours/second\")" ..
492      "openspace.setPropertyValueSingle(\"Scene.Earth.Renderable.Layers.NightLayers.Earth_at_Night_2012.Settings.Gamma\", 0.7)" ..
493      "openspace.setPropertyValueSingle(\"Scene.EarthAtmosphere.Renderable.Enabled\", false)"
494    )
495  ]]
496
497  return timelapse
498end
499
500
501-- We have define the actual content of these actions in the onInitialize function since
502-- the `advanceTime` function is not available at Asset load time and we have to wait
503-- until the initialize function for it
504local PlayForwards
505local PlayDetach
506local PlayBackwards
507local ClearTimelapse
508local ToggleDirection
509
510local Text = {
511  Type = "DashboardItemText",
512  Identifier = "JWSTStateText",
513  GuiName = "JWST State Dashboard Text",
514  Text = ""
515}
516
517
518asset.onInitialize(function()
519  PlayForwards = {
520    Identifier = "os.jwst.PlayForwards",
521    Name = "Play JWST from start",
522    Command = [[
523      openspace.scriptScheduler.clear(0)
524      openspace.time.setDeltaTime(1)
525      openspace.setPropertyValueSingle("Dashboard.JWSTStateText.Text", "")
526      openspace.time.setTime("]] .. advance(LaunchTime, 0, 0, 0, 1) .. [[")
527      ]] .. createForwardTimelapse() .. [[
528      openspace.time.setDeltaTime(1)
529    ]],
530    Documentation = "Jump to the JWST launch time and play the timelapse of deployment forward",
531    GuiPath = "/JWST",
532    IsLocal = false
533  }
534
535  PlayDetach = {
536    Identifier = "os.jwst.PlayDetach",
537    Name = "Play JWST from detach",
538    Command = [[
539      openspace.scriptScheduler.clear(0)
540      openspace.time.setDeltaTime(1)
541      openspace.setPropertyValueSingle("Dashboard.JWSTStateText.Text", "")
542      openspace.setPropertyValueSingle("Scene.Earth.Renderable.Layers.NightLayers.Earth_at_Night_2012.Settings.Gamma", 1.0)
543      openspace.setPropertyValueSingle("Scene.EarthAtmosphere.Renderable.Enabled", true)
544      openspace.time.setTime("]] .. DetachTime .. [[")
545      ]] .. createForwardTimelapse() .. [[
546      openspace.time.setDeltaTime(1)
547    ]],
548    Documentation = "Jump to the JWST detach time and play the timelapse of deployment forward",
549    GuiPath = "/JWST",
550    IsLocal = false
551  }
552
553  PlayBackwards = {
554    Identifier = "os.jwst.PlayBackwards",
555    Name = "Play JWST from end",
556    Command = [[
557      openspace.scriptScheduler.clear(0)
558      openspace.time.setDeltaTime(-1)
559      openspace.setPropertyValueSingle("Dashboard.JWSTStateText.Text", "")
560      openspace.time.setTime("2022 JAN 09 07:20:01")
561      ]] .. createBackwardTimelapse() .. [[
562      openspace.time.setDeltaTime(-1)
563    ]],
564    Documentation = "Jump to the end of JWST deployment time and play the timelapse of deployment in reverse",
565    GuiPath = "/JWST",
566    IsLocal = false
567  }
568
569  ClearTimelapse = {
570    Identifier = "os.jwst.ClearTimelapse",
571    Name = "Clear JWST timelapse",
572    Command = [[
573      openspace.scriptScheduler.clear(0)
574      openspace.setPropertyValueSingle("Dashboard.JWSTStateText.Text", "")
575      openspace.setPropertyValueSingle("Scene.Earth.Renderable.Layers.NightLayers.Earth_at_Night_2012.Settings.Gamma", 1.0)
576      openspace.setPropertyValueSingle("Scene.EarthAtmosphere.Renderable.Enabled", true)
577      local deltaTime = openspace.time.deltaTime()
578      if deltaTime >= 0 then
579        openspace.time.setDeltaTime(1)
580      else
581        openspace.time.setDeltaTime(-1)
582      end
583    ]],
584    Documentation = "Set delta time back to realtime and clear the JWST deployment timelapse",
585    GuiPath = "/JWST",
586    IsLocal = false
587  }
588
589  ToggleDirection = {
590    Identifier = "os.jwst.ToggleDirection",
591    Name = "Toggle forwards / backwards",
592    Command = [[
593      -- Flip deltatime
594      local deltaTime = openspace.time.deltaTime()
595      openspace.time.setDeltaTime(-deltaTime)
596
597      -- Switch timelapse script
598      if deltaTime < 0 then
599        -- Going backwards and switching to forwards
600        openspace.scriptScheduler.clear(0)
601        ]] .. createForwardTimelapse() .. [[
602      else
603        -- Going forwards and switching to backwards
604        openspace.scriptScheduler.clear(0)
605        ]] .. createBackwardTimelapse() .. [[
606      end
607
608      -- Update the dashboard text
609      local text = openspace.propertyValue("Dashboard.JWSTStateText.Text")
610      if string.len(text) > 14 then
611        local newText = ""
612        if text:sub(13, 13) == "-" then
613          newText = text:sub(1,12) .. text:sub(14)
614        else
615          newText = text:sub(1,12) .. "-" .. text:sub(13)
616        end
617        openspace.setPropertyValueSingle("Dashboard.JWSTStateText.Text", newText)
618      else
619        openspace.setPropertyValueSingle("Dashboard.JWSTStateText.Text", "")
620      end
621    ]],
622    Documentation = "Toggle deployment timelapse direction between forwards and backwards",
623    GuiPath = "/JWST",
624    IsLocal = false
625  }
626
627  openspace.action.registerAction(PlayForwards)
628  openspace.action.registerAction(PlayDetach)
629  openspace.action.registerAction(PlayBackwards)
630  openspace.action.registerAction(ClearTimelapse)
631  openspace.action.registerAction(ToggleDirection)
632
633  openspace.dashboard.addDashboardItem(Text)
634end)
635
636asset.onDeinitialize(function()
637  openspace.scriptScheduler.clear()
638  openspace.dashboard.removeDashboardItem(Text)
639
640  openspace.action.removeAction(PlayForwards)
641  openspace.action.removeAction(PlayDetach)
642  openspace.action.removeAction(PlayBackwards)
643  openspace.action.removeAction(ClearTimelapse)
644  openspace.action.removeAction(ToggleDirection)
645end)
646
647
648
649asset.meta = {
650  Name = "James Webb Space Telescope Timelapse",
651  Description = [[
652    Scripts that are scheduled to alter the speed of the simulation time so the deployment
653    of the James Webb Space Telescope looks smoother.
654  ]],
655  Author = "OpenSpace Team",
656  URL = "http://openspaceproject.com",
657  License = "MIT license"
658}