• Remix
  • Share
  • New Entry

on 14 Oct 2024
  • 10
  • 124
  • 0
  • 0
  • 1999
Cite your audio source here (if applicable):
drawframe(93);
Write your drawframe function below
function drawframe(f)
% Define stages and their colors
stages={'Commit','Build','Test','Deploy'};
colors={'c','g','y','r'};
% Initialize figure
clf;axis([0,100,0,100]);hold on;axis off;
% Define frames per stage
totalFrames=96;framesPerStage=totalFrames/length(stages);
currentStage=min(floor((f-1)/framesPerStage)+1,length(stages));
% X positions for the stages
xPositions=linspace(10,80,length(stages));
% Loop through stages and draw rectangles for each stage
for i=1:length(stages)
xPos=xPositions(i);yPos=80; % Move stages higher
% Draw stage boxes with borders
rectangle('Position',[xPos,yPos,20,10],'FaceColor',colors{i},'EdgeColor','k','LineWidth',2,'Curvature',0.2);
text(xPos+10,yPos+5,stages{i},'HorizontalAlignment','center','VerticalAlignment','middle','FontSize',8,'Color','black','FontWeight','bold');
% Simulate random error
if rand<0.05&&i==currentStage
text(xPos+9,yPos-15,'Error!','Color','r','FontSize',12,'FontWeight','bold');
return;
end
% Draw progress bar for current stage
if i==currentStage
progress=mod(f-1,framesPerStage)/framesPerStage;
rectangle('Position',[xPos,yPos-5,18*progress,3],'FaceColor',colors{i},'EdgeColor','k','LineWidth',1);
end
end
% Cloud computing appears near Build and Test stages
if currentStage==2||currentStage==3
cloudX=xPositions(currentStage); % Position cloud near the relevant stage
plot(cloudX,50,'o','MarkerSize',50,'MarkerFaceColor','b','MarkerEdgeColor','k'); % Cloud with border
text(cloudX,50,{'Cloud','Computing'},'FontSize',8,'HorizontalAlignment','center','VerticalAlignment','middle','Color','w');
end
% Pipeline flow indicator (arrow pointing downwards)
flowXPos=xPositions(currentStage)+18*mod(f-1,framesPerStage)/framesPerStage;
plot(flowXPos,yPos+12,'kv','MarkerSize',10,'MarkerFaceColor','k');
% Simulate distributed computing nodes for Build and Test stages
if currentStage==2||currentStage==3
for node=1:3
nodeColor=colors{currentStage}; % Use stage color for nodes
plot(xPositions(currentStage)-5*node,yPos-20,'ks','MarkerSize',8,'MarkerFaceColor',nodeColor); % Node
plot([xPositions(currentStage)-5*node,flowXPos],[yPos-20,yPos+5],'k-'); % Connection line
end
end
% Add success message at the end of the pipeline
if f==92 || f==93
text(50,35,'CI/CD Success!','HorizontalAlignment','center','FontSize',18,'FontWeight','bold','Color','black');
end
% Add a full-width loading bar with border under the title
text(50,20,'CI/CD Pipeline','HorizontalAlignment','center','FontSize',12,'FontWeight','bold');
progressOverall=f/totalFrames; % Normalize overall progress
rectangle('Position',[10,10,80*progressOverall,3],'FaceColor','b','EdgeColor','k','LineWidth',2); % First loading bar
% Add another loading bar that changes color based on the current stage
stageProgress=xPositions(currentStage); % Set the current stage progress bar
rectangle('Position',[10,5,stageProgress,3],'FaceColor',colors{currentStage},'EdgeColor','k','LineWidth',2); % Second bar with stage color
% End figure
hold off;
end
Movie
Audio

This submission does not have audio.

Remix Tree