discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Disappearing trick?

M
mikeonenine@web.de
Sun, Jul 6, 2025 7:14 AM

Is it possible to make something disappear periodically? Maybe by making one dimension (radius or linear_extrude etc.) of a shape alternate between zero and a positive value at regular intervals?

The problem: the cams in the animation go 180° at half-speed then jump 180° so they effectively catch up to end up going at full speed. If they could be made to disappear every second pass, and a second cam in each case pops up and continues where the first disappears, until after 180° it is replaced by the first cam, that would give the illusion of continuous half-speed motion.

I know the standard solution would be to double all the speeds. But there is a further shaft with gears that already run at double speed, so they would have to run at quadruple speed. Instead of at least 180 frames, it would need 360 frames to avoid the artefact of gears appearing to run backwards or just looking fuzzy. That gives a rather large file and, with max. 50 fps, a slow animation.

$vpr=[ 170, 315, 45 ];

$vpt=[ 0, 0, 0 ];

$vpd=700;

module cams()

{

hull()

{

cylinder(r=19, h=5);

for ( i = [0, 20])

rotate([0, 0, i])

translate([14, 0, 0])

cylinder(r=10, h=5);

}

translate([0, 0, 12])

rotate([0, 0, 90])

hull()

{

cylinder(r=19, h=5);

for ( i = [0, 20])

rotate([0, 0, i])

translate([14, 0, 0])

cylinder(r=10, h=5);

}}

// Timing gear

rotate([0, 0, $t*360])

color(steel1)

linear_extrude(6, center=true)

gear(30, 24, 2);

// Timing gears

for ( i = [0:1:3])

rotate([0, 0, 90*i])

translate([72, 0, 0])

rotate([0, 0, 3*i+4 - $t*180])

color(steel1)

{

linear_extrude(6, center=true)

difference()

{

gear(60, 48, 2);

for ( i = [1:1:8])

rotate([0, 0, 360/8*i])

translate([30, 0])

circle(8);

circle(12);

}

translate([0, 0, -28])

difference()

{

union()

{

cylinder(r=16, h=32);

translate([0, 0, 0])

cams();

}

translate([0, 0, -0.5])

cylinder(r=12, h=33);

}

}

Is it possible to make something disappear periodically? Maybe by making one dimension (radius or linear_extrude etc.) of a shape alternate between zero and a positive value at regular intervals? The problem: the cams in the animation go 180° at half-speed then jump 180° so they effectively catch up to end up going at full speed. If they could be made to disappear every second pass, and a second cam in each case pops up and continues where the first disappears, until after 180° it is replaced by the first cam, that would give the illusion of continuous half-speed motion. I know the standard solution would be to double all the speeds. But there is a further shaft with gears that already run at double speed, so they would have to run at quadruple speed. Instead of at least 180 frames, it would need 360 frames to avoid the artefact of gears appearing to run backwards or just looking fuzzy. That gives a rather large file and, with max. 50 fps, a slow animation. `$vpr=[ 170, 315, 45 ];` `$vpt=[ 0, 0, 0 ];` `$vpd=700;` `module cams()` `{` `hull()` `{` `cylinder(r=19, h=5);` `for ( i = [0, 20])` `rotate([0, 0, i])` `translate([14, 0, 0])` `cylinder(r=10, h=5);` `}` `translate([0, 0, 12])` `rotate([0, 0, 90])` `hull()` `{` `cylinder(r=19, h=5);` `for ( i = [0, 20])` `rotate([0, 0, i])` `translate([14, 0, 0])` `cylinder(r=10, h=5);` `}}` `// Timing gear` `rotate([0, 0, $t*360])` `color(steel1)` `linear_extrude(6, center=true)` `gear(30, 24, 2);` `// Timing gears` `for ( i = [0:1:3])` `rotate([0, 0, 90*i])` `translate([72, 0, 0])` `rotate([0, 0, 3*i+4 - $t*180])` `color(steel1)` `{` `linear_extrude(6, center=true)` `difference()` `{` `gear(60, 48, 2);` `for ( i = [1:1:8])` `rotate([0, 0, 360/8*i])` `translate([30, 0])` `circle(8);` `circle(12);` `}` `translate([0, 0, -28])` `difference()` `{` `union()` `{` `cylinder(r=16, h=32);` `translate([0, 0, 0])` `cams();` `}` `translate([0, 0, -0.5])` `cylinder(r=12, h=33);` `}` `}`
NH
nop head
Sun, Jul 6, 2025 8:42 AM

Don't you just want to rotate the inner gear twice as far because it needs
to rotate twice for a full rotation of the cams? You don't need more
frames, it just needs to move twice the angle in each frame.

On Sun, 6 Jul 2025 at 08:15, Caddiy via Discuss discuss@lists.openscad.org
wrote:

Is it possible to make something disappear periodically? Maybe by making
one dimension (radius or linear_extrude etc.) of a shape alternate between
zero and a positive value at regular intervals?

The problem: the cams in the animation go 180° at half-speed then jump
180° so they effectively catch up to end up going at full speed. If they
could be made to disappear every second pass, and a second cam in each case
pops up and continues where the first disappears, until after 180° it is
replaced by the first cam, that would give the illusion of continuous
half-speed motion.

I know the standard solution would be to double all the speeds. But there
is a further shaft with gears that already run at double speed, so they
would have to run at quadruple speed. Instead of at least 180 frames, it
would need 360 frames to avoid the artefact of gears appearing to run
backwards or just looking fuzzy. That gives a rather large file and, with
max. 50 fps, a slow animation.

$vpr=[ 170, 315, 45 ];

$vpt=[ 0, 0, 0 ];

$vpd=700;

module cams()

{

hull()

{

cylinder(r=19, h=5);

for ( i = [0, 20])

rotate([0, 0, i])

translate([14, 0, 0])

cylinder(r=10, h=5);

}

translate([0, 0, 12])

rotate([0, 0, 90])

hull()

{

cylinder(r=19, h=5);

for ( i = [0, 20])

rotate([0, 0, i])

translate([14, 0, 0])

cylinder(r=10, h=5);

}}

// Timing gear

rotate([0, 0, $t*360])

color(steel1)

linear_extrude(6, center=true)

gear(30, 24, 2);

// Timing gears

for ( i = [0:1:3])

rotate([0, 0, 90*i])

translate([72, 0, 0])

rotate([0, 0, 3i+4 - $t180])

color(steel1)

{

linear_extrude(6, center=true)

difference()

{

gear(60, 48, 2);

for ( i = [1:1:8])

rotate([0, 0, 360/8*i])

translate([30, 0])

circle(8);

circle(12);

}

translate([0, 0, -28])

difference()

{

union()

{

cylinder(r=16, h=32);

translate([0, 0, 0])

cams();

}

translate([0, 0, -0.5])

cylinder(r=12, h=33);

}

}


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

