Skip to content
Snippets Groups Projects
Commit 42927dc7 authored by Tilman Vatteroth's avatar Tilman Vatteroth :robot:
Browse files

ticklimit für scrollgeschwindigkeit

parent d329f7ee
No related branches found
No related tags found
No related merge requests found
...@@ -11,7 +11,8 @@ this.loaded = function(panel, config) { ...@@ -11,7 +11,8 @@ this.loaded = function(panel, config) {
font = "vrr", font = "vrr",
baseline = 0.7, baseline = 0.7,
textID = -1, textID = -1,
amount = 5, amount = 2,
ticklimit = 10,
delay = 2, delay = 2,
width = 0, width = 0,
height = 0, height = 0,
...@@ -19,7 +20,8 @@ this.loaded = function(panel, config) { ...@@ -19,7 +20,8 @@ this.loaded = function(panel, config) {
marquee = null, marquee = null,
mctx = null, mctx = null,
strings = [], strings = [],
texts = []; texts = []
;
init = function() { init = function() {
marquee = $(panel).find('[data-marquee]')[0]; marquee = $(panel).find('[data-marquee]')[0];
...@@ -46,7 +48,13 @@ this.loaded = function(panel, config) { ...@@ -46,7 +48,13 @@ this.loaded = function(panel, config) {
left = left * width / oldWidth; left = left * width / oldWidth;
} }
var lastRenderTime = 0;
render = function(delta) { render = function(delta) {
if (delta-lastRenderTime <= ticklimit) {
window.requestAnimationFrame(render);
return;
}
lastRenderTime=delta;
if (left > -texts[textID].width) { if (left > -texts[textID].width) {
left = left - (amount > 0 ? amount : 1); left = left - (amount > 0 ? amount : 1);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment