JB
Jordan Brown
Sun, Jul 6, 2025 10:06 PM
Here's another demo that might help clarify.
hwidth = 5;
hlength = 30;
hcolor = "black";
mwidth = 3;
mlength = 50;
mcolor = "black";
swidth = 2;
slength = 50;
scolor = "red";
module hand(w, l, c) {
color(c)
translate([-w/2,0,0])
square([w,l]);
}
rotate(-$t*360) hand(hwidth, hlength, hcolor);
rotate(-$t*360*12) hand(mwidth, mlength, mcolor);
rotate(-$t*360*12*60) hand(swidth, slength, scolor);
It's a clock.
One cycle of $t is twelve hours - the time that it takes the hour hand
to go around one time, the minute hand to go around 720 times, and the
second hand to go around 43,200 times.
That's the obvious way to implement a standard 12-hour clock. There are
no short cuts possible, because that's the only combination that goes
through all possible combinations of the three hands.
How jumpy is it? How long does the animation actually take to run?
That isn't in the program; that's in the animation parameters. If you
set it to 1 FPS and 43,200 frames, it'll run at roughly normal time, so
it will take about 12 hours to complete, and the second hand will click
forward one second in each frame. If you set it to 2FPS and 86,400
frames, it'll still take 12h to complete, but the second hand will move
a little smoother. If you set it to 10FPS and 864,000 frames, the
second hand should be pretty smooth. (But my system doesn't seem able
to maintain 10FPS, so I'll only get that if I capture the images and
turn them into a video file.)
But if I want all three hands, and I don't want the second hand to jump
more than a second at a time, I need at least 43,200 frames... there's
just no two ways around it.
Here's another demo that might help clarify.
hwidth = 5;
hlength = 30;
hcolor = "black";
mwidth = 3;
mlength = 50;
mcolor = "black";
swidth = 2;
slength = 50;
scolor = "red";
module hand(w, l, c) {
color(c)
translate([-w/2,0,0])
square([w,l]);
}
rotate(-$t*360) hand(hwidth, hlength, hcolor);
rotate(-$t*360*12) hand(mwidth, mlength, mcolor);
rotate(-$t*360*12*60) hand(swidth, slength, scolor);
It's a clock.
One cycle of $t is twelve hours - the time that it takes the hour hand
to go around one time, the minute hand to go around 720 times, and the
second hand to go around 43,200 times.
That's the obvious way to implement a standard 12-hour clock. There are
no short cuts possible, because that's the only combination that goes
through all possible combinations of the three hands.
How jumpy is it? How long does the animation actually take to run?
That isn't in the program; that's in the animation parameters. If you
set it to 1 FPS and 43,200 frames, it'll run at roughly normal time, so
it will take about 12 hours to complete, and the second hand will click
forward one second in each frame. If you set it to 2FPS and 86,400
frames, it'll still take 12h to complete, but the second hand will move
a little smoother. If you set it to 10FPS and 864,000 frames, the
second hand should be pretty smooth. (But my system doesn't seem able
to maintain 10FPS, so I'll only get that if I capture the images and
turn them into a video file.)
But if I want all three hands, and I don't want the second hand to jump
more than a second at a time, I need at least 43,200 frames... there's
just no two ways around it.
JB
Jordan Brown
Sun, Jul 6, 2025 10:08 PM
On 7/6/2025 2:45 PM, Caddiy via Discuss wrote:
If there are two circles, each following opposite 180° arcs, could
they be alternately hidden to give the appearance of one circle
orbiting continuously?
No, because you need that one circle to go all the way around. If, say,
you want to avoid jumps larger than one degree, you must have at least
360 frames, because there are 360 different places that the circle can be.
You can't make one iteration of the animation be different from the next
iteration... because then they would be two different animations.
On 7/6/2025 2:45 PM, Caddiy via Discuss wrote:
> If there are two circles, each following opposite 180° arcs, could
> they be alternately hidden to give the appearance of one circle
> orbiting continuously?
No, because you need that one circle to go all the way around. If, say,
you want to avoid jumps larger than one degree, you *must* have at least
360 frames, because there are 360 different places that the circle can be.
You can't make one iteration of the animation be different from the next
iteration... because then they would be two different animations.
M
mikeonenine@web.de
Sun, Jul 6, 2025 10:27 PM
If, say, you want to avoid jumps larger than one degree, you must have at least
360 frames, because there are 360 different places that the circle can be.
180 + 180 = 360.
With the code I posted earlier on, the two circles don’t jump. But I want one circle. Surely it’s just a matter of hiding them alternately, so it looks like one circle?
Nophead came up with if($t < 0.5)
but how could it be timed +$t*90
and -$t*90
respectively for each circle, to hide the circles alternately?
Jordan Brown wrote:
> If, say, you want to avoid jumps larger than one degree, you *must* have at least
> 360 frames, because there are 360 different places that the circle can be.
180 + 180 = 360.
With the code I posted earlier on, the two circles don’t jump. But I want one circle. Surely it’s just a matter of hiding them alternately, so it looks like one circle?
Nophead came up with `if($t < 0.5)` but how could it be timed `+$t*90` and `-$t*90` respectively for each circle, to hide the circles alternately?
M
mikeonenine@web.de
Sun, Jul 6, 2025 10:29 PM
Here's another demo that might help clarify.
hwidth = 5;
hlength = 30;
hcolor = "black";
mwidth = 3;
mlength = 50;
mcolor = "black";
swidth = 2;
slength = 50;
scolor = "red";
module hand(w, l, c) {
color(c)
translate([-w/2,0,0])
square([w,l]);
}
rotate(-$t*360) hand(hwidth, hlength, hcolor);
rotate(-$t*360*12) hand(mwidth, mlength, mcolor);
rotate(-$t*360*12*60) hand(swidth, slength, scolor);
It's a clock.
One cycle of $t is twelve hours - the time that it takes the hour hand
to go around one time, the minute hand to go around 720 times, and the
second hand to go around 43,200 times.
That's the obvious way to implement a standard 12-hour clock. There are
no short cuts possible, because that's the only combination that goes
through all possible combinations of the three hands.
How jumpy is it? How long does the animation actually take to run?
That isn't in the program; that's in the animation parameters. If you
set it to 1 FPS and 43,200 frames, it'll run at roughly normal time, so
it will take about 12 hours to complete, and the second hand will click
forward one second in each frame. If you set it to 2FPS and 86,400
frames, it'll still take 12h to complete, but the second hand will move
a little smoother. If you set it to 10FPS and 864,000 frames, the
second hand should be pretty smooth. (But my system doesn't seem able
to maintain 10FPS, so I'll only get that if I capture the images and
turn them into a video file.)
But if I want all three hands, and I don't want the second hand to jump
more than a second at a time, I need at least 43,200 frames... there's
just no two ways around it.
Yes, that is exactly the problem I want to avoid, to keep things manageable.
Jordan Brown wrote:
> Here's another demo that might help clarify.
>
> ```
> hwidth = 5;
> hlength = 30;
> hcolor = "black";
> mwidth = 3;
> mlength = 50;
> mcolor = "black";
> swidth = 2;
> slength = 50;
> scolor = "red";
>
> module hand(w, l, c) {
> color(c)
> translate([-w/2,0,0])
> square([w,l]);
> }
>
> rotate(-$t*360) hand(hwidth, hlength, hcolor);
> rotate(-$t*360*12) hand(mwidth, mlength, mcolor);
> rotate(-$t*360*12*60) hand(swidth, slength, scolor);
> ```
>
> It's a clock.
>
> One cycle of $t is twelve hours - the time that it takes the hour hand
> to go around one time, the minute hand to go around 720 times, and the
> second hand to go around 43,200 times.
>
> That's the obvious way to implement a standard 12-hour clock. There are
> no short cuts possible, because that's the only combination that goes
> through all possible combinations of the three hands.
>
> How jumpy is it? How long does the animation actually take to run?
> That isn't in the program; that's in the animation parameters. If you
> set it to 1 FPS and 43,200 frames, it'll run at roughly normal time, so
> it will take about 12 hours to complete, and the second hand will click
> forward one second in each frame. If you set it to 2FPS and 86,400
> frames, it'll still take 12h to complete, but the second hand will move
> a little smoother. If you set it to 10FPS and 864,000 frames, the
> second hand should be pretty smooth. (But my system doesn't seem able
> to maintain 10FPS, so I'll only get that if I capture the images and
> turn them into a video file.)
>
> But if I want all three hands, and I don't want the second hand to jump
> more than a second at a time, I need at least 43,200 frames... there's
> just no two ways around it.
Yes, that is exactly the problem I want to avoid, to keep things manageable.
JB
Jordan Brown
Sun, Jul 6, 2025 10:42 PM
On 7/6/2025 3:27 PM, Caddiy via Discuss wrote:
Jordan Brown wrote:
If, say, you want to avoid jumps larger than one degree, you
/must/ have at least 360 frames, because there are 360 different
places that the circle can be.
180 + 180 = 360.
With the code I posted earlier on, the two circles don’t jump. But I
want one circle. Surely it’s just a matter of hiding them alternately,
so it looks like one circle?
What does "alternately" mean?
You make an animation that takes 10s to get a circle across the top.
You then need to spend the next 10s to get the circle across the bottom.
That's a 20s animation.
Print it onto film, so that we can talk about actual frames. You need a
sequence of frames that run the circle across the top, and a sequence of
frames that run it across the bottom. There's no trickery possible that
will somehow make the second time that you run the film be different
from the first time. The film simply must continue until the elements
return to their original positions.
Now, to be clear, "original positions" does not quite have its obvious
meaning. If you're animating a gear, each time you advance one tooth
you're back to something that looks the same, so you only need to
animate one tooth's worth. If you put a mark on the gear, though,
you're back to having to animate the entire rotation.
On 7/6/2025 3:27 PM, Caddiy via Discuss wrote:
>
> Jordan Brown wrote:
>
> If, say, you want to avoid jumps larger than one degree, you
> /must/ have at least 360 frames, because there are 360 different
> places that the circle can be.
>
> 180 + 180 = 360.
>
> With the code I posted earlier on, the two circles don’t jump. But I
> want one circle. Surely it’s just a matter of hiding them alternately,
> so it looks like one circle?
>
What does "alternately" mean?
You make an animation that takes 10s to get a circle across the top.
You then need to spend the next 10s to get the circle across the bottom.
That's a 20s animation.
Print it onto film, so that we can talk about actual frames. You need a
sequence of frames that run the circle across the top, and a sequence of
frames that run it across the bottom. There's no trickery possible that
will somehow make the second time that you run the film be different
from the first time. The film simply *must* continue until the elements
return to their original positions.
Now, to be clear, "original positions" does not quite have its obvious
meaning. If you're animating a gear, each time you advance one tooth
you're back to something that looks the same, so you only need to
animate one tooth's worth. If you put a mark on the gear, though,
you're back to having to animate the entire rotation.
M
mikeonenine@web.de
Sun, Jul 6, 2025 11:12 PM
What does "alternately" mean?
You make an animation that takes 10s to get a circle across the top.
You then need to spend the next 10s to get the circle across the bottom.
What I mean is:
You make an animation that takes 10s to get one circle across the top 180°*,* after which it disappears for 10s.
You then need to spend the next 10s to get the other circle across the bottom 180°*, after which it disappears for 10s.*
Then repeat the sequence.
What does if($t < 0.5)
mean in plain English? If $t is less than 0.5, then what? $t doesn’t go negative.
Jordan Brown wrote:
> What does "alternately" mean?
>
> You make an animation that takes 10s to get a circle across the top.
>
> You then need to spend the next 10s to get the circle across the bottom.
What I mean is:
You make an animation that takes 10s to get *one* circle across the top 180°*,* *after which it disappears for 10s.*
You then need to spend the next 10s to get the *other* circle across the bottom 180°*, after which it disappears for 10s.*
Then repeat the sequence.
What does `if($t < 0.5) `mean in plain English? If $t is less than 0.5, then what? $t doesn’t go negative.
JB
Jordan Brown
Sun, Jul 6, 2025 11:40 PM
On 7/6/2025 4:12 PM, Caddiy via Discuss wrote:
What I mean is:
You make an animation that takes 10s to get /one/ circle across the
top 180°/,/ /after which it disappears for 10s./
You then need to spend the next 10s to get the /other/ circle across
the bottom 180°/, after which it disappears for 10s./
That's a 20s animation.
Again, think of a loop of real film. To get a complete cycle, you need
10s of a circle going across the top, and 10s of a circle going across
the bottom, and then back to the start.You can't play the same 10s piece
of film twice and expect to get different images on the second time
through.
Then repeat the sequence.
What does |if($t < 0.5) |mean in plain English? If $t is less than
0.5, then what? $t doesn’t go negative.
Over the length of the animation, $t runs from 0 to 1. $t is less than
0.5 for the first half of the animation, and is greater than or equal to
0.5 for the second half of the animation.
The "if" is a standard OpenSCAD "if". It does whatever you tell it to,
when the condition is true.
For instance.
if ($t < 0.5)
square(10, center=true);
else
circle(d=10);
will be a square for the first half of the animation, and a circle for
the second half.
This will do exactly what you're suggesting:
if ($t < 0.5)
color("red") rotate($t*360) translate([10,0,0]) circle(3);
else
color("blue") rotate($t*360) translate([10,0,0]) circle(3);
But if you want it to take 10s for the red circle to go across the top
and 10s for the blue circle to go across the bottom, that's 20s. Set
the FPS to whatever you like, and set the number of frames to twenty
times that - so perhaps 5 and 100. That's what you must do if you want
the circle to change color, but if you wanted it to stay the same color
then all you need is
color("red") rotate($t*360) translate([10,0,0]) circle(3);
On 7/6/2025 4:12 PM, Caddiy via Discuss wrote:
>
> What I mean is:
>
> You make an animation that takes 10s to get /one/ circle across the
> top 180°/,/ /after which it disappears for 10s./
>
> You then need to spend the next 10s to get the /other/ circle across
> the bottom 180°/, after which it disappears for 10s./
>
That's a 20s animation.
Again, think of a loop of real film. To get a complete cycle, you need
10s of a circle going across the top, and 10s of a circle going across
the bottom, and then back to the start.You can't play the same 10s piece
of film twice and expect to get different images on the second time
through.
> Then repeat the sequence.
>
> What does |if($t < 0.5) |mean in plain English? If $t is less than
> 0.5, then what? $t doesn’t go negative.
>
Over the length of the animation, $t runs from 0 to 1. $t is less than
0.5 for the first half of the animation, and is greater than or equal to
0.5 for the second half of the animation.
The "if" is a standard OpenSCAD "if". It does whatever you tell it to,
when the condition is true.
For instance.
if ($t < 0.5)
square(10, center=true);
else
circle(d=10);
will be a square for the first half of the animation, and a circle for
the second half.
This will do exactly what you're suggesting:
if ($t < 0.5)
color("red") rotate($t*360) translate([10,0,0]) circle(3);
else
color("blue") rotate($t*360) translate([10,0,0]) circle(3);
But if you want it to take 10s for the red circle to go across the top
and 10s for the blue circle to go across the bottom, that's 20s. Set
the FPS to whatever you like, and set the number of frames to twenty
times that - so perhaps 5 and 100. That's what you must do if you want
the circle to change color, but if you wanted it to stay the same color
then all you need is
color("red") rotate($t*360) translate([10,0,0]) circle(3);
M
mikeonenine@web.de
Mon, Jul 7, 2025 1:05 AM
On 7/6/2025 4:12 PM, Caddiy via Discuss wrote:
What I mean is:
You make an animation that takes 10s to get /one/ circle across the
top 180°/,/ /after which it disappears for 10s./
You then need to spend the next 10s to get the /other/ circle across
the bottom 180°/, after which it disappears for 10s./
That's a 20s animation.
Again, think of a loop of real film. To get a complete cycle, you need
10s of a circle going across the top, and 10s of a circle going across
the bottom, and then back to the start.You can't play the same 10s piece
of film twice and expect to get different images on the second time
through.
Then repeat the sequence.
What does |if($t < 0.5) |mean in plain English? If $t is less than
0.5, then what? $t doesn’t go negative.
Over the length of the animation, $t runs from 0 to 1. $t is less than
0.5 for the first half of the animation, and is greater than or equal to
0.5 for the second half of the animation.
The "if" is a standard OpenSCAD "if". It does whatever you tell it to,
when the condition is true.
For instance.
if ($t < 0.5)
square(10, center=true);
else
circle(d=10);
will be a square for the first half of the animation, and a circle for
the second half.
This will do exactly what you're suggesting:
if ($t < 0.5)
color("red") rotate($t*360) translate([10,0,0]) circle(3);
else
color("blue") rotate($t*360) translate([10,0,0]) circle(3);
But if you want it to take 10s for the red circle to go across the top
and 10s for the blue circle to go across the bottom, that's 20s. Set
the FPS to whatever you like, and set the number of frames to twenty
times that - so perhaps 5 and 100. That's what you must do if you want
the circle to change color, but if you wanted it to stay the same color
then all you need is
color("red") rotate($t*360) translate([10,0,0]) circle(3);
Thanks. It works fine, but it’s too damn fast for me. It’s the standard $t*360 speed.
So it seems $t is the time and 360 is the distance around a full orbit. Unfortunately it is not possible to give the 360° extra time for it to go slower.
Would it be possible with $t*180 to use an “else” statement to tell it to disappear when it reaches $t = 1, then start again at 0 after an interval of $t = 1?
Jordan Brown wrote:
> On 7/6/2025 4:12 PM, Caddiy via Discuss wrote:
>
> > What I mean is:
> >
> > You make an animation that takes 10s to get /one/ circle across the
> > top 180°/,/ /after which it disappears for 10s./
> >
> > You then need to spend the next 10s to get the /other/ circle across
> > the bottom 180°/, after which it disappears for 10s./
>
> That's a 20s animation.
>
> Again, think of a loop of real film. To get a complete cycle, you need
> 10s of a circle going across the top, and 10s of a circle going across
> the bottom, and then back to the start.You can't play the same 10s piece
> of film twice and expect to get different images on the second time
> through.
>
> > Then repeat the sequence.
> >
> > What does |if($t < 0.5) |mean in plain English? If $t is less than
> > 0\.5, then what? $t doesn’t go negative.
>
> Over the length of the animation, $t runs from 0 to 1. $t is less than
> 0\.5 for the first half of the animation, and is greater than or equal to
> 0\.5 for the second half of the animation.
>
> The "if" is a standard OpenSCAD "if". It does whatever you tell it to,
> when the condition is true.
>
> For instance.
>
> ```
> if ($t < 0.5)
> square(10, center=true);
> else
> circle(d=10);
> ```
>
> will be a square for the first half of the animation, and a circle for
> the second half.
>
> This will do exactly what you're suggesting:
>
> ```
> if ($t < 0.5)
> color("red") rotate($t*360) translate([10,0,0]) circle(3);
> else
> color("blue") rotate($t*360) translate([10,0,0]) circle(3);
> ```
>
> But if you want it to take 10s for the red circle to go across the top
> and 10s for the blue circle to go across the bottom, that's 20s. Set
> the FPS to whatever you like, and set the number of frames to twenty
> times that - so perhaps 5 and 100. That's what you must do if you want
> the circle to change color, but if you wanted it to stay the same color
> then all you need is
>
> ```
> color("red") rotate($t*360) translate([10,0,0]) circle(3);
> ```
Thanks. It works fine, but it’s too damn fast for me. It’s the standard $t\*360 speed.
So it seems $t is the time and 360 is the distance around a full orbit. Unfortunately it is not possible to give the 360° extra time for it to go slower.
Would it be possible with $t\*180 to use an “else” statement to tell it to disappear when it reaches $t = 1, then start again at 0 after an interval of $t = 1?
JB
Jordan Brown
Mon, Jul 7, 2025 3:07 AM
On 7/6/2025 6:05 PM, Caddiy via Discuss wrote:
Thanks. It works fine, but it’s too damn fast for me. It’s the
standard $t*360 speed.
How fast it is depends on your FPS and your number of frames.
If you set FPS to 1, it will be slow.
So it seems $t is the time
and 360 is the distance around a full orbit.
Yes, sort of. $t*360 is saying "during the animation, vary from zero to
almost 360".
Pedantic node: We've been saying $t=1, but it never actually
reaches 1. It stops and loops back to zero one frame before $t=1,
so that a loop that yields the same image for $t=0 and $t=1 doesn't
have the same frame twice.
Unfortunately it is not possible to give the 360° extra time for it to
go slower.
"Extra time" isn't really meaningful. If you say "$t*360", it will take
exactly the length of the animation to make it all the way around. It
can't take longer than that, because the animation is done when $t=1.
If you have something else that needs to move faster, multiply $t by a
bigger number - say, if you have another thing that needs to rotate
twice during the animation, it would be "$t720". Look back at my clock
example, where the hour hand, the minute hand, and the second hand all
rotate at different speeds. The hour hand is $t360, so it goes around
once during the animation. The minute hand is $t36012, so it goes
around twelve times. The second hand is $t1260, so it goes around 720
times.
If you have something that needs to move slower, then it needs to be
the thing that uses $t*360, and your original thing needs a larger
multiplier so that it will go around more times.
Would it be possible with $t*180 to use an “else” statement to tell it
to disappear when it reaches $t = 1, then start again at 0 after an
interval of $t = 1?
The animation only runs from $t=0 to $t=1.
There is nothing after 1. That's the end. Fini. Then the animation
engine starts over, but it starts over from $t=0; absent random numbers
it will produce the same sequence of frames.
The universe begins at $t=0 and ends at $t=1. You must set FPS and the
number of frames to control how many frames and how many real-clock
seconds that is.
(Actually, the FPS is pretty worthless in a lot of animations, because
once it takes more than a small fraction of a second to run your
program, the animation engine can't keep up. What ends up mattering for
the final product is the parameters that you give to your video-creating
tool when you have it combine the frames.)
If it's easier for you to understand, you can do something like this:
FPS = 10;
FRAMES = 1000;
seconds = $t * FRAMES / FPS;
and always set your animation parameters to 10 and 1000.
Or more correct and less tightly tied to the parameters would be:
LENGTH = 100;
seconds = $t * LENGTH;
and set your FPS and number of frames so that frames divided by FPS is 100.
But for this kind of animation, where you have some piece of the action
that needs to make a complete circle, it's probably better to base
everything directly off of $t and thus what fraction of that complete
circle has gone by. In the clock example, the hour hand goes around
once during the animation, and when we're 1/1000th of the way through,
the hour hand has gone around 360/1000 degrees, the minute hand has gone
around 12*360/1000 degrees, and so on. I could base it on seconds,
but that only makes sense because it is a clock; if it was something
else going around then it wouldn't directly make sense.
You could work in seconds, but then you'd have to figure out how many
seconds it would be for your model to go through its full cycle, and
pretty much everything would cancel out so that you'd effectively be
back to working in that "fraction of a cycle" model.
On 7/6/2025 6:05 PM, Caddiy via Discuss wrote:
>
> Thanks. It works fine, but it’s too damn fast for me. It’s the
> standard $t*360 speed.
>
How fast it is depends on your FPS and your number of frames.
If you set FPS to 1, it will be slow.
> So it seems $t is the time
>
Yes.
> and 360 is the distance around a full orbit.
>
Yes, sort of. $t*360 is saying "during the animation, vary from zero to
almost 360".
Pedantic node: We've been saying $t=1, but it never actually
reaches 1. It stops and loops back to zero one frame before $t=1,
so that a loop that yields the same image for $t=0 and $t=1 doesn't
have the same frame twice.
> Unfortunately it is not possible to give the 360° extra time for it to
> go slower.
>
"Extra time" isn't really meaningful. If you say "$t*360", it will take
exactly the length of the animation to make it all the way around. It
can't take longer than that, because the animation is done when $t=1.
If you have something else that needs to move faster, multiply $t by a
bigger number - say, if you have another thing that needs to rotate
twice during the animation, it would be "$t*720". Look back at my clock
example, where the hour hand, the minute hand, and the second hand all
rotate at different speeds. The hour hand is $t*360, so it goes around
once during the animation. The minute hand is $t*360*12, so it goes
around twelve times. The second hand is $t*12*60, so it goes around 720
times.
If you have something that needs to move slower, then *it* needs to be
the thing that uses $t*360, and your original thing needs a larger
multiplier so that it will go around more times.
> Would it be possible with $t*180 to use an “else” statement to tell it
> to disappear when it reaches $t = 1, then start again at 0 after an
> interval of $t = 1?
>
The animation only runs from $t=0 to $t=1.
There is nothing after 1. That's the end. Fini. Then the animation
engine starts over, but it starts over from $t=0; absent random numbers
it will produce the same sequence of frames.
The universe begins at $t=0 and ends at $t=1. You must set FPS and the
number of frames to control how many frames and how many real-clock
seconds that is.
(Actually, the FPS is pretty worthless in a lot of animations, because
once it takes more than a small fraction of a second to run your
program, the animation engine can't keep up. What ends up mattering for
the final product is the parameters that you give to your video-creating
tool when you have it combine the frames.)
If it's easier for you to understand, you can do something like this:
FPS = 10;
FRAMES = 1000;
seconds = $t * FRAMES / FPS;
and always set your animation parameters to 10 and 1000.
Or more correct and less tightly tied to the parameters would be:
LENGTH = 100;
seconds = $t * LENGTH;
and set your FPS and number of frames so that frames divided by FPS is 100.
But for this kind of animation, where you have some piece of the action
that needs to make a complete circle, it's probably better to base
everything directly off of $t and thus what fraction of that complete
circle has gone by. In the clock example, the hour hand goes around
once during the animation, and when we're 1/1000th of the way through,
the hour hand has gone around 360/1000 degrees, the minute hand has gone
around 12*360/1000 degrees, and so on. I *could* base it on seconds,
but that only makes sense because it *is* a clock; if it was something
else going around then it wouldn't directly make sense.
You could work in seconds, but then you'd have to figure out how many
seconds it would be for your model to go through its full cycle, and
pretty much everything would cancel out so that you'd effectively be
back to working in that "fraction of a cycle" model.
M
mikeonenine@web.de
Mon, Jul 7, 2025 4:27 AM
Pedantic node: We've been saying $t=1, but it never actually
reaches 1. It stops and loops back to zero one frame before $t=1,
so that a loop that yields the same image for $t=0 and $t=1 doesn't
have the same frame twice.
Unfortunately it is not possible to give the 360° extra time for it to go slower.
Animation goes in steps with certain intervals. What about generating a new image every 2nd, 3rd or nth step?
If you have something else that needs to move faster, multiply $t by a bigger number - say, if you have another thing that needs to rotate twice during the animation, it would be "$t720".
I am already at $t720. Unless I find a solution, I will need $t*1440. That will require a large number of steps and generate a large number of frames. But my video program can skip every second or third frame.
Look back at my clock example, …
The clock example must be the worst case scenario! My engine also has three different speeds but they only range from half speed to double speed - a factor of 4, but that’s bad enough if the range has to go from standard to quadruple speed.
The animation only runs from $t=0 to $t=1.
There is nothing after 1. That's the end. Fini. Then the animation
engine starts over, but it starts over from $t=0; absent random numbers
it will produce the same sequence of frames.
Would it not be possible to introduce an interval between $t=1 and $t=0 equal to the time taken for a run from $t=0 to $t=1?
Or introduce some kind of a dummy run inbetween live runs?
I wish I had studied computer programming!
Jordan Brown wrote:
> ```
> Pedantic node: We've been saying $t=1, but it never actually
> reaches 1. It stops and loops back to zero one frame before $t=1,
> so that a loop that yields the same image for $t=0 and $t=1 doesn't
> have the same frame twice.
> ```
```
That makes sense.
```
> Unfortunately it is not possible to give the 360° extra time for it to go slower.
Animation goes in steps with certain intervals. What about generating a new image every 2nd, 3rd or nth step?
> If you have something else that needs to move faster, multiply $t by a bigger number - say, if you have another thing that needs to rotate twice during the animation, it would be "$t*720".*
I am already at $t720. Unless I find a solution, I will need $t\*1440. That will require a large number of steps and generate a large number of frames. But my video program can skip every second or third frame.
> *Look back at my clock example, …*
The clock example must be the worst case scenario! My engine also has three different speeds but they only range from half speed to double speed - a factor of 4, but that’s bad enough if the range has to go from standard to quadruple speed.
> The animation only runs from $t=0 to $t=1.\
> There is nothing after 1. That's the end. Fini. Then the animation
> engine starts over, but it starts over from $t=0; absent random numbers
> it will produce the same sequence of frames.
Would it not be possible to introduce an interval between $t=1 and $t=0 equal to the time taken for a run from $t=0 to $t=1?
Or introduce some kind of a dummy run inbetween live runs?
I wish I had studied computer programming!