Don't you just want to rotate the inner gear twice as far because it needs to rotate twice for a full rotation of the cams? You don't need more frames, it just needs to move twice the angle in each frame. On Sun, 6 Jul 2025 at 08:15, Caddiy via Discuss <discuss@lists.openscad.org> wrote: > Is it possible to make something disappear periodically? Maybe by making > one dimension (radius or linear_extrude etc.) of a shape alternate between > zero and a positive value at regular intervals? > > The problem: the cams in the animation go 180° at half-speed then jump > 180° so they effectively catch up to end up going at full speed. If they > could be made to disappear every second pass, and a second cam in each case > pops up and continues where the first disappears, until after 180° it is > replaced by the first cam, that would give the illusion of continuous > half-speed motion. > > I know the standard solution would be to double all the speeds. But there > is a further shaft with gears that already run at double speed, so they > would have to run at quadruple speed. Instead of at least 180 frames, it > would need 360 frames to avoid the artefact of gears appearing to run > backwards or just looking fuzzy. That gives a rather large file and, with > max. 50 fps, a slow animation. > > $vpr=[ 170, 315, 45 ]; > > $vpt=[ 0, 0, 0 ]; > > $vpd=700; > > module cams() > > { > > hull() > > { > > cylinder(r=19, h=5); > > for ( i = [0, 20]) > > rotate([0, 0, i]) > > translate([14, 0, 0]) > > cylinder(r=10, h=5); > > } > > translate([0, 0, 12]) > > rotate([0, 0, 90]) > > hull() > > { > > cylinder(r=19, h=5); > > for ( i = [0, 20]) > > rotate([0, 0, i]) > > translate([14, 0, 0]) > > cylinder(r=10, h=5); > > }} > > // Timing gear > > rotate([0, 0, $t*360]) > > color(steel1) > > linear_extrude(6, center=true) > > gear(30, 24, 2); > > // Timing gears > > for ( i = [0:1:3]) > > rotate([0, 0, 90*i]) > > translate([72, 0, 0]) > > rotate([0, 0, 3*i+4 - $t*180]) > > color(steel1) > > { > > linear_extrude(6, center=true) > > difference() > > { > > gear(60, 48, 2); > > for ( i = [1:1:8]) > > rotate([0, 0, 360/8*i]) > > translate([30, 0]) > > circle(8); > > circle(12); > > } > > translate([0, 0, -28]) > > difference() > > { > > union() > > { > > cylinder(r=16, h=32); > > translate([0, 0, 0]) > > cams(); > > } > > translate([0, 0, -0.5]) > > cylinder(r=12, h=33); > > } > > } > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
M
mikeonenine@web.de
Sun, Jul 6, 2025 10:56 AM

nop head wrote:

Don't you just want to rotate the inner gear twice as far because it needs
to rotate twice for a full rotation of the cams? You don't need more
frames, it just needs to move twice the angle in each frame.

The inner gear does rotate twice for a full rotation of the outer gears - at least that is the illusion, as the inner gear rotates at $t*360 and the outer gears rotate at $t*180. It works for the outer gears because they have even numbers of teeth and holes. But the cams have an odd number of lobes (one). It would, of course, all work fine if the speeds were doubled BUT there is another shaft with gears in the model (at the top in frame 82) that already runs at $t*720, which would have to be sped up to a dizzying $t*1440, and I would like to avoid that if possible, as it raises other issues.

I figured that two cams appearing and disappearing alternately, instead of one, each sweeping opposite 180° sectors in succession, would fix it as a workaround. Maybe there is another way of doing it without doubling the speeds?

(The cams look terribly narrow, but that’s how they are in the drawing.)

nop head wrote: > Don't you just want to rotate the inner gear twice as far because it needs > to rotate twice for a full rotation of the cams? You don't need more > frames, it just needs to move twice the angle in each frame. The inner gear does rotate twice for a full rotation of the outer gears - at least that is the illusion, as the inner gear rotates at $t\*360 and the outer gears rotate at $t\*180. It works for the outer gears because they have even numbers of teeth and holes. But the cams have an odd number of lobes (one). It would, of course, all work fine if the speeds were doubled BUT there is another shaft with gears in the model (at the top in frame 82) that already runs at $t\*720, which would have to be sped up to a dizzying $t\*1440, and I would like to avoid that if possible, as it raises other issues. I figured that two cams appearing and disappearing alternately, instead of one, each sweeping opposite 180° sectors in succession, would fix it as a workaround. Maybe there is another way of doing it without doubling the speeds? (The cams look terribly narrow, but that’s how they are in the drawing.)
M
mikeonenine@web.de
Sun, Jul 6, 2025 11:22 AM

A moving “now you see it, now you don’t” difference() might be worth a try (but not right now).

