MCPcopy Index your code
hub / github.com/VolmitSoftware/Adapt / scroll

Method scroll

src/main/java/com/volmit/adapt/util/Form.java:72–80  ·  view source on GitHub ↗

Scroll text @param smx the text @param viewport the viewport length @param time the timeline value

(String smx, int viewport, long time)

Source from the content-addressed store, hash-verified

70 * @param time the timeline value
71 */
72 public static String scroll(String smx, int viewport, long time) {
73 String src = Form.repeat(" ", viewport) + smx + Form.repeat(" ", viewport);
74 int len = src.length();
75 int walk = (int) (time % (len - viewport));
76 String base = src.substring(walk, M.min(walk + viewport, len - 1));
77 base = base.length() < viewport ? base + Form.repeat(" ", (viewport - base.length()) - 3) : base;
78
79 return base;
80 }
81
82 /**
83 * Capitalize the first letter

Callers

nothing calls this directly

Calls 3

repeatMethod · 0.95
minMethod · 0.95
lengthMethod · 0.45

Tested by

no test coverage detected