ironjr commited on
Commit
576c1a9
1 Parent(s): 018cf1b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +29 -7
app.py CHANGED
@@ -1065,8 +1065,6 @@ async () => {{
1065
  const animationTime = {opt.run_time + opt.prep_time};
1066
  const days = {opt.run_time};
1067
 
1068
- jQuery('#progress-time-fill, #death-group').css({{'animation-duration': animationTime+'s'}});
1069
-
1070
  var deadlineAnimation = function () {{
1071
  setTimeout(function() {{
1072
  jQuery('#designer-arm-grop').css({{'animation-duration': '1.5s'}});
@@ -1132,12 +1130,36 @@ async () => {{
1132
  }}
1133
 
1134
  var runAnimation = function() {{
1135
- timer(animationTime, days);
1136
- remation();
1137
- deadlineText({opt.run_time});
1138
-
1139
- console.log('begin interval', animationTime * 1000);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1140
  }};
 
1141
  runAnimation();
1142
  }}
1143
  """
 
1065
  const animationTime = {opt.run_time + opt.prep_time};
1066
  const days = {opt.run_time};
1067
 
 
 
1068
  var deadlineAnimation = function () {{
1069
  setTimeout(function() {{
1070
  jQuery('#designer-arm-grop').css({{'animation-duration': '1.5s'}});
 
1130
  }}
1131
 
1132
  var runAnimation = function() {{
1133
+ var imgSrc = jQuery('#output-screen > button > div > img').src;
1134
+ var state = false;
1135
+ var timerMain = setInterval(checkAndRun, 250);
1136
+
1137
+ function checkAndRun() {{
1138
+ var imgSrcNew = jQuery('#output-screen > button > div > img').src;
1139
+
1140
+ if (!state) {{
1141
+ if (imgSrc == imgSrcNew) {{
1142
+ // Do nothing.
1143
+ deadlineTextBegin();
1144
+ }} else {{
1145
+ // Running = True
1146
+ state = true;
1147
+
1148
+ // Run the main animation just once.
1149
+ jQuery('#progress-time-fill, #death-group').css({{'animation-duration': animationTime+'s'}});
1150
+ timer(animationTime, days);
1151
+ deadlineAnimation();
1152
+ deadlineText({opt.run_time});
1153
+ console.log('begin interval', animationTime * 1000);
1154
+ }}
1155
+ }} else {{
1156
+ // End the function.
1157
+ state = false;
1158
+ clearInterval(timerMain);
1159
+ }}
1160
+ }}
1161
  }};
1162
+
1163
  runAnimation();
1164
  }}
1165
  """