mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-26 05:58:58 -06:00
49 lines
1.3 KiB
Plaintext
49 lines
1.3 KiB
Plaintext
local stateMachineHelper = asset.require('util/state_machine_helper')
|
|
|
|
states = {
|
|
{
|
|
Title = "Highlight EarthTrail",
|
|
Play = function ()
|
|
openspace.setPropertyValue("Scene.EarthTrail.Renderable.LineWidth", 10, 1)
|
|
end,
|
|
Rewind = function ()
|
|
openspace.setPropertyValue("Scene.EarthTrail.Renderable.LineWidth", 2, 1)
|
|
end
|
|
},
|
|
{
|
|
Title = "Highlight MarsTrail",
|
|
Play = function ()
|
|
openspace.setPropertyValue("Scene.EarthTrail.Renderable.LineWidth", 2, 1)
|
|
openspace.setPropertyValue("Scene.MarsTrail.Renderable.LineWidth", 10, 1)
|
|
end,
|
|
Rewind = function ()
|
|
openspace.setPropertyValue("Scene.MarsTrail.Renderable.LineWidth", 2, 1)
|
|
openspace.setPropertyValue("Scene.EarthTrail.Renderable.LineWidth", 10, 1)
|
|
end
|
|
}
|
|
}
|
|
|
|
local stateMachine
|
|
|
|
function next()
|
|
stateMachine.goToNextState()
|
|
end
|
|
|
|
function previous()
|
|
stateMachine.goToPreviousState()
|
|
end
|
|
|
|
asset.onInitialize(function ()
|
|
stateMachine = stateMachineHelper.createStateMachine(states)
|
|
openspace.bindKey('RIGHT', 'next()')
|
|
openspace.bindKey('LEFT', 'previous()')
|
|
end)
|
|
|
|
|
|
asset.onDeinitialize(function ()
|
|
stateMachine = nil
|
|
openspace.clearKey('RIGHT')
|
|
openspace.clearKey('LEFT')
|
|
end)
|
|
|