Merry Christmas | MATLAB
Code:
clc
clear
all
close
all
figure;
patch([-12
-12 7 7],[-12 3 3 -12],[ 0.5843 0.8157
0.9882]);
axis
equal;
axis([-12
7 -12 3]);
hold
on;
pause(10);
t=0:0.01:2*pi;
%left
hand
plot([-1.8
-4],[-2.9 -1],'r','linewidth',4);
hold
on;
pause(1);
%right
hand
plot([1.8
4],[-2.9 -1],'r','linewidth',4);
hold
on;
pause(1);
%upper
circle
x=cos(t);
y=sin(t);
fill(x,y,'w');
axis
equal;
axis([-12
7 -12 3]);
hold
on;
pause(1);
%middle
circle
x=2*cos(t);
y=-2.8+2*sin(t);
fill(x,y,'w');
axis
equal;
axis([-12
7 -12 3]);
pause(1);
%lower
circle
x=3*cos(t);
y=-7.5+3*sin(t);
fill(x,y,'w');
axis
equal;
axis([-12
7 -12 3]);
pause(1);
%botam
x=0.25*cos(t);
y=-2+0.25*sin(t);
fill(x,y,'k');
axis
equal;
axis([-12
7 -12 3]);
pause(1);
x=0.25*cos(t);
y=-4+0.25*sin(t);
fill(x,y,'k');
axis
equal;
axis([-12
7 -12 3]);
pause(1);
x=0.25*cos(t);
y=-7+0.25*sin(t);
fill(x,y,'k');
axis
equal;
axis([-12
7 -12 3]);
pause(1);
x=0.25*cos(t);
y=-9+0.25*sin(t);
fill(x,y,'k');
axis
equal;
axis([-12
7 -12 3]);
pause(1);
%eyes
x=-0.5+0.25*cos(t);
y=0.4+0.25*sin(t);
fill(x,y,'k');
axis
equal;
axis([-12
7 -12 3]);
pause(1);
x=0.5+0.2*cos(t);
y=0.4+0.2*sin(t);
fill(x,y,'k');
axis
equal;
axis([-12
7 -12 3]);
pause(1);
%mouth
t=-0.3:0.1:0.3;
y=t.^2-0.5;
plot(t,y,'k','linewidth',2);
axis([-12
7 -12 3]);
pause(1);
%hat
plot([-1
1],[0.8 0.8],'k','linewidth',5);
pause(1);
fill([-0.6
-0.6 0.6 0.6],[0.8 2 2 0.8],'k');
pause(1);
%nose
patch([-0.15
-0.15 1.5],[0.1 -0.2 -0.3],[1 0.5 0]);
pause(1);
%
text(-10,2,'HAPPY CHRISTMAS','Color','black','FontSize',30)
clc
clear
all
close
all
figure;
patch([-12
-12 7 7],[-12 3 3 -12],[ 0.5843 0.8157
0.9882]);
axis
equal;
axis([-12
7 -12 3]);
hold
on;
pause(10);
t=0:0.01:2*pi;
%left
hand
plot([-1.8
-4],[-2.9 -1],'r','linewidth',4);
hold
on;
pause(1);
%right
hand
plot([1.8
4],[-2.9 -1],'r','linewidth',4);
hold
on;
pause(1);
%upper
circle
x=cos(t);
y=sin(t);
fill(x,y,'w');
axis
equal;
axis([-12
7 -12 3]);
hold
on;
pause(1);
%middle
circle
x=2*cos(t);
y=-2.8+2*sin(t);
fill(x,y,'w');
axis
equal;
axis([-12
7 -12 3]);
pause(1);
%lower
circle
x=3*cos(t);
y=-7.5+3*sin(t);
fill(x,y,'w');
axis
equal;
axis([-12
7 -12 3]);
pause(1);
%botam
x=0.25*cos(t);
y=-2+0.25*sin(t);
fill(x,y,'k');
axis
equal;
axis([-12
7 -12 3]);
pause(1);
x=0.25*cos(t);
y=-4+0.25*sin(t);
fill(x,y,'k');
axis
equal;
axis([-12
7 -12 3]);
pause(1);
x=0.25*cos(t);
y=-7+0.25*sin(t);
fill(x,y,'k');
axis
equal;
axis([-12
7 -12 3]);
pause(1);
x=0.25*cos(t);
y=-9+0.25*sin(t);
fill(x,y,'k');
axis
equal;
axis([-12
7 -12 3]);
pause(1);
%eyes
x=-0.5+0.25*cos(t);
y=0.4+0.25*sin(t);
fill(x,y,'k');
axis
equal;
axis([-12
7 -12 3]);
pause(1);
x=0.5+0.2*cos(t);
y=0.4+0.2*sin(t);
fill(x,y,'k');
axis
equal;
axis([-12
7 -12 3]);
pause(1);
%mouth
t=-0.3:0.1:0.3;
y=t.^2-0.5;
plot(t,y,'k','linewidth',2);
axis([-12
7 -12 3]);
pause(1);
%hat
plot([-1
1],[0.8 0.8],'k','linewidth',5);
pause(1);
fill([-0.6
-0.6 0.6 0.6],[0.8 2 2 0.8],'k');
pause(1);
%nose
patch([-0.15
-0.15 1.5],[0.1 -0.2 -0.3],[1 0.5 0]);
pause(1);
%
text(-10,2,'HAPPY CHRISTMAS','Color','black','FontSize',30)
No comments