TeX - LaTeX Asked on July 19, 2021
documentclass[11pt]{article}
usepackage{CJKutf8}
usepackage{tikz}
usepackage{ifthen}
usetikzlibrary{backgrounds,calc}
definecolor{mybackground}{rgb}{0,0,0}
definecolor{mygreen}{RGB}{21,138,12}
definecolor{white}{RGB}{255,255,255}
defmyopacity{0} %From 0 to 1
defncol{40}
defnrow{80}
begin{document}
begin{tikzpicture}[remember picture,overlay,show background rectangle,
background rectangle/.style={fill=mybackground},color=mygreen,align=center]
pgfmathsetseed{1}
pgfmathsetmacro{ncolEND}{ncol-1}
pgfmathsetmacro{nrowEND}{nrow-1}
pgfmathdeclarerandomlist{letters}{%
{begin{CJK}{UTF8}{min} リ end{CJK}}
{begin{CJK}{UTF8}{min} ス end{CJK}}
{begin{CJK}{UTF8}{min} ト end{CJK}}
{begin{CJK}{UTF8}{min} は end{CJK}}
{begin{CJK}{UTF8}{min} 集 end{CJK}}
{begin{CJK}{UTF8}{min} よ end{CJK}}
{begin{CJK}{UTF8}{min} く end{CJK}}
{begin{CJK}{UTF8}{min} あ end{CJK}}
{begin{CJK}{UTF8}{min} る end{CJK}}
{begin{CJK}{UTF8}{min} 質 end{CJK}}
{begin{CJK}{UTF8}{min} 問 end{CJK}}
{begin{CJK}{UTF8}{min} と end{CJK}}
{begin{CJK}{UTF8}{min} そ end{CJK}}
{begin{CJK}{UTF8}{min} の end{CJK}}
{begin{CJK}{UTF8}{min} 答 end{CJK}}
{begin{CJK}{UTF8}{min} を end{CJK}}
{begin{CJK}{UTF8}{min} 集 end{CJK}}
{begin{CJK}{UTF8}{min} め end{CJK}}
{begin{CJK}{UTF8}{min} 役 end{CJK}}
{begin{CJK}{UTF8}{min} に end{CJK}}
{begin{CJK}{UTF8}{min} 立 end{CJK}}
{begin{CJK}{UTF8}{min} つ end{CJK}}
{begin{CJK}{UTF8}{min} よ end{CJK}}
{begin{CJK}{UTF8}{min} う end{CJK}}
{begin{CJK}{UTF8}{min} し end{CJK}}
{begin{CJK}{UTF8}{min} た end{CJK}}
{begin{CJK}{UTF8}{min} も end{CJK}}
{begin{CJK}{UTF8}{min} も end{CJK}}
{begin{CJK}{UTF8}{min} の end{CJK}}
{begin{CJK}{UTF8}{min} で end{CJK}}
{begin{CJK}{UTF8}{min} す end{CJK}}
{begin{CJK}{UTF8}{min} 大 end{CJK}}
{begin{CJK}{UTF8}{min} こ end{CJK}}
%Some voids to get sparse sequences
{}{}{}{}{}{}{}{}{}{}{}{}{}{}
%Mirrored numbers
{reflectbox{textsf{2}}}
{reflectbox{textsf{7}}}
{reflectbox{textsf{4}}}
{reflectbox{textsf{3}}}
{reflectbox{textsf{5}}}
{reflectbox{textsf{6}}}
{reflectbox{textsf{8}}}
{reflectbox{textsf{9}}}
}%
pgfmathsetmacro{maxcodelength}{nrow-15}
foreach col in {1,...,ncolEND}{
pgfmathrandominteger{codelength}{2}{maxcodelength}
pgfmathrandominteger{FLAG}{1}{20}
pgfmathrandominteger{Highlight}{1}{20}
ifthenelse{FLAG<11}{%
pgfmathrandomitem{letter}{letters}
%the next 3 lines are to highlight the bottom symbol of the sequence
ifthenelse{Highlight<17}{%
node [mygreen!60!white] at ($(current page.south west)+({paperwidth/ncol*col},{paperheight/nrow*(codelength-1)})$) {letter};}{%
node at ($(current page.south west)+({paperwidth/ncol*col},{paperheight/nrow*(codelength-1)})$) {letter};}
foreach i in {codelength,...,nrowEND}{%else
pgfmathrandomitem{letter}{letters}
node at ($(current page.south west)+(paperwidth/ncol*col,paperheight/nrow*i)$) {letter};}}{%
foreach i in {1,...,codelength}{%
pgfmathrandomitem{letter}{letters}
node at ($(current page.south west)+(paperwidth/ncol*col,paperheight/nrow*i)$) {letter};}}
}
fill [draw=none, fill=white, fill opacity=myopacity] (current page.south west)--(current page.north west)--(current page.north east)--(current page.south east)--cycle;
end{tikzpicture}
thispagestyle{empty}
begin{center}
Hugetexttt{textcolor{white}{Thank you}}
end{center}
newpage
Another page
end{document}
Produces
How does one animate “The matrix” background so that the text is changing as in the matrix movie?
I guess you would loop through the current Japanese characters or have them play in a pseudo-random order.
Lastly,Is it possible to put a tikz animation into html or convert it into a gif? I wanted to make a website using the matrix tikz animation.
Here is a MWE.
Colors and opacity are your duty.
% !TEX encoding = UTF-8 Unicode
% !TEX TS-program = xelatex
documentclass[tikz]{standalone}
defPMS{pgfmathsetmacro}
usepackage{fontspec}
setmainfont{PingFang TC}
deffontA{fontspec{Lantinghei TC Extralight}}
deffontB{fontA[Renderer=AAT,Vertical=RotatedGlyphs]}
begin{document}
newcountcorpuscount
defreadcorpus#1 {%
advancecorpuscount by 1relax
pgfkeys{/corpus/thecorpuscount/.initial=#1}%
}
readcorpus 王若曰父瘖丕顯文武皇天引厭厥德配我有周膺受大命率懷不廷方
readcorpus 亡不閈于文武耿光唯天將集厥命亦唯先正略又劂䢃屬謹大命肆皇
readcorpus 天亡斁臨保我有周丕鞏先王配命旻天疾威司余小子弗彶邦將曷吉
readcorpus 跡跡四方大縱不靜烏乎?余小子圂湛于艱永鞏先王王曰父瘖今余
readcorpus 唯肇經先王命命汝䢃我邦我家外內惷于小大政屏朕位虩許上下若
readcorpus 否?四方死毋動余一人在位引唯乃智余非庸又昏汝毋敢荒寧虔夙
readcorpus 夕惠我一人雍我邦小大猷毋折緘告余先王若德用仰昭皇天申恪大
readcorpus 命康能四國欲我弗作先王憂王曰父瘖?之庶出入事于外敷命敷政
readcorpus 藝小大楚賦無唯正昏引其唯王智廼唯是喪我國歷自今出入敷命于
readcorpus 外厥非先告父?父?舍命毋有敢惷敷命于外王曰父瘖今余唯申先
readcorpus 王命命汝極一方宏我邦我家汝顀于政勿雍建庶人毋敢龔苞龔廼侮
readcorpus 鰥寡善效乃有正毋敢湎于酒汝毋敢墜在乃服恪夙夕敬念王威不惕
readcorpus 汝毋弗帥用先王作明型欲汝弗以乃辟陷于艱王曰父瘖巳曰及茲卿
readcorpus 事寮大史寮于父即尹命汝司公族叄有司小子師氏虎臣雩朕執事以
readcorpus 乃族干捍吾王身取徵卅爰賜汝秬鬯一鹵裸圭瓚寶朱市悤黃玉環玉
readcorpus 玉余金車賁糸屖較朱鞹鞃靳虎冪熏裹右厄畫革尃畫車昏金甬錯衡
readcorpus 金踵金豪束金簟笰魚箙馬四匹攸勒金巤金膺朱旂二鈴錫女茲賸用
readcorpus 歲用政毛公瘖對揚天子皇休用作尊鼎子子孫孫永寶用
readcorpus 用夨戈菐散邑廼即散用田履自瀗涉以南至於大沽一封以陟二封至
readcorpus 於邊柳復涉瀗陟雩?□□阜美以西封於播城楮木封於芻逨封於芻
readcorpus 道內陟芻登於廠湶封者刀木厈阜美陵崗木厈封於原道封於周道以
readcorpus 東封於□東疆右還封於履道以南封於□逨道以西至於工隹莫履井
readcorpus 邑田自桹木道左至於井邑封道以東一封還以西一封陟崗三封降以
readcorpus 南封於同道陟州崗登木厈降棫二封夨人有司履田鮮且微武父西宮
readcorpus 襄豆人虞考彔貞師氏右眚小門人繇原人虞艿淮司工虎□龠豐父工
readcorpus 隹人有司刑考凡十又五夫正履夨舍散田司徒逆司馬單堒邦人司工
readcorpus 馬京君宰德父散人小子履田戎微父效□父襄之有司橐州□修從□
readcorpus 凡散有司十夫隹王九月辰才乙卯夨俾鮮且□旅誓曰我既付散氏田
readcorpus 器有爽實余有散氏心賊則爰千罰千傳棄之鮮且□旅則誓廼俾西宮
readcorpus 襄武父誓曰我既付散氏濕田□田余有爽變爰千罰千西宮襄武父則
readcorpus 誓氒受圖夨王於豆新宮東廷氒左執要史正中農。
%
%tikz{
% Test corpus content
% draw(-10,-10)rectangle(10,10);
% foreachs in{1,...,10}{
% draw(0,s)node{pgfkeysvalueof{/corpus/s}};
% }
%}
defnframe{30}
foreachframe in{1,...,10}{
tikz{
clip[postaction={fill=yellow}](-10,-10)rectangle(10,10);
% iterate over sentences
pgfmathsetseed{45277}
foreachsen in{1,...,corpuscount}{
% decide z coordinate (depth)
PMSsenz{rnd*20} % initial depth [0,20]
PMSsenz{Mod(senz-20*frame/nframe,20)} % animating depth [0,20]
PMSsens{20/(10+senz)} % projection to the screen
% decide x coordinate (horizontal)
PMSsenx{(sen+.5)*20/corpuscount-10+rand} % absolute position [-10,10]
PMSsenx{senx*sens} % position on frame
% decide y coordinate (vertical)
PMSseny{rand*5} % absolute position [-5,5]
PMSseny{seny*sens} % position on frame
% decide mask position
PMSsenm{random(1,30)} % initial mask [0,30] % nframe is a multiple of this
PMSsenm{Mod(senm-frame,30)-15} % animating mask [-15,14]
% decide glyph rotation
PMSseng{random(0,1)}
% place node and mask
begin{scope}[shift={(senx,seny)},scale=sens]
clip[x=1em,y=1em]
(-.5,senm+8)rectangle(.5,senm+22)
(-.5,senm-8)rectangle(.5,senm-22);
node[scale=sens,rotate={90-180*random(0,1)}]{
ifnumseng=0fontAelsefontBfi
pgfkeysvalueof{/corpus/sen}
};
end{scope}
}
}
}
end{document}
PS. the gif is seamless because the Mod
operator.
Corpus taken from https://en.wikipedia.org/wiki/Mao_Gong_ding and https://zh.wikipedia.org/wiki/%E6%95%A3%E6%B0%8F%E7%9B%A4
Correct answer by Symbol 1 on July 19, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP