Slow Motion
in
Programming Questions
•
1 year ago
I'm looking for a way to move an object sloooowly across the window -- and also smooooothly. This would undoubtedly require anti-aliasing, and smooth() doesn't do the job. Here's my test code:
PImage img;
float ctr = 0.0;
void setup() {
size(800, 600);
img = loadImage("foo.jpg");
smooth();
}
void draw() {
background(255, 255, 200);
ctr += 0.01;
translate(ctr, ctr * 0.8);
image (img, 10, 10);
rect (200, 200, 50, 50);
}
What happens with this test is, the displayed objects jerk visibly, either down or to the right, one pixel at a time. I would like to get rid of the jerky, jittery aspect of the motion. (Moving the counter addition into the image() or rect() call itself has no effect -- that seems to be functionally identical to using translate()).
I suppose one answer might be, "Use a new Mac with a Retina display," but I'm hoping to learn a way to make the effect work even on a computer that lacks a totally hi-res display.
Is there any way to make this work? Thanks for any tips!
--Jim Aikin
1