Help on Matrix falling rain code
조회 수: 7 (최근 30일)
이전 댓글 표시
Hey guys so I got into my head to try to recreate the the falling rain effect from the Matrix movies in Matlab.
Here's what I've got so far
clear all
close all
clc
cmdWinDoc = com.mathworks.mde.cmdwin.CmdWinDocument.getInstance;
listeners = cmdWinDoc.getDocumentListeners;
for i = 3:4
jTextArea = listeners(i);
jTextArea.setBackground(java.awt.Color.black);
jTextArea.setBackground(java.awt.Color(0,0,0));
set(jTextArea,'Background','black');
set(jTextArea,'Background',[0,0,0]);
jTextArea.setForeground(java.awt.Color.green);
jTextArea.setForeground(java.awt.Color(0,1,0));
set(jTextArea,'Foreground','green');
set(jTextArea,'Foreground',[0,1,0]);
end
for j = 1:10000
A9=['A':'Z' '0':'9' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ';];
Data=zeros(length(A9),105);
for k=1:size(Data,2)
Data(:,k)=randperm(length(A9));
end
Data=A9(Data)
end
for i = 3:4
jTextArea = listeners(i);
jTextArea.setBackground(java.awt.Color.white);
jTextArea.setBackground(java.awt.Color(1,1,1));
set(jTextArea,'Background','white');
set(jTextArea,'Background',[1,1,1]);
jTextArea.setForeground(java.awt.Color.black);
jTextArea.setForeground(java.awt.Color(0,0,0));
set(jTextArea,'Foreground','black');
set(jTextArea,'Foreground',[0,0,0]);
end
clc
I would want to change that central for-loop to a while-loop, but I was having issues trying to figure out how to leave the while loop with a keypress.
I'm wondering if anyone has any better ideas for how to achieve this falling rain effect as right now this code more spams random letters than having them rain.
댓글 수: 0
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!