A moving “now you see it, now you don’t” difference() might be worth a try (but not right now).
NH
nop head
Sun, Jul 6, 2025 12:03 PM

You don't need to double the speed, you just need the gear to rotate twice
as far. You can make the animation last twice as long.

To make something disappear you could just wrap it with if($t < 0.5).

On Sun, 6 Jul 2025 at 12:22, Caddiy via Discuss discuss@lists.openscad.org
wrote:

A moving “now you see it, now you don’t” difference() might be worth a try
(but not right now).


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

You don't need to double the speed, you just need the gear to rotate twice as far. You can make the animation last twice as long. To make something disappear you could just wrap it with if($t < 0.5). On Sun, 6 Jul 2025 at 12:22, Caddiy via Discuss <discuss@lists.openscad.org> wrote: > A moving “now you see it, now you don’t” difference() might be worth a try > (but not right now). > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
M
mikeonenine@web.de
Sun, Jul 6, 2025 7:09 PM

nop head wrote:

You don't need to double the speed, you just need the gear to rotate twice
as far. You can make the animation last twice as long.

Twice as far in twice the time sounds interesting! Can that be applied to $t*180 to get full 360° rotation with half-speed?

To make something disappear you could just wrap it with if($t < 0.5).

I have got this far:

if($t > 0.5)

rotate([0, 0, $t*180])

translate([101, 0, 0])

color("red")

circle(50);

if($t < 0.5)

rotate([0, 0, $t*180])

translate([-99, 0, 0])

color("blue")

circle(50);

rotate([0, 0, $t*360])

color("black")

square([2, 160]);

The black line rotates at $t*360. The coloured circles go round at half speed, but only do half a circle. How can they be made to do a full circle at half-speed?

Or there is this:

rotate([0, 0, $t*180])

translate([101, 0, 0])

color("red")

circle(50);

rotate([0, 0, $t*180])

translate([-99, 0, 0])

color("blue")

circle(50);

rotate([0, 0, $t*360])

color("black")

square([2, 160]);

How could the two circles be made to disappear alternately, instead of simultaneously, to give the impression of a single circle that changes colour instead of two? Can if($t < 0.5) be advanced/retarded by 180°?

nop head wrote: > You don't need to double the speed, you just need the gear to rotate twice > as far. You can make the animation last twice as long. Twice as far in twice the time sounds interesting! Can that be applied to $t\*180 to get full 360° rotation with half-speed? > To make something disappear you could just wrap it with if($t < 0.5). I have got this far: `if($t > 0.5)` `rotate([0, 0, $t*180])` `translate([101, 0, 0])` `color("red")` `circle(50);` `if($t < 0.5)` `rotate([0, 0, $t*180])` `translate([-99, 0, 0])` `color("blue")` `circle(50);` `rotate([0, 0, $t*360])` `color("black")` `square([2, 160]);` The black line rotates at $t\*360. The coloured circles go round at half speed, but only do half a circle. How can they be made to do a full circle at half-speed? Or there is this: `rotate([0, 0, $t*180])` `translate([101, 0, 0])` `color("red")` `circle(50);` `rotate([0, 0, $t*180])` `translate([-99, 0, 0])` `color("blue")` `circle(50);` `rotate([0, 0, $t*360])` `color("black")` `square([2, 160]);` How could the two circles be made to disappear alternately, instead of simultaneously, to give the impression of a single circle that changes colour instead of two? Can if($t < 0.5) be advanced/retarded by 180°?
NH
nop head
Sun, Jul 6, 2025 7:43 PM

To make the inner gear turn twice as far use $t * 720, to get two turns as
$t goes from 0 to 1.

To make the animation take twice as long, so that it rotates at the same
speed, double the number of steps, so each frame increases $t half as much
and you twice as many frames. Or you could halve FPS but then it might look
a bit jerky.

On Sun, 6 Jul 2025 at 20:09, Caddiy via Discuss discuss@lists.openscad.org
wrote:

