I get the following code, after running, we can see that the time is changing with the timeline, but how should this change of time be used?

WE do not know what YOU want to do with the time data. As a programmer is is up to YOU to decide.

As I explained in your other topic thread

So you need to modify these lines of code …

      @text = shadowinfo["ShadowTime"].to_s
      view.draw_text([30, 30], @text, {size: 18, color: [80, 80, 80]})

… so that you have available a direct reference to the Time object.

Also, the time text is not used outside the draw() callback method, so it should be a local text reference and not an @text instance reference.

      time = shadowinfo["ShadowTime"]
      text = time.to_s
      view.draw_text([30, 30], text, {size: 18, color: [80, 80, 80]})

Now you can call the #hour, #day, (and other methods) on the time object.

What you do with the data from the time object is your decision.

1 Like