Add shadow to drop animation.

This commit is contained in:
yukirij 2024-08-27 10:45:59 -07:00
parent 86b5f96092
commit dfabe05d94

View File

@ -610,6 +610,9 @@ const INTERFACE = {
time = time * time; time = time * time;
let play = INTERFACE_DATA.Animate.play; let play = INTERFACE_DATA.Animate.play;
let piece = INTERFACE_DATA.Animate.piece;
let target = INTERFACE_DATA.Animate.target;
// Get to and from coordinates. // Get to and from coordinates.
let coord_to = HEX.tile_to_hex(play.to); let coord_to = HEX.tile_to_hex(play.to);
if((INTERFACE_DATA.player & 1) ^ INTERFACE_DATA.rotate == 1) { if((INTERFACE_DATA.player & 1) ^ INTERFACE_DATA.rotate == 1) {
@ -637,6 +640,18 @@ const INTERFACE = {
case 1: { case 1: {
from_x = to_x; from_x = to_x;
from_y = to_y - (gui_scale / 1.5); from_y = to_y - (gui_scale / 1.5);
switch(piece.player) {
case 0: ctx.fillStyle = INTERFACE.Color.DawnDark; break;
case 1: ctx.fillStyle = INTERFACE.Color.DuskDark; break;
}
ctx.save();
ctx.translate(to_x, to_y);
ctx.beginPath();
draw.hex(MATH.lerp(1.2, 0.94, time));
ctx.fill();
ctx.restore();
} break; } break;
} }
@ -644,9 +659,6 @@ const INTERFACE = {
let x = MATH.lerp(from_x, to_x, time); let x = MATH.lerp(from_x, to_x, time);
let y = MATH.lerp(from_y, to_y, time); let y = MATH.lerp(from_y, to_y, time);
let piece = INTERFACE_DATA.Animate.piece;
let target = INTERFACE_DATA.Animate.target;
// Draw target piece. // Draw target piece.
if(target !== null) { if(target !== null) {
if(target.player == piece.player) { if(target.player == piece.player) {