瀏覽代碼

Offset the timing of the pulsing animation

Scott Lahteine 10 年之前
父節點
當前提交
69240d41b0
共有 1 個檔案被更改,包括 6 行新增4 行删除
  1. 6
    4
      Marlin/configurator/js/configurator.js

+ 6
- 4
Marlin/configurator/js/configurator.js 查看文件

@@ -62,7 +62,8 @@ var configuratorApp = (function(){
62 62
       therms_list = {},
63 63
       total_config_lines,
64 64
       total_config_adv_lines,
65
-      hover_timer;
65
+      hover_timer,
66
+      pulse_offset = 0;
66 67
 
67 68
   // Return this anonymous object as configuratorApp
68 69
   return {
@@ -142,12 +143,13 @@ var configuratorApp = (function(){
142 143
         $('#message').prepend($err);
143 144
         var baseColor = $err.css('color').replace(/rgba?\(([^),]+,[^),]+,[^),]+).*/, 'rgba($1,');
144 145
         var d = new Date();
145
-        err.startTime = d.getTime();
146
+        err.pulse_offset = (pulse_offset += 200);
147
+        err.startTime = d.getTime() + pulse_offset;
146 148
         err.pulser = setInterval(function(){
147 149
             d = new Date();
148
-            var pulse_time = (d.getTime() - err.startTime);
150
+            var pulse_time = d.getTime() + err.pulse_offset;
149 151
             $err.css({color:baseColor+(0.5+Math.sin(pulse_time/200)*0.4)+')'});
150
-            if (pulse_time > 5000) {
152
+            if (pulse_time - err.startTime > 5000) {
151 153
               clearInterval(err.pulser);
152 154
               $err.remove();
153 155
             }

Loading…
取消
儲存