|
@@ -3,6 +3,7 @@
|
|
|
class AnimationLayer {
|
|
|
private cStep = 0;
|
|
|
private totalSteps = 9;
|
|
|
+ private frameSize = 200;
|
|
|
|
|
|
private el = document.createElement("a");
|
|
|
|
|
@@ -16,14 +17,21 @@ class AnimationLayer {
|
|
|
if (style == undefined || style.width == undefined) {
|
|
|
console.error("Animation " + filename + " not found.");
|
|
|
} else {
|
|
|
- this.totalSteps = (parseInt(style.width.slice(0,-2)) / 200);
|
|
|
+ let height = (parseInt(style.height.slice(0,-2)));
|
|
|
+ this.frameSize = height;
|
|
|
+ this.totalSteps = (parseInt(style.width.slice(0,-2)) / height);
|
|
|
+ this.el.style.transform = "scale(" + (Elements.AnimationHandler.originalSpriteSize / height) + ")";
|
|
|
+ this.el.style.width = height + "px";
|
|
|
+ this.el.style.height = height + "px";
|
|
|
+ this.el.style.marginLeft = "-" + height/2 + "px";
|
|
|
+ this.el.style.marginTop = "-" + height/2 + "px";
|
|
|
}
|
|
|
this.el.classList.add("anims-" + filename);
|
|
|
}
|
|
|
|
|
|
public updateSprite (percentage : number) {
|
|
|
this.cStep = Math.floor(percentage * this.totalSteps);
|
|
|
- this.el.style.backgroundPositionX = "-" + (this.cStep * 200) + "px";
|
|
|
+ this.el.style.backgroundPositionX = "-" + (this.cStep * this.frameSize) + "px";
|
|
|
}
|
|
|
|
|
|
public getElement () {
|