Help: Infinite loop with tween?
in
Contributed Library Questions
•
22 days ago
Hi—
I'm relatively new to Processing. I'm playing with a Tweening example. Is it possible to make this "tween" run for an infinite amount of time?
import ijeoma.motion.*;
import ijeoma.motion.tween.*;
import processing.core.*;
Tween t;
int c1, c2, c3, c4, c5, c6, c7;
void setup() {
size(1400, 300);
smooth();
c1 = color(209, 0, 0);
c2 = color(255, 102, 34);
c3 = color(255, 218, 33);
c4 = color(51, 221, 0);
c5 = color(17, 51, 204);
c6 = color(34, 0, 102);
c7 = color(51, 0, 68);
Motion.setup(this);
t = new Tween(0, width*height, 1000)
.addColor(this, "c1", color(random(255), random(255), random(255)))
.addColor(this, "c2", color(random(255), random(255), random(255)))
.addColor(this, "c3", color(random(255), random(255), random(255)))
.addColor(this, "c4", color(random(255), random(255), random(255)))
.addColor(this, "c5", color(random(255), random(255), random(255)))
.addColor(this, "c6", color(random(255), random(255), random(255)))
.addColor(this, "c7", color(random(255), random(255), random(255)));
t.play();
}
void draw() {
background(255);
noStroke();
fill(c1);
rect(0, 0, width / 7, height);
fill(c2);
rect(200, 0, width / 7, height);
fill(c3);
rect(400, 0, width / 7, height);
fill(c4);
rect(600, 0, width / 7, height);
fill(c5);
rect(800, 0, width / 7, height);
fill(c6);
rect(1000, 0, width / 7, height);
fill(c7);
rect(1200, 0, width / 7, height);
}
I'm relatively new to Processing. I'm playing with a Tweening example. Is it possible to make this "tween" run for an infinite amount of time?
import ijeoma.motion.*;
import ijeoma.motion.tween.*;
import processing.core.*;
Tween t;
int c1, c2, c3, c4, c5, c6, c7;
void setup() {
size(1400, 300);
smooth();
c1 = color(209, 0, 0);
c2 = color(255, 102, 34);
c3 = color(255, 218, 33);
c4 = color(51, 221, 0);
c5 = color(17, 51, 204);
c6 = color(34, 0, 102);
c7 = color(51, 0, 68);
Motion.setup(this);
t = new Tween(0, width*height, 1000)
.addColor(this, "c1", color(random(255), random(255), random(255)))
.addColor(this, "c2", color(random(255), random(255), random(255)))
.addColor(this, "c3", color(random(255), random(255), random(255)))
.addColor(this, "c4", color(random(255), random(255), random(255)))
.addColor(this, "c5", color(random(255), random(255), random(255)))
.addColor(this, "c6", color(random(255), random(255), random(255)))
.addColor(this, "c7", color(random(255), random(255), random(255)));
t.play();
}
void draw() {
background(255);
noStroke();
fill(c1);
rect(0, 0, width / 7, height);
fill(c2);
rect(200, 0, width / 7, height);
fill(c3);
rect(400, 0, width / 7, height);
fill(c4);
rect(600, 0, width / 7, height);
fill(c5);
rect(800, 0, width / 7, height);
fill(c6);
rect(1000, 0, width / 7, height);
fill(c7);
rect(1200, 0, width / 7, height);
}
1