nop head wrote:

You don't need to double the speed, you just need the gear to rotate twice
as far. You can make the animation last twice as long.

Twice as far in twice the time sounds interesting! Can that be applied to
$t*180 to get full 360° rotation with half-speed?

To make something disappear you could just wrap it with if($t < 0.5).

I have got this far:

if($t > 0.5)

rotate([0, 0, $t*180])

translate([101, 0, 0])

color("red")

circle(50);

if($t < 0.5)

rotate([0, 0, $t*180])

translate([-99, 0, 0])

color("blue")

circle(50);

rotate([0, 0, $t*360])

color("black")

square([2, 160]);

The black line rotates at $t*360. The coloured circles go round at half
speed, but only do half a circle. How can they be made to do a full circle
at half-speed?

Or there is this:

rotate([0, 0, $t*180])

translate([101, 0, 0])

color("red")

circle(50);

rotate([0, 0, $t*180])

translate([-99, 0, 0])

color("blue")

circle(50);

rotate([0, 0, $t*360])

color("black")

square([2, 160]);

How could the two circles be made to disappear alternately, instead of
simultaneously, to give the impression of a single circle that changes
colour instead of two? Can if($t < 0.5) be advanced/retarded by 180°?


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

To make the inner gear turn twice as far use $t * 720, to get two turns as $t goes from 0 to 1. To make the animation take twice as long, so that it rotates at the same speed, double the number of steps, so each frame increases $t half as much and you twice as many frames. Or you could halve FPS but then it might look a bit jerky. On Sun, 6 Jul 2025 at 20:09, Caddiy via Discuss <discuss@lists.openscad.org> wrote: > nop head wrote: > > You don't need to double the speed, you just need the gear to rotate twice > as far. You can make the animation last twice as long. > > Twice as far in twice the time sounds interesting! Can that be applied to > $t*180 to get full 360° rotation with half-speed? > > To make something disappear you could just wrap it with if($t < 0.5). > > I have got this far: > > if($t > 0.5) > > rotate([0, 0, $t*180]) > > translate([101, 0, 0]) > > color("red") > > circle(50); > > if($t < 0.5) > > rotate([0, 0, $t*180]) > > translate([-99, 0, 0]) > > color("blue") > > circle(50); > > rotate([0, 0, $t*360]) > > color("black") > > square([2, 160]); > > The black line rotates at $t*360. The coloured circles go round at half > speed, but only do half a circle. How can they be made to do a full circle > at half-speed? > > Or there is this: > > rotate([0, 0, $t*180]) > > translate([101, 0, 0]) > > color("red") > > circle(50); > > rotate([0, 0, $t*180]) > > translate([-99, 0, 0]) > > color("blue") > > circle(50); > > rotate([0, 0, $t*360]) > > color("black") > > square([2, 160]); > > How could the two circles be made to disappear alternately, instead of > simultaneously, to give the impression of a single circle that changes > colour instead of two? Can if($t < 0.5) be advanced/retarded by 180°? > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
M
mikeonenine@web.de
Sun, Jul 6, 2025 8:26 PM

nop head wrote:

To make the inner gear turn twice as far use $t * 720, to get two turns as
$t goes from 0 to 1.

Yes, that would work, but no I don’t want to do that because the extra shaft would then have to rotate at $t*1440 instead of the present $t*720. The model I am working on has parts rotating at three different speeds: camshafts rotating at half crankshaft speed and a synchronising shaft (that’s what I will call it) rotating at double crankshaft speed.

To make the animation take twice as long, so that it rotates at the same
speed, double the number of steps, so each frame increases $t half as much
and you twice as many frames. Or you could halve FPS but then it might look
a bit jerky.

The animation would take twice as long by the clock on the wall, but the $t clock would remain unimpressed.

Is there some other way to get either real or virtual full 360° rotation with $t*180? I think I need a time machine. Must see what ebay has to offer.

