use of gregtech.api.util.interpolate.Interpolator in project GregTech by GregTechCEu.
the class TerminalMenuWidget method showMenu.
@SideOnly(Side.CLIENT)
public void showMenu() {
if (isHide && interpolator == null) {
setVisible(true);
int y = getSelfPosition().y;
interpolator = new Interpolator(getSelfPosition().x, getSelfPosition().x + getSize().width, 6, Eases.EaseLinear, value -> setSelfPosition(new Position(value.intValue(), y)), value -> {
interpolator = null;
isHide = false;
});
interpolator.start();
os.desktop.addTopWidget(this);
}
}
use of gregtech.api.util.interpolate.Interpolator in project GregTech by GregTechCEu.
the class GuidePageEditorWidget method moveUp.
public void moveUp(Widget widget) {
int index = stream.indexOf(widget);
if (index > 0) {
Widget target = stream.get(index - 1);
if (interpolator == null) {
int offsetD = 5 + widget.getSize().height;
int offsetU = widget.getPosition().y - target.getPosition().y;
int y1 = widget.getSelfPosition().y;
int y2 = target.getSelfPosition().y;
interpolator = new Interpolator(0, 1, 10, Eases.EaseLinear, value -> {
widget.setSelfPosition(new Position(widget.getSelfPosition().x, (int) (y1 - value.floatValue() * offsetU)));
target.setSelfPosition(new Position(target.getSelfPosition().x, (int) (y2 + value.floatValue() * offsetD)));
if (widget == selected) {
setToolButton(selected);
}
widget.setVisible(widget.getSelfPosition().y < scrollYOffset + getSize().height && widget.getSelfPosition().y + widget.getSize().height > 0);
target.setVisible(target.getSelfPosition().y < scrollYOffset + getSize().height && target.getSelfPosition().y + target.getSize().height > 0);
}, value -> {
interpolator = null;
stream.remove(widget);
stream.add(index - 1, widget);
}).start();
}
} else {
int index2 = fixed.indexOf(widget);
if (index2 >= 0 && index2 < fixed.size() - 1) {
Widget target = fixed.get(index2 + 1);
fixed.remove(widget);
fixed.add(index2 + 1, widget);
}
}
}
use of gregtech.api.util.interpolate.Interpolator in project GregTech by GregTechCEu.
the class GuidePageWidget method jumpToRef.
public void jumpToRef(String ref) {
if (interpolator != null && !interpolator.isFinish())
return;
for (Widget widget : widgets) {
if (widget instanceof IGuideWidget && ref.equals(((IGuideWidget) widget).getRef())) {
interpolator = new Interpolator(scrollYOffset, widget.getSelfPosition().y + scrollYOffset, 20, Eases.EaseQuadOut, value -> setScrollYOffset(value.intValue()), value -> interpolator = null);
interpolator.start();
}
}
}
use of gregtech.api.util.interpolate.Interpolator in project GregTech by GregTechCEu.
the class AnimaWidgetGroup method maximizeWidget.
@SideOnly(Side.CLIENT)
public final void maximizeWidget(Consumer<AnimaWidgetGroup> callback) {
this.scale = 0;
setVisible(true);
interpolator = new Interpolator(0, 1, 10, Eases.EaseLinear, value -> scale = value.floatValue(), value -> {
interpolator = null;
if (callback != null) {
callback.accept(this);
}
});
interpolator.start();
}
use of gregtech.api.util.interpolate.Interpolator in project GregTech by GregTechCEu.
the class AnimaWidgetGroup method minimizeWidget.
@SideOnly(Side.CLIENT)
public final void minimizeWidget(Consumer<AnimaWidgetGroup> callback) {
this.scale = 1;
interpolator = new Interpolator(1, 0, 10, Eases.EaseLinear, value -> scale = value.floatValue(), value -> {
setVisible(false);
interpolator = null;
if (callback != null) {
callback.accept(this);
}
});
interpolator.start();
}
Aggregations