• Remix
  • Share
  • New Entry

  • Sandeep T

  • /
  • Sometimes you gotta run, before you can walk

on 23 Oct 2024
  • 15
  • 159
  • 0
  • 0
  • 1925
Cite your audio source here (if applicable): Music by <a href="https://pixabay.com/users/nickogloire-45470911/?utm_source=link-attribution&utm_medium=referral&utm_campaign=music&utm_content=250550">Nicko Gloire</a> from <a href="https://pixabay.com/music//?utm_source=link-attribution&utm_medium=referral&utm_campaign=music&utm_content=250550">Pixabay</a>
drawframe(1);
Write your drawframe function below
function drawframe(f)
clf; % Clear figure
t = f/6;
hold on; % Hold on to plot multiple shapes
set(gcf, 'Color', 'k');
% Set axis limits and aspect ratio
axis equal; % Equal scaling
xlim([-7 7]); % X-axis limits
ylim([-7 7]); % Y-axis limits
% Hide axes
axis off;
x_shf = 0; % Center horizontally
y_shf = -5 + t; % Increment the shf by t units
flmClr = [1, rand(), 0]; % Random orange to red gradient
% head
hd_t = linspace(0, 2*pi, 100); % Create a circle for the hd
x_hd = 0.2 * cos(hd_t) + x_shf; % X coordinates (shfed)
y_hd = 0.2 * sin(hd_t) + y_shf + 1.5; % Y coordinates (shfed up)
fill(x_hd, y_hd, flmClr);
% Body
plot([x_shf x_shf], [y_shf y_shf + 1], 'r', 'LineWidth', 3); % Body line in red
% Angled Arms
arm_l = 1; % Length of the arms
ang = -pi/4; % Angle for the arms (-45 degrees)
% Left arm coordinates
left_arm_x = x_shf - arm_l * cos(ang);
left_arm_y = y_shf + 1 + arm_l * sin(ang);
% Right arm coordinates
right_arm_x = x_shf + arm_l * cos(ang);
right_arm_y = y_shf + 1 + arm_l * sin(ang);
% Draw arms
plot([x_shf, left_arm_x], [y_shf + 1, left_arm_y], 'r', 'LineWidth', 3);
plot([x_shf, right_arm_x], [y_shf + 1, right_arm_y], 'r', 'LineWidth', 3);
% Legs
plot([x_shf, 0.5 + x_shf], [y_shf, y_shf - 1], 'r', 'LineWidth', 3); % Right leg in red
plot([x_shf, -0.5 + x_shf], [y_shf, y_shf - 1], 'r', 'LineWidth', 3); % Left leg in red
% Create flames at arm ends and below the legs
% flame at the left arm end
flm_x_left = left_arm_x;
flm_y_left = left_arm_y;
flm_height_left = rand() * -1; % Random height for the left arm flm
flm_width_left = rand() * 0.1 + 0.1; % Random width for the left arm flm
fill([flm_x_left - flm_width_left, flm_x_left + flm_width_left, flm_x_left], ...
[flm_y_left, flm_y_left, flm_y_left + flm_height_left], ...
flmClr);
% flame at the right arm end
flm_x_right = right_arm_x;
flm_y_right = right_arm_y;
flm_height_right = rand() * -1;
flm_width_right = rand() * 0.1 + 0.1;
fill([flm_x_right - flm_width_right, flm_x_right + flm_width_right, flm_x_right], ...
[flm_y_right, flm_y_right, flm_y_right + flm_height_right], ...
flmClr);
% flame below the legs
flm_x_legs = x_shf;
flm_y_legs = y_shf - 1;
flm_height_legs = rand() * -3;
flm_width_legs = rand() * 0.1 + 0.75;
fill([flm_x_legs - flm_width_legs, flm_x_legs + flm_width_legs, flm_x_legs], ...
[flm_y_legs, flm_y_legs, flm_y_legs + flm_height_legs], ...
flmClr);
for i = 1:t
smoke_x = x_shf + (rand() - 0.5) * 0.5; % Random x position around the stick figure
smoke_y = y_shf - rand() - 2.5; % Position at leg
smoke_r = rand() * 0.2 + t/10; % Random radius for smoke puff
fill(smoke_x + smoke_r * cos(hd_t), smoke_y + smoke_r * sin(hd_t), [0.7, 0.7, 0.7], 'EdgeColor', 'none', 'FaceAlpha', 0.5); % Draw puff of smoke
end
% Generate random stars using scatter
num_stars = randi([20, 50]); % Random number of stars between 20 and 50
star_x = (rand(num_stars, 1) * 14) - 7; % Random X positions in the range [-7, 7]
star_y = (rand(num_stars, 1) * 14) - 7; % Random Y positions in the range [-7, 7]
scatter(star_x, star_y, 5, 'w', 'filled'); % Draw stars as white filled circles
hold off;
end
Movie
Audio
Remix Tree