Help on Matrix falling rain code

7 views (last 30 days)
Ryan
Ryan on 25 May 2015
Edited: Ryan on 25 May 2015
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.

Answers (0)

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!