95 graphics.moveTo(0, prHeight1); |
95 graphics.moveTo(0, prHeight1); |
96 graphics.lineTo(sceneWidth, prHeight1); |
96 graphics.lineTo(sceneWidth, prHeight1); |
97 graphics.endFill(); |
97 graphics.endFill(); |
98 stage.addChild(graphics); |
98 stage.addChild(graphics); |
99 |
99 |
100 function moveContainer() { |
100 |
|
101 function moveContainer(){ |
101 container1.x -= pixelsPerSecond1/manualFramerate; |
102 container1.x -= pixelsPerSecond1/manualFramerate; |
102 container2.x -= pixelsPerSecond2/manualFramerate; |
103 container2.x -= pixelsPerSecond2/manualFramerate; |
103 renderer.render(stage); |
104 renderer.render(stage); |
104 } |
105 } |
105 function moveContainerMore() { |
106 function replaceContainers(){ |
|
107 var diff = (Date.now() - timePageLoaded)/1000;// nb of seconds since page loaded |
|
108 //console.log("replace ! diff1 = ", container1.x - Math.floor(-diff*pixelsPerSecond1), ", diff 2 = ", container2.x - Math.floor(-diff*pixelsPerSecond2)); |
|
109 container1.x = Math.floor(-diff*pixelsPerSecond1); |
|
110 container2.x = Math.floor(-diff*pixelsPerSecond2); |
|
111 renderer.render(stage); |
|
112 } |
|
113 function moveContainerMore(){ |
106 container1.x -= 50*(pixelsPerSecond1/manualFramerate); |
114 container1.x -= 50*(pixelsPerSecond1/manualFramerate); |
107 container2.x -= 50*(pixelsPerSecond2/manualFramerate); |
115 container2.x -= 50*(pixelsPerSecond2/manualFramerate); |
108 renderer.render(stage); |
116 renderer.render(stage); |
109 } |
117 } |
110 function moveContainerRight() { |
118 function moveContainerRight(){ |
111 container1.x += 50*(pixelsPerSecond1/manualFramerate); |
119 container1.x += 50*(pixelsPerSecond1/manualFramerate); |
112 container2.x += 50*(pixelsPerSecond2/manualFramerate); |
120 container2.x += 50*(pixelsPerSecond2/manualFramerate); |
113 renderer.render(stage); |
121 renderer.render(stage); |
114 } |
122 } |
115 |
123 |
245 t.x = x + 2; |
253 t.x = x + 2; |
246 t.y = 2; |
254 t.y = 2; |
247 container2.addChild(t); |
255 container2.addChild(t); |
248 } |
256 } |
249 addLine(); |
257 addLine(); |
250 var moveInterval = window.setInterval(moveContainer, 1000/manualFramerate); |
258 var moveInterval = window.setInterval(replaceContainers, 1000/manualFramerate); |
|
259 // To be sure of synchronism, we replace the container with time calculting every minute |
|
260 //var replaceInterval = window.setInterval(replaceContainers, 60*1000); |
251 var verticalLinesInterval = false; |
261 var verticalLinesInterval = false; |
252 if(drawVerticalLines){ |
262 if(drawVerticalLines){ |
253 verticalLinesInterval = window.setInterval(addLine, lineInterval); |
263 verticalLinesInterval = window.setInterval(addLine, lineInterval); |
254 } |
264 } |
255 var nbSec = 0; |
265 var nbSec = 0; |