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!