-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMovingBlock.m
More file actions
51 lines (37 loc) · 858 Bytes
/
MovingBlock.m
File metadata and controls
51 lines (37 loc) · 858 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
close all;
clc;
figure;
rotateRectangle(2)
function rotateRectangle(rounds)
h = rectangle('Position',[5 5 5 5]);
h.EdgeColor = 'b';
axis([0 50 0 50]);
pause(2);
drawnow;
for i=1:rounds
% Moves Up
for y=5:3:35
h.Position = [5 y 5 5];
pause(0.01);
drawnow;
end
% Moves Right
for x=5:3:35
h.Position = [x 35 5 5];
pause(0.01);
drawnow;
end
% Moves Down
for y=35:-3:5
h.Position = [35 y 5 5];
pause(0.01);
drawnow;
end
% Moves Left
for x=35:-3:5
h.Position = [x 5 5 5];
pause(0.01);
drawnow;
end
end
end