Reworked animation keyframes
This commit is contained in:
parent
c25bf961e5
commit
9eac93893c
19
anim.scad
19
anim.scad
@ -2,13 +2,26 @@
|
|||||||
function get_anim_keys() = [
|
function get_anim_keys() = [
|
||||||
0, // initial
|
0, // initial
|
||||||
0.1, // resting
|
0.1, // resting
|
||||||
0.3, // holodisk inserted
|
0.25, // holodisk free-inserted
|
||||||
|
0.3, // holodisk click-inserted
|
||||||
0.4, // laser raised
|
0.4, // laser raised
|
||||||
0.5, // start playing
|
0.5, // start playing
|
||||||
0.7, // stop playing
|
0.7, // stop playing, start lowering laser
|
||||||
0.8, // laser lowered, holodisk removing
|
0.8, // laser lowered, holodisk removing
|
||||||
1 // final
|
0.85, // holodisk click-removed
|
||||||
|
1 // final, holodisk free-removed
|
||||||
];
|
];
|
||||||
|
|
||||||
|
function ANIM_START()=0;
|
||||||
|
function ANIM_RESTING()=0;
|
||||||
|
function ANIM_INSERTING()=1;
|
||||||
|
function ANIM_OPENING()=2;
|
||||||
|
function ANIM_RAISING()=3;
|
||||||
|
function ANIM_PLAYING()=4;
|
||||||
|
function ANIM_LOWERING()=5;
|
||||||
|
function ANIM_CLOSING()=6;
|
||||||
|
function ANIM_REMOVING()=7;
|
||||||
|
function ANIM_END()=8;
|
||||||
|
|
||||||
function anim(key_from, key_to, KEYS=get_anim_keys())
|
function anim(key_from, key_to, KEYS=get_anim_keys())
|
||||||
= max(0, min(($t - KEYS[key_from]) / (KEYS[key_to] - KEYS[key_from]), 1));
|
= max(0, min(($t - KEYS[key_from]) / (KEYS[key_to] - KEYS[key_from]), 1));
|
||||||
|
@ -46,6 +46,7 @@ module holodisk_mechanism() {
|
|||||||
tape_z=plate+spool_plate_height;
|
tape_z=plate+spool_plate_height;
|
||||||
|
|
||||||
module main_spool() {
|
module main_spool() {
|
||||||
|
zrot(200*anim(ANIM_PLAYING(), ANIM_PLAYING()+1))
|
||||||
spool(r_in=spool_inner_radius,
|
spool(r_in=spool_inner_radius,
|
||||||
r_out=spool_outer_radius,
|
r_out=spool_outer_radius,
|
||||||
in_rim=spool_plate_hole_inner_rim,
|
in_rim=spool_plate_hole_inner_rim,
|
||||||
@ -54,6 +55,7 @@ module holodisk_mechanism() {
|
|||||||
spindle_traction=true);
|
spindle_traction=true);
|
||||||
}
|
}
|
||||||
module aux_spool() {
|
module aux_spool() {
|
||||||
|
zrot(500*anim(ANIM_PLAYING(), ANIM_PLAYING()+1))
|
||||||
spool(r_in=middle_spool_in_r, r_out=middle_spool_out_r,
|
spool(r_in=middle_spool_in_r, r_out=middle_spool_out_r,
|
||||||
in_rim=aux_spool_plate_hole_inner_rim,
|
in_rim=aux_spool_plate_hole_inner_rim,
|
||||||
out_rim=aux_spool_plate_hole_outer_rim,
|
out_rim=aux_spool_plate_hole_outer_rim,
|
||||||
@ -109,6 +111,6 @@ module holodisk() {
|
|||||||
|
|
||||||
// test
|
// test
|
||||||
retraction=get_holodisk_size().y+10;
|
retraction=get_holodisk_size().y+10;
|
||||||
back((1-anim(1, 2)) * retraction) // anim insert
|
back((1-anim(ANIM_INSERTING(), ANIM_RAISING())) * retraction) // anim insert
|
||||||
back((anim(len(get_anim_keys())-2, len(get_anim_keys())-1)) * retraction) // anim remove
|
back(anim(ANIM_CLOSING(), ANIM_END()) * retraction) // anim remove
|
||||||
holodisk();
|
holodisk();
|
||||||
|
@ -174,8 +174,8 @@ module holodisk_frame() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
module slider_anim() {
|
module slider_anim() {
|
||||||
back(anim(1,2)*get_holodisk_slide_slider_travel()) // anim insert
|
back(anim(ANIM_OPENING(),ANIM_OPENING()+1)*get_holodisk_slide_slider_travel()) // anim insert
|
||||||
fwd(anim(5,6)*get_holodisk_slide_slider_travel()) // anim remove
|
fwd(anim(ANIM_CLOSING(),ANIM_CLOSING()+1)*get_holodisk_slide_slider_travel()) // anim remove
|
||||||
slider();
|
slider();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -219,8 +219,8 @@ module holodisk_frame() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
module sliding_cover_anim() {
|
module sliding_cover_anim() {
|
||||||
back(anim(1,2)*get_holodisk_slide_slider_travel()) // anim insert
|
back(anim(ANIM_OPENING(),ANIM_OPENING()+1)*get_holodisk_slide_slider_travel()) // anim insert
|
||||||
fwd(anim(5,6)*get_holodisk_slide_slider_travel()) // anim remove
|
fwd(anim(ANIM_CLOSING(),ANIM_CLOSING()+1)*get_holodisk_slide_slider_travel()) // anim remove
|
||||||
sliding_cover();
|
sliding_cover();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -236,7 +236,7 @@ module holodisk_frame() {
|
|||||||
get_holodisk_laserwindow_pos_center().z
|
get_holodisk_laserwindow_pos_center().z
|
||||||
];
|
];
|
||||||
|
|
||||||
translate(door_pos) scale(0.98) down(door_size.z/2) xrot(anim(1,2)*-90) xrot(anim(6,7)*90) up(door_size.z/2) cube(door_size, center=true);
|
translate(door_pos) scale(0.98) down(door_size.z/2) xrot(anim(ANIM_OPENING(),ANIM_OPENING()+1)*-90) xrot(anim(ANIM_CLOSING(),ANIM_CLOSING()+1)*90) up(door_size.z/2) cube(door_size, center=true);
|
||||||
}
|
}
|
||||||
|
|
||||||
module bottom_cover() {
|
module bottom_cover() {
|
||||||
@ -285,8 +285,8 @@ module holodisk_frame() {
|
|||||||
cover_top=[cover_size.x - overlap, cover_size.y, cover_size.z - overlap];
|
cover_top=[cover_size.x - overlap, cover_size.y, cover_size.z - overlap];
|
||||||
/*cover_pos=[rails_pos.x+overlap, rails_pos.y + rails_size.y, rails_pos.z];*/
|
/*cover_pos=[rails_pos.x+overlap, rails_pos.y + rails_size.y, rails_pos.z];*/
|
||||||
cover_pos=[get_holodisk_laserwindow_pos().x, rails_pos.y + rails_size.y, rails_pos.z];
|
cover_pos=[get_holodisk_laserwindow_pos().x, rails_pos.y + rails_size.y, rails_pos.z];
|
||||||
left(anim(0,1)*get_holodisk_laserwindow_size().x)
|
left(anim(ANIM_RESTING(),ANIM_RESTING()+1)*get_holodisk_laserwindow_size().x)
|
||||||
right(anim(len(get_anim_keys())-2,len(get_anim_keys())-1)*get_holodisk_laserwindow_size().x)
|
right(anim(ANIM_REMOVING(), ANIM_REMOVING()+1)*get_holodisk_laserwindow_size().x)
|
||||||
translate(cover_pos)
|
translate(cover_pos)
|
||||||
hull() {
|
hull() {
|
||||||
fwd(cover_plate.y) cube(cover_plate);
|
fwd(cover_plate.y) cube(cover_plate);
|
||||||
|
@ -27,7 +27,7 @@ module spool(
|
|||||||
tape_height=in_height;
|
tape_height=in_height;
|
||||||
module spool_plate() {
|
module spool_plate() {
|
||||||
$fn = ($preview ? 18 : 100);
|
$fn = ($preview ? 18 : 100);
|
||||||
if (/*!$preview &&*/ spokes > 0 && r_out - r_in > out_rim) {
|
if (spokes > 0 && r_out - r_in > out_rim) {
|
||||||
union() {
|
union() {
|
||||||
cylinder(h=plate_height, r=r_in + in_rim);
|
cylinder(h=plate_height, r=r_in + in_rim);
|
||||||
intersection() {
|
intersection() {
|
||||||
@ -42,7 +42,7 @@ module spool(
|
|||||||
}
|
}
|
||||||
difference() {
|
difference() {
|
||||||
cylinder(h=plate_height, r=r_out);
|
cylinder(h=plate_height, r=r_out);
|
||||||
cylinder(h=plate_height, r=r_out - out_rim);
|
scale(1.01) cylinder(h=plate_height, r=r_out - out_rim);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user