[NO-PARSE]class ColorPhase {
btn: HTMLElement;
token: number;
hue: number;
constructor(element: HTMLElement) {
this.btn = element;
this.btn.style.backgroundColor = 'hsla(0, 50%, 45%, 1)';
this.hue = 0;
}
morph() {
this.hue = (this.hue + 1) % 360;
return 'hsla(' + this.hue + ', 50%, 45%, 1)';
}
start() {
this.token = setInterval(() => this.btn.style.backgroundColor = this.morph(), 50);
}
stop() {
clearTimeout(this.token);
}
}
window.onload = () => {
var el = document.getElementById('color-phase');
var action = new ColorPhase(el);
action.start();
};[/NO-PARSE]