mr-crocs-adventures/js/ui/UserInterfaceElement.js

38 lines
737 B
JavaScript
Raw Permalink Normal View History

import GeometryPoint from "../geometry/GeometryPoint.js";
export default class UserInterfaceElement
{
constructor()
{
this.position = new GeometryPoint(0, 0);
this.isVisible = true;
}
setPosition(x, y)
{
this.position.x = x;
this.position.y = y;
}
hide(timeoutMilliseconds = 0)
{
setTimeout(
() => {
this.isVisible = false
}, timeoutMilliseconds
);
}
show(timeoutMilliseconds = 0)
{
if (timeoutMilliseconds > 0) {
this.isVisible = false;
}
setTimeout(
() => {
this.isVisible = true;
}, timeoutMilliseconds
);
}
}