|
@@ -22,7 +22,7 @@ interface AnimationInstruction {
|
|
|
module Elements.AnimationHandler {
|
|
|
var container = document.getElementById("sceneAnimation");
|
|
|
var stop = true;
|
|
|
- export var originalSpriteSize = 200; // TODO: If ever get an actual artist, increase original sprite size to whatever new art goes for.
|
|
|
+ export var spriteSize = 200;
|
|
|
export var animations : Array<AnimationLayer> = [];
|
|
|
export var animationSpeed = 1500; // how long to complete in ms
|
|
|
export var lastTime = 0;
|
|
@@ -36,6 +36,7 @@ module Elements.AnimationHandler {
|
|
|
}
|
|
|
|
|
|
export function addAnimations (...names : Array<AnimationInstruction>) {
|
|
|
+ fixVerticalPosition();
|
|
|
for (let i = 0; i < names.length; i++) {
|
|
|
let newAnim = new AnimationLayer(names[i].name, names[i].layer);
|
|
|
container.appendChild(newAnim.getElement());
|
|
@@ -71,12 +72,15 @@ module Elements.AnimationHandler {
|
|
|
}
|
|
|
|
|
|
function fixVerticalPosition () {
|
|
|
- let availHeight = getSize(true);
|
|
|
+ spriteSize = getSize(true);
|
|
|
//container.style.marginBottom = (availHeight - 200) + "px";
|
|
|
- container.style.transform = "scale(" + availHeight / originalSpriteSize + ")";
|
|
|
- container.style.bottom = (availHeight - originalSpriteSize) / 2 + "px";
|
|
|
- container.style.width = originalSpriteSize + "px";
|
|
|
- container.style.height = originalSpriteSize + "px";
|
|
|
+ container.style.width = spriteSize + "px";
|
|
|
+ container.style.marginLeft = "-" + (spriteSize / 2) + "px";
|
|
|
+ container.style.height = spriteSize + "px";
|
|
|
+
|
|
|
+ animations.forEach((anim) => {
|
|
|
+ anim.updateSize();
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
export function getSize (fixMin = true) {
|
|
@@ -84,10 +88,6 @@ module Elements.AnimationHandler {
|
|
|
//let tab1 = document.getElementById("roomName");
|
|
|
//tab1.style.marginTop = "";
|
|
|
let height = window.innerHeight - tab.clientHeight;
|
|
|
- if (fixMin && height < originalSpriteSize) {
|
|
|
- //tab1.style.marginTop = (200 - height) + "px";
|
|
|
- //height = 200;
|
|
|
- }
|
|
|
return height;
|
|
|
}
|
|
|
|