Files
OpenSpace/data/assets/examples/scale/luascale/example.lua
Alexander Bock aa0255bccb Add example for the LuaScale class and fix it at the same time (#3271)
* Change the LuaScale to request a single table as a return value to be consistent with the other Lua transformation types
2024-05-31 22:26:24 +02:00

13 lines
787 B
Lua

-- The `scale` function takes exactly three arguments and returns the three scaling
-- values (one for each axis) as a single table.
-- The three parameters are all provided as the number of seconds past the J2000 epoch
-- (2000-01-01 12:00:00), which can be both fractional numbers as well as negative numbers
-- for dates earlier than the epoch.
-- 1. `simulationTime` is the value of the in-game clock for the current frame
-- 2. `prevSimulationTime` is the value of the in-game clock for the previous frame
-- 3. `wallTime` is the value of the computer clock as seconds past the epoch
function scale(simulationTime, prevSimulationTime, wallTime)
-- Make the scaling along the x-axis oscillate between -3 and 3 once per second
return { 3 * math.sin(simulationTime), 1, 1 }
end