JSMatrixCodeRainView
JSMatrixCodeRainView copied to clipboard
A Swift implementation of Code Rain / Digital Rain visual effect from Matrix movie.
JSMatrixCodeRainView
Code Rain, or Digital Rain, is a famous visual effect from the Matrix movie trilogy. This view is a Swift implementation to it.

Requirements
JSMatrixCodeRainView works on iOS8.0+(Tested) with ARC projects.
It uses the following frameworks:
- Foundation.framework
- UIKit.framework
- QuartzCore.framework
Usage
-
Modify your Info.plist;
The view used a customized font called 'Matrix Code NFI', to include that you need to add an entry,
Fonts provided by applicationin theInfo.plist.
-
Copy
JSMatrixCodeRainView.swiftand the font file to your project; -
Configure if needed. There are three configurable variables now:
speed, aCGFloatvalue, the unit is insecond, controls the speed of the animation. The value is the time interval of the characters coming from above.
For example, the default value is 0.15, which means in every 0.15s, a new character will drop (if reasonable).newTrackComingLap, also aCGFloatvalue, the unit issecond, generally control the number of the tracks.
Again as an example, the default value is 0.4, means that in every 0.4s, a new track will drop down from the available space (that is, there's no others occupying.)tracksSpacing, anIntvalue, the unit ischaracter, control the spacing of two tracks.
The default value is 5, therefore after a track is completely shown, there will be no other track from the same line unless 5 characters passed.
You can manually set it or set it via Interface Builder, as shown below:

-
That's all. Use it as any
UIViews.
Special Thanks
The font Matrix Code NFI is from Norfok® Inc. software.
License
This code is distributed under the terms and conditions of the MIT license.
Also check the Matrix Code NFI license if you're intended to commercial use.