Python模拟“黑客帝国”影片中的终端动画脚本
前言
翻阅Github发现一个模拟黑客帝国终端动画的效果!只需要安装以后运行简单命令就好!效果图:
安装
采用Python包管理工具pip安装即可:
pipinstallgit+https://github.com/will8211/unimatrix.git
运行
安装好以后在终端运行下面命令即可:
unimatrix-n-s96-lounimatrix-cblue-uILovePythonunimatrix-cyellow-le
命令参数
USAGEunimatrix[-a][-b][-cCOLOR][-f][-gCOLOR][-h][-lCHARACTER_LIST][-n][-o][-sSPEED][-uCUSTOM_CHARACTERS]OPTIONALARGUMENTS-aAsynchronousscroll.Lineswillmoveatvariedspeeds.-bUseonlyboldcharacters-cCOLOROneof:green(default),red,blue,white,yellow,cyan,magenta,black-fEnable"flashers,"charactersthatcontinuouslychange.-gCOLORBackgroundcolor(See-c).Defaultstokeepingterminal's current background.-hShowthishelpmessageandexit-lCHARACTER_LISTSelectcharacterset(s)usingastringoverlettercodes(seeCHARACTERSETSbelow.)-nDonotuseboldcharacters(overrides-b)-oDisableon-screenstatus-sSPEEDIntegerupto100.0usesaone-seconddelaybeforerefreshing,100usesnone.Usenegativenumbersforevenlowerspeeds.Default=85-tTIMEExittheprocessafterTIMEseconds-uCUSTOM_CHARACTERSYourownstringofcharacterstodisplay.Encloseinsinglequotes('')toescapespecialcharacters.Forexample:-u'#$('-wSingle-wavemode:Doesasingleburstofgreenrain,exits.Youcanputina.bashrcfiletorunwhenyourterminallaunches.Workswellwithspeedat95.LONGARGUMENTS-a--asynchronous-b--all-bold-c--color=COLOR-f--flashers-g--bg-color=COLOR-h--help-l--character-list=CHARACTER_LIST-s--speed=SPEED-n--no-bold-o--status-off-t--time-u--custom_characters=CUSTOM_CHARACTERS-w--single_waveCHARACTERSETSWhenusing'-l'or'--character_list='option,followitwithoneormoreofthefollowingletters:aLowercasealphabetAUppercasealphabetcLowercaseRussianCyrillicalphabetCUppercaseRussianCyrillicalphabeteAfewcommonemoji(☺☻✌♡♥❤⚘❀❃❁✼☀✌♫♪☃❄❅❆☕☂★)gLowercaseGreekalphabetGUppercaseGreekalphabetkJapanesekatakana(half-width)mDefault'Matrix'set,equalto'knnssss'nNumbers0-9o'Old'stylenon-unicodeset,likecmatrix.Equalto'AaSn'pKlingonpIqaD(requires'Horta'familyfont)*PKlingonpIqaD(requires'Klingon-pIqaD'or'Code2000'familyfont)*rLowercaseRomannumerals(mcclllxxxxvvvvviiiiii)RUppercaseRomannumerals(MCCLLLXXXXVVVVVIIIIII)sAsubsetofsymbolsactuallyusedintheMatrixfilms(-=*_+|:<>" )SAllcommonkeyboardsymbols(`-=~!z#$%^&*()_+[]{}|\;':",./<>?" )uCustomcharactersselectedusing-uswitchForexample:'-l naAS'or'--character_list=naAS'willgivesomethingsimilartotheoutputoftheoriginalcmatrixprograminitsdefaultmode.'-l ACG'willusealltheupper-casecharactersets.Usethesamelettermultipletimestoincreasethefrequencyofthecharacterset.Forexample,thedefaultsettingisequalto'-l knnssss'.*WithmostmodernLinuxterminals(gnome-terminal,konsole,lxterminal,xfce4-terminal,mate-terminal)simplyhavingthefontinstalledsystem-wideisenough.TheterminalwillfallbacktoitfortheKlingon,meaningthatyoudon't have to select it in your terminal settings. 'Horta' seems not toworkinKonsole.Fontsmayneedtobesetmanuallyasfallbacksin.Xresourcesforolderterminals,suchasurxvtandxterm.KEYBOARDCONTROLSPACE,CTRL-corqexit-orLEFTdecreasespeedby1+orRIGHTincreasespeedby1[orDOWNdecreasespeedby10]orUPincreasespeedby10atoggleasynchronousscrollingbcyclethroughboldcharacteroptions(boldoff-->boldon-->allbold)ftoggleflashingcharactersotoggleon-screenstatus1to9setcolor:(1)Green(2)Red(3)Blue(4)White(5)Yellow(6)Cyan(7)Magenta(8)Black(9)Terminaldefault!to(setbackgroundcolor(samecolorsasabove,butpressingshift+number)EXAMPLESMimicdefaultoutputofcmatrix(nounicodecharacters,worksinTTY):$unimatrix-n-s96-loUsethelettersfromthenameofyourfavoriteoperatingsysteminboldblue:$unimatrix-B-uLinux-cblueUsedefaultcharacterset,plusdollarsymbol(notesinglequotesaroundspecialcharacter):$unimatrix-lknnssssu-u'$'Noboldcharacters,slowly,usingemojis,numbersandafewsymbols:$unimatrix-n-lens-s50
网友评论