rokojori_action_library/Runtime/Time/TimeLineSpan.cs

43 lines
748 B
C#
Raw Normal View History

2024-05-19 15:59:41 +00:00
using System.Diagnostics;
using System.Collections;
using System.Collections.Generic;
using System;
using Godot;
2026-05-22 12:25:02 +00:00
using Rokojori.Extensions;
2024-05-19 15:59:41 +00:00
namespace Rokojori
{
2026-05-22 12:25:02 +00:00
public enum TimelineSpanUpdateType
2025-01-08 18:46:17 +00:00
{
Start,
InSpan,
End,
CompletelyInside
}
2024-05-19 15:59:41 +00:00
2026-05-22 12:25:02 +00:00
public class TimelineSpan
2025-01-08 18:46:17 +00:00
{
public int id;
2024-05-19 15:59:41 +00:00
public bool persistent;
2025-01-08 18:46:17 +00:00
public float start;
public float end;
2025-01-03 12:09:23 +00:00
public bool wasInside = false;
2026-05-22 12:25:02 +00:00
public Timeline timeLine;
2025-01-19 20:35:51 +00:00
2026-05-22 12:25:02 +00:00
public Action<TimelineSpan, TimelineSpanUpdateType> callback;
2025-01-19 20:35:51 +00:00
public float duration => end - start;
2026-02-12 09:48:23 +00:00
public float elapsed => timeLine.position - start ;
2025-01-19 20:35:51 +00:00
public float phase
{
get
{
2026-02-12 09:48:23 +00:00
return Mathf.Clamp( elapsed / duration, 0, 1 );
2025-01-19 20:35:51 +00:00
}
}
2024-05-19 15:59:41 +00:00
}
}