nop head wrote: > To make the inner gear turn twice as far use $t \* 720, to get two turns as > $t goes from 0 to 1. Yes, that would work, but no I don’t want to do that because the extra shaft would then have to rotate at $t\*1440 instead of the present $t\*720. The model I am working on has parts rotating at three different speeds: camshafts rotating at half crankshaft speed and a synchronising shaft (that’s what I will call it) rotating at double crankshaft speed. > To make the animation take twice as long, so that it rotates at the same > speed, double the number of steps, so each frame increases $t half as much > and you twice as many frames. Or you could halve FPS but then it might look > a bit jerky. The animation would take twice as long by the clock on the wall, but the $t clock would remain unimpressed. Is there some other way to get either real or virtual full 360° rotation with $t\*180? I think I need a time machine. Must see what ebay has to offer.
NH
nop head
Sun, Jul 6, 2025 8:34 PM

$t isn't a clock. It is just how far through the animation you are. It goes
from 0 to 1 in the number of steps you specify. That clock time that takes
will be the FPS / steps.

On Sun, 6 Jul 2025 at 21:26, Caddiy via Discuss discuss@lists.openscad.org
wrote:

nop head wrote:

To make the inner gear turn twice as far use $t * 720, to get two turns as
$t goes from 0 to 1.

Yes, that would work, but no I don’t want to do that because the extra
shaft would then have to rotate at $t1440 instead of the present $t720.
The model I am working on has parts rotating at three different speeds:
camshafts rotating at half crankshaft speed and a synchronising shaft
(that’s what I will call it) rotating at double crankshaft speed.

To make the animation take twice as long, so that it rotates at the same
speed, double the number of steps, so each frame increases $t half as much
and you twice as many frames. Or you could halve FPS but then it might look
a bit jerky.

The animation would take twice as long by the clock on the wall, but the
$t clock would remain unimpressed.

Is there some other way to get either real or virtual full 360° rotation
with $t*180? I think I need a time machine. Must see what ebay has to offer.


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

$t isn't a clock. It is just how far through the animation you are. It goes from 0 to 1 in the number of steps you specify. That clock time that takes will be the FPS / steps. On Sun, 6 Jul 2025 at 21:26, Caddiy via Discuss <discuss@lists.openscad.org> wrote: > nop head wrote: > > To make the inner gear turn twice as far use $t * 720, to get two turns as > $t goes from 0 to 1. > > Yes, that would work, but no I don’t want to do that because the extra > shaft would then have to rotate at $t*1440 instead of the present $t*720. > The model I am working on has parts rotating at three different speeds: > camshafts rotating at half crankshaft speed and a synchronising shaft > (that’s what I will call it) rotating at double crankshaft speed. > > To make the animation take twice as long, so that it rotates at the same > speed, double the number of steps, so each frame increases $t half as much > and you twice as many frames. Or you could halve FPS but then it might look > a bit jerky. > > The animation would take twice as long by the clock on the wall, but the > $t clock would remain unimpressed. > > Is there some other way to get either real or virtual full 360° rotation > with $t*180? I think I need a time machine. Must see what ebay has to offer. > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
M
mikeonenine@web.de
Sun, Jul 6, 2025 8:50 PM

nop head wrote:

$t isn't a clock. It is just how far through the animation you are. It goes
from 0 to 1 in the number of steps you specify. That clock time that takes
will be the FPS / steps.

The problem is that the number of FPS / steps you specify controls everything. It is not possible to apply one number of FPS / steps to one part and another number of FPS / steps to another part. How to work around that?

nop head wrote: > $t isn't a clock. It is just how far through the animation you are. It goes > from 0 to 1 in the number of steps you specify. That clock time that takes > will be the FPS / steps. The problem is that the number of FPS / steps you specify controls everything. It is not possible to apply one number of FPS / steps to one part and another number of FPS / steps to another part. How to work around that?