// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. namespace osu.Game.Rulesets.UI.Scrolling.Algorithms { public interface IScrollAlgorithm { /// /// Given a point in time associated with an object's origin /// and the spatial distance between the edge and the origin of the object along the scrolling axis, /// computes the time at which the object initially enters the time range. /// /// /// Let's assume the following parameters: /// /// = 7000ms, /// = 100px, /// = 5000ms, /// = 1000px /// /// and a constant scrolling rate. /// To arrive at the end of the scrolling container, the object's origin has to cover /// 1000 + 100 = 1100px /// so that the edge starts at the end of the scrolling container. /// One scroll length of 1000px covers 5000ms of time, so the time required to cover 1100px is equal to /// 5000 * (1100 / 1000) = 5500ms, /// and therefore the object should start being visible at /// 7000 - 5500 = 1500ms. /// /// The time point at which the object origin should enter the time range. /// The spatial distance between the object's edge and its origin along the scrolling axis. /// The amount of visible time. /// The absolute spatial length through . /// The time at which the object should enter the time range. double GetDisplayStartTime(double originTime, float offset, double timeRange, float scrollLength); /// /// Computes the spatial length within a start and end time. /// /// The start time. /// The end time. /// The amount of visible time. /// The absolute spatial length through . /// The absolute spatial length. float GetLength(double startTime, double endTime, double timeRange, float scrollLength); /// /// Given the current time, computes the spatial position of a point in time. /// /// The time to compute the spatial position of. /// The current time. /// The amount of visible time. /// The absolute spatial length through . /// The absolute spatial position. float PositionAt(double time, double currentTime, double timeRange, float scrollLength); /// /// Computes the time which brings a point to a provided spatial position given the current time. /// /// The absolute spatial position. /// The current time. /// The amount of visible time. /// The absolute spatial length through . /// The time at which == . double TimeAt(float position, double currentTime, double timeRange, float scrollLength); /// /// Resets this to a default state. /// void Reset(); } }