Hourglass can start at any percentage
This breaks the css-purity of our mixin but is necessary in order to apply the initial offset of the hourglass animation dynamically, since jquery can't manipulate arbitrary css on psuedo elements.
This commit is contained in:
parent
5f92ccd524
commit
bd713352e3
4 changed files with 19 additions and 20 deletions
|
@ -135,7 +135,11 @@
|
|||
},
|
||||
renderExpiring: function() {
|
||||
if (this.model.isExpiring()) {
|
||||
this.$('.hourglass').css('animation-duration', this.model.msTilExpire()*0.001 + 's');
|
||||
var totalTime = this.model.get('expireTimer') * 1000;
|
||||
var remainingTime = this.model.msTilExpire();
|
||||
this.$('.hourglass .sand')
|
||||
.css('animation-duration', remainingTime*0.001 + 's')
|
||||
.css('transform', 'translateY(' + 100*(1 - (remainingTime / totalTime)) + '%)');
|
||||
this.$el.addClass('expiring');
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue