1
如何让这个矩形从左上角移动到右下角?使用tot功能的矩形移动
clear all
close all
clc
n=10;
h=1;
for t=0:n-1
clf;
axis([0 sum(1:n) 0 sum(1:n)]);
axis manual
tot = sum(0:t);
patch([tot tot+(t+1)*h tot+(t+1)*h tot],[tot tot tot+(t+1)*h tot+(t+1)*h],...
[2 6 3 7],'EdgeColor','none','FaceAlpha',(1-(t+1)*.7/n));
pause(1/6)
end
此外,尝试在某处使用此功能。 sum(1:t)-tot-(t+1)*h
请接受帮助你的答案,以确认主题是否接近。 – EBH