hide sliderticks that the ball already passed
This commit is contained in:
parent
8171cfdec6
commit
766e3657c7
|
@ -252,20 +252,9 @@ public class Slider extends GameObject {
|
||||||
|
|
||||||
// ticks
|
// ticks
|
||||||
if (ticksT != null) {
|
if (ticksT != null) {
|
||||||
float tickScale = 0.5f + 0.5f * AnimationEquation.OUT_BACK.calc(decorationsAlpha);
|
drawSliderTicks(g, trackPosition, curveAlpha, decorationsAlpha, mirror);
|
||||||
Image tick = GameImage.SLIDER_TICK.getImage().getScaledCopy(tickScale);
|
|
||||||
for (int i = 0; i < ticksT.length; i++) {
|
|
||||||
Vec2f c = curve.pointAt(ticksT[i]);
|
|
||||||
Colors.WHITE_FADE.a = Math.min(curveAlpha, decorationsAlpha);
|
|
||||||
g.pushTransform();
|
|
||||||
if (mirror) {
|
|
||||||
g.rotate(c.x, c.y, -180f);
|
|
||||||
}
|
|
||||||
tick.drawCentered(c.x, c.y, Colors.WHITE_FADE);
|
|
||||||
g.popTransform();
|
|
||||||
Colors.WHITE_FADE.a = alpha;
|
Colors.WHITE_FADE.a = alpha;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
g.pushTransform();
|
g.pushTransform();
|
||||||
if (mirror) {
|
if (mirror) {
|
||||||
|
@ -375,6 +364,38 @@ public class Slider extends GameObject {
|
||||||
color = orig;
|
color = orig;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void drawSliderTicks(Graphics g, int trackPosition, float curveAlpha, float decorationsAlpha, boolean mirror) {
|
||||||
|
float tickScale = 0.5f + 0.5f * AnimationEquation.OUT_BACK.calc(decorationsAlpha);
|
||||||
|
Image tick = GameImage.SLIDER_TICK.getImage().getScaledCopy(tickScale);
|
||||||
|
|
||||||
|
// calculate which ticks need to be drawn (don't draw if sliderball crossed it)
|
||||||
|
int min = 0;
|
||||||
|
int max = ticksT.length;
|
||||||
|
if (trackPosition > getTime()) {
|
||||||
|
for (int i = 0; i < ticksT.length; ) {
|
||||||
|
if (((trackPosition - getTime()) % sliderTime) / sliderTime < ticksT[i]) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
min = ++i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (currentRepeats % 2 == 1) {
|
||||||
|
max -= min;
|
||||||
|
min = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = min; i < max; i++) {
|
||||||
|
Vec2f c = curve.pointAt(ticksT[i]);
|
||||||
|
Colors.WHITE_FADE.a = Math.min(curveAlpha, decorationsAlpha);
|
||||||
|
g.pushTransform();
|
||||||
|
if (mirror) {
|
||||||
|
g.rotate(c.x, c.y, -180f);
|
||||||
|
}
|
||||||
|
tick.drawCentered(c.x, c.y, Colors.WHITE_FADE);
|
||||||
|
g.popTransform();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private boolean drawSliderTrack(int trackPosition, float snakingSliderProgress) {
|
private boolean drawSliderTrack(int trackPosition, float snakingSliderProgress) {
|
||||||
float curveIntervalTo = Options.isSliderSnaking() ? snakingSliderProgress : 1f;
|
float curveIntervalTo = Options.isSliderSnaking() ? snakingSliderProgress : 1f;
|
||||||
float curveIntervalFrom = 0f;
|
float curveIntervalFrom = 0f;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user