I made a simplified model of status bars based on the HiEv status bar, I tried to add the bar to UiBar but according to what I understood the elements of UiBar are reloaded each time the pass changes, so the transitions never happen.
window.statusBar = function(CurST, MaxST, BarID) {
var ST = parseInt((CurST / MaxST) * 100);
if (ST < 0) { ST = 0 }
else if (ST > 100) { ST = 100 };
let BarElement = $(document).find("#" + BarID);
BarElement.css( { width : ST + "%" } );
BarElement.attr("title", CurST + "/" + MaxST + " EN");
$(document).find("." + BarID + "Base").attr("title", CurST + "/" + MaxST + " ST");
};
Then on the storycaption
<<set _curHP = $characters.player.health.curHP,
_maxHP = $characters.player.health.maxHP
>>\
<div class="charmText UiName"><<= $mcName>> <<= $mcSurname>><hr></div>
<div id="statusbarBase1" class="statusBase1">\
<div id="statusBase1" class="statusCenter1">\
<span class="statusWord">Health</span>
</div>
</div>\
<<run statusBar(_curHP, _maxHP, 'statusBase1')>>\
The CSS
.statusBase1 {
position: relative;
left: -15px;
height: 45px;
width: 110%;
background-color: #110;
border-radius: 1px;
z-index: 1;
visibility: visible;
border: 3px solid black;
margin-bottom: 5px;
margin-top: 5px;
}
.statusCenter1 {
position: absolute;
bottom: 0px;
left: 0px;
height: 45px;
background-color: transparent;
border-radius: 1px;
z-index: 2;
background-color: lightblue;
transition: width 2s, background-color 2s;
}
Any way to fix this?
Twine Version: Twine 2
Story Format: Sugarcube 2