• Remix
  • Share
  • New Entry

on 14 Oct 2024
  • 11
  • 99
  • 0
  • 0
  • 1336
Cite your audio source here (if applicable):
for f=1:96
drawframe(f)
end
Write your drawframe function below
function drawframe(f)
% mapsize
X_Filed = 34;
Y_Filed = 34;
% making iniation data
data = rand(X_Filed, Y_Filed);
% making heatmap
h = heatmap(data);
% Colormap
cmap = [173 216 230; % color1
74 152 235; % color 2
47 99 235]./255; % color 3
% setting heat map
h.Colormap = cmap;
r_data = ones(X_Filed,Y_Filed)*3;
h.CellLabelColor = 'none';
h.ColorbarVisible = 'off';
h.XDisplayLabels = repmat({''}, 1, X_Filed);
h.YDisplayLabels = repmat({''}, Y_Filed, 1);
h.GridVisible = 'off';
persistent st_x
persistent flag_x
persistent st_y
if isempty(st_x)
st_x = round(X_Filed/2);
end
if isempty(st_y)
st_y = 4;
end
if mod(f,4) == 0
st_y = st_y + 1;
if flag_x == 1
flag_x = 0;
st_x = st_x + 1;
else
flag_x = 1;
st_x = st_x - 1;
end
end
% body
r_data(st_x, st_y:st_y+4) = 2;
r_data(st_x+1, st_y-2:st_y+6) = 2;
r_data(st_x+2, st_y-2:st_y+6) = 2;
r_data(st_x+3, st_y-2:st_y+6) = 2;
r_data(st_x+4, st_y-1:st_y+5) = 2;
r_data(st_x+1, st_y-2+2:st_y+6-2) = 3;
r_data(st_x+2, st_y-2+1:st_y+6-1) = 3;
r_data(st_x+3, st_y-2+1:st_y+6-1) = 3;
if mod(st_y,2) == 0
% leg 1
r_data(st_x+5, st_y-2) = 2;
r_data(st_x+6, st_y-3) = 2;
% leg 2
r_data(st_x+5, st_y+1) = 2;
r_data(st_x+6, st_y) = 2;
r_data(st_x+7, st_y-1) = 2;
% leg 3
r_data(st_x+5, st_y+4) = 2;
r_data(st_x+6, st_y+3) = 2;
% bubble
r_data(st_x-4, st_y-1) = 1;
r_data(st_x-8, st_y-3) = 1;
else
% leg 1
r_data(st_x+5, st_y-2) = 2;
r_data(st_x+6, st_y-3) = 2;
% leg 2
r_data(st_x+5, st_y+1) = 2;
r_data(st_x+6, st_y+1) = 2;
r_data(st_x+7, st_y) = 2;
% leg 3
r_data(st_x+5, st_y+4) = 2;
r_data(st_x+6, st_y+3) = 2;
% bubble
r_data(st_x-5, st_y-1) = 1;
r_data(st_x-8, st_y-2) = 1;
end
% update draw
h.ColorData = r_data;
end
Movie
Audio

This submission does not have audio.

Remix Tree