File:Video superdense coding.ogg

Z projektu Wikimedia Commons
Skočit na navigaci Skočit na vyhledávání

Původní soubor(Multiplexovaný audio/video soubor Ogg, Theora/Vorbis, délka 40 s, 2 500×1 250 pixelů, celkem 2,54 Mbps, velikost souboru: 12,25 MB)

Popisky

Popisky

Video s kvantovým superhustým kódováním

Popis

[editovat]
Popis
English: Video depicting the quantum superdense coding protocol. The goal is to send a classical two-bit message from one station, A, to another station, B, by sending only one qubit. At first, a pair of entangled particles is distributed to A and B, which pair is shown as two particles connected by a wavy line and produced by source S. Once this preparation step is finished, the superdense coding itself begins. Station A applies one of four operations to its entangled particle depending on the message it wants to send. In the video, the double of bits 1 and 0 is sent, which is mapped into a bottom-left position of an arrow in a "clock". Station A then sends its particle to station B, which subjects both particles to a quantum measurement in the Bell basis. The measurement result can be mapped back from the position of the arrow into the bit encoding. This way, the transfer of two bits of classical message with only one particle is completed.
Čeština: Video zobrazující kvantové superhusté kódování. Cílem je poslat dva bity klasické zprávy ze stanice A do stanice B využitím pouze jediného qubitu. Nejprve je pár provázaných částic rozeslán mezi A a B, kterýžto pár je vytvořen zdrojem S a je vyobrazen jako dvě částice spojené vlnitou čarou. Jakmile je tento přípravný krok dokončen může započít samotné superhusté kódování. Stanice A aplikuje na svoji provázanou částici jednu ze čtyř operací v závislosti na zamýšlené zprávě. Na videu je zaslána dvojice bitů 1 a 0, kterou lze reprezentovat jako šipku směřující vlevo dolů na "hodinách". Stanice A posléze pošle svoji částici do stanice B, která obě částice změří v Bellově bázi. Naměřenou hodnotu, vyjádřenou jako pozici šipky na měřicím přístroji, lze interpretovat zpět jako dva bity. Takto lze přenést dva bity informace zasláním jediné částice.
Datum
Zdroj Vlastní dílo
Autor JozumBjada

Licence

[editovat]
Já, držitel autorských práv k tomuto dílu, ho tímto zveřejňuji za podmínek následující licence:
w:cs:Creative Commons
uveďte autora zachovejte licenci
Dílo smíte:
  • šířit – kopírovat, distribuovat a sdělovat veřejnosti
  • upravovat – pozměňovat, doplňovat, využívat celé nebo částečně v jiných dílech
Za těchto podmínek:
  • uveďte autora – Máte povinnost uvést autorství, poskytnout odkaz na licenci a uvést, pokud jste provedli změny. Toho můžete docílit jakýmkoli rozumným způsobem, avšak ne způsobem naznačujícím, že by poskytovatel licence schvaloval nebo podporoval vás nebo vaše užití díla.
  • zachovejte licenci – Pokud tento materiál jakkoliv upravíte, přepracujete nebo použijete ve svém díle, musíte své příspěvky šířit pod stejnou nebo slučitelnou licencí jako originál.

This video uses these sounds from freesound: "Free Music Background Loop 003 - Var 08" by user Slaking_97 licensed under CC BY 4.0, "Pop 4" by user theplax licensed under CC BY 4.0, "Cartoon Boing.wav" by user reelworldstudio licensed under CC0 1.0, "clase1.wav" by user maralvarez9 licensed under CC0 1.0, "lightsaber5.mp3" and "lightsaber3.mp3" by user gyzhor licensed under CC0 1.0, "Richcraft - chime 4 20181219.wav" by user richcraftstudios licensed under CC BY 4.0, "Whoop.wav" by user Mark_Ian licensed under CC0 1.0, "Sliding Doors" by user SwagMuffinPlus licensed under CC0 1.0, "Sci Fi portal.wav" by user Bzourk licensed under CC0 1.0.

Source code

[editovat]

This animation was created using Wolfram language 13.0.1 for Microsoft Windows (64-bit) (January 28, 2022). The source code follows (formatted as a .wl package file).

(* ::Package:: *)

(* ::Chapter:: *)
(*Preliminaries*)


(* ::Input::Initialization:: *)
$HistoryLength=2;


ClearAll["Global`*"]


(* ::Section:: *)
(*Note on sound samples*)


(* ::Subsection:: *)
(*Code*)


(* ::Text:: *)
(*see: https://freesound.org/help/faq/*)


(* ::Input::Initialization:: *)
audfileslic={
{"586101__slaking_97__free-music-background-loop-003-var-08.wav","Free Music Background Loop 003 - Var 08" ,"freesound.org/people/Slaking_97/sounds/586101/","Slaking_97", "Attribution 4.0 License"},
{"545198__theplax__pop-4.wav","Pop 4","freesound.org/people/theplax/sounds/545198/", "theplax", "Attribution 4.0 License"},
{"161122__reelworldstudio__cartoon-boing.wav","Cartoon Boing.wav","freesound.org/people/reelworldstudio/sounds/161122/", "reelworldstudio", "Creative Commons 0 License"},
{"376936__maralvarez9__clase1.wav","clase1.wav","freesound.org/people/maralvarez9/sounds/376936/", "maralvarez9", "Creative Commons 0 License"},
{"47127__gyzhor__lightsaber5.mp3","lightsaber5.mp3","freesound.org/people/gyzhor/sounds/47127/", "gyzhor", "Creative Commons 0 License"},
{"47125__gyzhor__lightsaber3.mp3","lightsaber3.mp3","freesound.org/people/gyzhor/sounds/47125/", "gyzhor", "Creative Commons 0 License"},
{"454610__richcraftstudios__richcraft-chime-4-20181219.wav","Richcraft - chime 4 20181219.wav","freesound.org/people/richcraftstudios/sounds/454610/", "richcraftstudios", "Attribution 4.0 License"},
{"243468__mark_ian__whoop.wav","Whoop.wav","freesound.org/people/Mark_Ian/sounds/243468/", "Mark_Ian", "Creative Commons 0 License"},
{"176146__swagmuffinplus__sliding-doors.wav","Sliding Doors","freesound.org/people/SwagMuffinPlus/sounds/176146/","SwagMuffinPlus","Creative Commons 0 License"},
{"322059__bzourk__sci-fi-portal.wav","Sci Fi portal","https://freesound.org/people/Bzourk/sounds/322059/","Bzourk","Creative Commons 0 License"}
};


(* ::Input::Initialization:: *)
urlLic[{file_,name_,url_,user_,lic_},text_:False]:=Module[{link},
link=Switch[lic,
"Attribution 4.0 License",{"CC BY 4.0","creativecommons.org/licenses/by/4.0/"},
"Creative Commons 0 License",{"CC0 1.0","creativecommons.org/publicdomain/zero/1.0/"},
_,$Failed
];
If[text,
"\[FilledCircle] \[OpenCurlyDoubleQuote]"<>name<>"\[CloseCurlyDoubleQuote] by user "<>user <>" (https://"<>url<>") licensed under "<>link[[1]]<>" (https://"<>link[[2]]<>")",
"\""<>name<>"\" by user "<>user <>" (https://"<>url<>") licensed under "<>link[[1]]<>" (https://"<>link[[2]]<>")"
]
]


(* ::Input:: *)
(*StringRiffle[urlLic[#,False]&/@audfileslic,"\n"]*)


(* ::Subsection:: *)
(*Statement*)


(* ::Text:: *)
(*This video uses these sounds from freesound:*)


(* ::Text:: *)
(*\[FilledCircle] "Free Music Background Loop 003 - Var 08" by user Slaking_97 (https://freesound.org/people/Slaking_97/sounds/586101/) licensed under CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/)*)
(*\[FilledCircle] "Pop 4" by user theplax (https://freesound.org/people/theplax/sounds/545198/) licensed under CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/)*)
(*\[FilledCircle] "Cartoon Boing.wav" by user reelworldstudio (https://freesound.org/people/reelworldstudio/sounds/161122/) licensed under CC0 1.0 (https://creativecommons.org/publicdomain/zero/1.0/)*)
(*\[FilledCircle] "clase1.wav" by user maralvarez9 (https://freesound.org/people/maralvarez9/sounds/376936/) licensed under CC0 1.0 (https://creativecommons.org/publicdomain/zero/1.0/)*)
(*\[FilledCircle] "lightsaber5.mp3" by user gyzhor (https://freesound.org/people/gyzhor/sounds/47127/) licensed under CC0 1.0 (https://creativecommons.org/publicdomain/zero/1.0/)*)
(*\[FilledCircle] "lightsaber3.mp3" by user gyzhor (https://freesound.org/people/gyzhor/sounds/47125/) licensed under CC0 1.0 (https://creativecommons.org/publicdomain/zero/1.0/)*)
(*\[FilledCircle] "Richcraft - chime 4 20181219.wav" by user richcraftstudios (https://freesound.org/people/richcraftstudios/sounds/454610/) licensed under CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/)*)
(*\[FilledCircle] "Whoop.wav" by user Mark_Ian (https://freesound.org/people/Mark_Ian/sounds/243468/) licensed under CC0 1.0 (https://creativecommons.org/publicdomain/zero/1.0/)*)
(*\[FilledCircle] "Sliding Doors" by user SwagMuffinPlus (https://freesound.org/people/SwagMuffinPlus/sounds/176146/) licensed under CC0 1.0 (https://creativecommons.org/publicdomain/zero/1.0/)*)
(*\[FilledCircle] "Sci Fi portal" by user Bzourk (https://https://freesound.org/people/Bzourk/sounds/322059/) licensed under CC0 1.0 (https://creativecommons.org/publicdomain/zero/1.0/)*)


(* ::Section:: *)
(*Constants*)


(* ::Input::Initialization:: *)
idxGlob=3;(*global index of the measurement result*)


(* ::Input::Initialization:: *)
totaldur=40; (*total duration of the video in seconds*)


(* ::Input::Initialization:: *)
opts3D={ViewPoint->Above,Boxed->False,Lighting->"ThreePoint"};
opts2D={PlotRange->{4{-1,1},2{-0.9,1.1}},ImageSize->700};
fontFamily="Times";
blurMax=50; (*maximum blurring of background*)

hoff=2.5; (*horizontal position of large Bob's box*)
hoffExt=3; (*horizontal position of small Bob's box*)
hoffEnt=1.3;(*horizontal position of acted upon qubit*)
hoffQ=1.1; (*horizontal position of a moved qubit*)
voffQ=0.8; (*vertical position of a still qubit*)

voffTextS=-0.6; (*vertical position of text labels for small stations of Alice and Bob*)
voffTextL=-1.4; (*vertical position of text labels for large stations of Alice and Bob*)
voffClock=1.5;(*vertical position of the "clock"*)


(* ::Input::Initialization:: *)
With[{colfun=RGBColor["#"<>#]&},
aliCol=colfun["00464a"]; (*Alice's color*)
bobCol=colfun["F77F00"]; (*Bob's color*)
entCol=colfun["A877FD"]; (*color of entangled photons*)
entColAfter=RGBColor[1, 0.07, 0.74];(*color of entangled photons after Alice's device*)
mesCol=colfun["94f000"]; (*color of the message*)
devCol=Purple;(*color of active device*)
meaCol=colfun["EAE2B7"]; (*color of the measured qubits*)
sorCol=Lighter@entCol; (*color of the source*)
idleCol=Lighter@Gray; (*color of idle parts of the "clock"*)
]


(* ::Section:: *)
(*Auxiliary functions*)


(* ::Input::Initialization:: *)
aliText[pos_:{-hoff,voffTextS},fade_:0]:=Text[styleText["A",Blend[{aliCol,White},fade]],pos,{0,0}]
bobText[pos_:{hoff,voffTextS},fade_:0]:=Text[styleText["B",Blend[{bobCol,White},fade]],pos,{0,0}]


(* ::Input::Initialization:: *)
unfadeImg[img_,lev_]:=SetAlphaChannel[img,ImageMultiply[AlphaChannel[img],GrayLevel[lev]]]
styleText[text_,col_,size_:35]:=Style[text,col,size,Bold,FontFamily->fontFamily]
rastFun[obj_]:=Rasterize[obj,Background->None]
insetWrap[obj_,size_:1,pos_:{0,0}]:=Inset[obj,pos,ImageScaled[{1,1}/2],size]
fadFun[t_]:=Piecewise[{{0,t<=0.8},{Rescale[t,{0.8,1},{0,1}],t>0.8}}]
popFun=Function[t, Piecewise[{{0.,t == 0}}, 2^(10t - 10)]];(* see ResourceFunction["EasingFunction"]*)


(* ::Input::Initialization:: *)
With[{defmat=(*"Rubber"*)"Plastic"(*"Glazed"*)},
shadingFun[col_,mat_:defmat]:=MaterialShading[{mat,col}]

(* --- MaterialShading rendering  is time-consuming, faster alternative is not using it: --- *)
(*shadingFun[col_,mat_:defmat]:=col*) 
]


(* ::Input::Initialization:: *)
disk3D=ResourceFunction["Disk3D"]
rcub3D=ResourceFunction["RoundedCuboid"]
rcyl3D=ResourceFunction["RoundedCylinder"]
rann3D=ResourceFunction["RoundedAnnulus3D"]


(* ::Input::Initialization:: *)
createPiecewise[itimes_,funs_]:=Module[{fun,def=Last[funs][1]},
If[Length[itimes]!=Length[funs]+1,Print["Number of times should be equal to number of functions plus one."];Return[{}]];
Function[{x},Evaluate@Piecewise[
Prepend[MapThread[If[#2==#3,Nothing,{#1[Rescale[x,{#2,#3},{0,1}]],x<#3}]&,{funs,Most[itimes],Rest[itimes]}],
{{},x<First[itimes]}
],def]]
];


(* ::Input::Initialization:: *)
serialize[fun_,numstages_,idx_,itimes_:None]:=Module[{n=numstages,times=itimes,f,t,tglob},
If[times===None,times=Subdivide[numstages]];
f=createPiecewise[times,Table[With[{s=s},Inactivate@fun[idx,s,#,tglob]&],{s,numstages}]];
Function[{t,tglob1},Activate[f[t]/.tglob->tglob1]]
]


(* ::Input::Initialization:: *)
ballFun[col_]:=ballFun[col]=insetWrap[rastFun[Graphics[insetWrap[Graphics3D[{shadingFun[col,"Foil"],Ball[]},Lighting->"Accent",Sequence@@opts3D],.3],PlotRange->.153]],.3]
{qubBallRast,meaBallRast}=rastFun[Graphics[ballFun[#],PlotRange->.153]]&/@{mesCol,meaCol};


(* ::Section:: *)
(*Source and entangled photons*)


(* ::Input::Initialization:: *)
sourceRast=With[{fontcol=Darker[sorCol,.5]},
rastFun@Graphics3D[{
shadingFun[sorCol],rcub3D[-{6,5,2},{6,5,2},RoundingRadius->1.5],rcyl3D[{{0,6,-2.3},{0,0,-2.3}},4]
},Sequence@@opts3D,Epilog->{Thickness[.03],fontcol,Circle[ImageScaled[{1,1}/2],.28],Text[styleText["S",fontcol,45],ImageScaled[{1,1}/2],{0,0}]},PlotRange->{6.71{-1,1},5.72{-1,1},2.2{-1,1}},ImageSize->150]
];


(* ::Input::Initialization:: *)
signeVectorAngle=ResourceFunction["SignedVectorAngle"]


(* ::Input::Initialization:: *)
wavyLine=Cases[InputForm@Plot[(1+Pi^2 x^2)/(1+Pi^2)Sin[10x Pi]/10,{x,-1,1}],_Line,Infinity,1];
entWavyFun[pt1_,pt2_,t_]:=
{entCol,AbsoluteThickness[2],CapForm["Round"],Rotate[Translate[Scale[wavyLine,.001+Norm[pt2-pt1]/2{1,Cos[6\[Pi] t]}],(pt1+pt2)/2],signeVectorAngle[{1,0},pt2-pt1]]}


(* ::Section:: *)
(*Clocks*)


(* ::Input::Initialization:: *)
clockfac=0.17;


(* ::Input::Initialization:: *)
clockRaw[a_,col_]:=clockRaw[a,col]={col,EdgeForm[],rann3D[{{0,0,0},{0,0,.2}},{1.3,1.5}],Rotate[rcub3D[{0.15,-0.1,-0.15},{1.4,0.1,0.15},RoundingRadius->.02],a,{0,0,1}]};


(* ::Input::Initialization:: *)
clockArrow[idx_,sizefac_:1,col_:Lighter@Gray]:=With[{rad=2.2},
  {col,Rotate[Rectangle[clockfac sizefac{0.15, -0.1},clockfac sizefac {1.4, 0.1},RoundingRadius ->clockfac .02sizefac], \[Pi]/2 (idx- 1) + \[Pi]/4, {0, 0}]}
]


(* ::Input::Initialization:: *)
clockLabel[idx_,sizefac_:1,col_:Lighter@Gray,fontSizeFac_:1]:=With[{fontSize=20,rad=2.8},
Text[styleText[StringJoin[ToString /@ IntegerDigits[idx- 1, 2, 2]],col,fontSize fontSizeFac ]
,clockfac sizefac rad AngleVector[ \[Pi]/2 (idx - 1) + \[Pi]/4]]
]


(* ::Input::Initialization:: *)
clockAux[idx_,
{actfontfac_:1,actfontcol_:mesCol,actfontcolb_:White},
{idlefontfac_:1,idlefontcol_:idleCol,idlefontcolb_:White},
{actarrowfac_:1,actarrowcol_:mesCol,actarrowcolb_:White},
{idlearrowfac_:1,idlearrowcol_:idleCol,idlearrowcolb_:White},
{ringfac_:1,ringcol_:mesCol,ringcolb_:White}
]:=Module[{rad =2.1,colBr=mesCol,didx=Complement[Range[4],{idx}]},
{
(*active label and arrow*)
clockLabel[idx,1,Blend[{actfontcolb,actfontcol},actfontfac],1],
clockArrow[idx,1,Blend[{actarrowcolb,actarrowcol},actarrowfac]],

(*idle labels and arrows*)
clockLabel[#,1,Blend[{idlefontcolb,idlefontcol},idlefontfac],1]&/@didx,
clockArrow[#,1,Blend[{idlearrowcolb,idlearrowcol},idlearrowfac]]&/@didx,

(*ring*)
{Blend[{ringcolb,ringcol},ringfac], EdgeForm[], AbsoluteThickness[3], Circle[{0, 0},clockfac 1.4]}
}
]


(* ::Input::Initialization:: *)
clockBox[idx_,stage_,t_,tglob_]:=Module[{},
(*tglob is not used*)
(*0 - idle state, 1 - fading away idle parts, 2 - fading away active message, 3 - fading away active clock, 4 - appearing all idle parts, 5 - coloring of active message, 6 - fading away everything except the active message, 7 - appearing everything with an active arrow*)
Switch[stage,
0,{},
1,clockAux[idx,{1},{1-t},{1},{1-t},{t,mesCol,idleCol}],
2,clockAux[idx,{1-t},{0},{1},{0},{1}],
3,clockAux[idx,{0},{0},{1-t},{0},{1-t}],
4,clockAux[idx,{t,idleCol},{t},{1},{t},{1}],
5,clockAux[idx,{t,mesCol,idleCol},{1},{1},{1},{1}],
6,clockAux[idx,{1},{1-t},{1-t},{1-t},{1-t}],
7,clockAux[idx,{1},{t},{t},{t},{t,idleCol}]
]
]


(* ::Section:: *)
(*Landscape*)


(* ::Input::Initialization:: *)
sun={AbsoluteThickness[3],Circle[{-0.534,0.498},{0.069,0.068}]};
roof={CapForm["Square"],Line[{{0.257,0.180},{0.636,0.430}}],Line[{{0.590,0.392},{0.853,0.159}}]};
house={CapForm["Square"],Line[{{0.364,0.221},{0.339,0.004}}],Line[{{0.364,0.221},{0.693,0.204}}],Line[{{0.760,0.183},{0.782,0}}]};
{hill1,hill2}={CapForm["Round"],{White,FilledCurve[#]},#}&/@{BezierCurve[{{-0.568,0.113},{-0.568,0.113},{-0.219,0.359},{0.257,0.113}}],BezierCurve[{{-0.864,0.236},{-0.864,0.236},{-0.585,0.446},{-0.204,0.236}}]};


(* ::Input::Initialization:: *)
popLandFun[obj_,inity_][t_]:=Translate[{GrayLevel[1-t],obj},{0,inity(1-t)}]


(* ::Input::Initialization:: *)
optsLand={PlotRange->{1.1{-1,1},{-.2,.8}}};


(* ::Input::Initialization:: *)
landBoxFun[idx_,stage_,t_,tglob_]:=Module[{ts,th,th1,th2,tr,yoff=-0.1},
(*idx and tglob unused*)
{ts,th,th1,th2,tr}=Switch[stage,
0,{1,1,1,1,1},
1,{0,0,0,0,t},
2,{0,0,0,t,1},
3,{0,0,t,1,1},
4,{0,t,1,1,1},
5,{t,1,1,1,1},
6,{1,1,1,1,1}
];
Graphics[{AbsoluteThickness[4],JoinForm[{"Miter",3.8}],
Translate[sun,{0,-.5(1-ts)}],
popLandFun[roof,yoff][tr],
popLandFun[house,yoff][th],
popLandFun[{{White,Translate[Rectangle[-{.1,.2},{.1,.2}],{-.55,0.1}]},hill2},yoff][th2],
popLandFun[hill1,yoff][th1]
},Sequence@@optsLand]
]


(* ::Input::Initialization:: *)
sceneBackgroundRaw=serialize[landBoxFun,6,idxGlob];
sceneBackground[t_]:=sceneBackgroundRaw[t,0];


(* ::Input::Initialization:: *)
landBg=sceneBackground[1];
landBlurBg=Blur[landBg,blurMax];


(* ::Input::Initialization:: *)
sceneFadingBackground[t_]:=Graphics[{AbsoluteThickness[4],JoinForm[{"Miter",3.8}],GrayLevel[t],
sun,roof,house,{{White,Translate[Rectangle[-{.1,.2},{.1,.2}],{-.55,0.1}]},hill2},hill1},Sequence@@optsLand]


(* ::Section:: *)
(*Alice*)


(* ::Input::Initialization:: *)
aliBgRaw={Lighter[aliCol,.8],EdgeForm[],Rectangle[-{1.1,1.7},{1.1,1.1},RoundingRadius->.1],Lighter[aliCol,.5],StadiumShape[{{hoffEnt,-0.3},{hoffEnt,0.3}},.25]};
aliBg=Translate[aliBgRaw,{-hoff,0}];


(* ::Input::Initialization:: *)
aliDiskFun[t_]:=Module[{hue,sat,val,huelight,satlight,vallight},
{hue,sat,val}=List@@Hue[aliCol];
{huelight,satlight,vallight}=List@@Hue[Lighter@aliCol];
Translate[#,{-hoff,0}]&@{Hue[hue,Rescale[t,{0,1},{0,sat}], Rescale[t,{0,1},{0,val}],t],Disk[{0,0},.86],Hue[huelight,Rescale[t,{0,1},{0,satlight}],Rescale[t,{0,1},{0,vallight}],t],Disk[{0,0},.8]}
];


(* ::Input::Initialization:: *)
ClearAll[aliDev]
aliDev[idx_,brightness_]:=aliDev[idx,brightness]=Module[{maxbr=.6,ligthfac,cubept={5,5,2},dev},
ligthfac=Rescale[brightness,{1,0},{0,maxbr}];
dev=rastFun@Graphics3D[{{shadingFun[Lighter[aliCol,ligthfac]],rcub3D[-cubept,cubept,RoundingRadius->2]},{Lighter[aliCol,ligthfac],Scale[Translate[clockRaw[\[Pi]/2(idx-1)+ \[Pi]/4,Lighter[Darker@aliCol,ligthfac]],{0,0,2.1}],2]}},
Sequence@@opts3D,PlotRange->1.1{5.1{-1,1},5.1{-1,1},2.5{-1,1}}];
insetWrap[dev,.84]
]


(* ::Input::Initialization:: *)
aliDevActive[idx_,br_,altcol_]:=Module[{cubept={5,5,2},colbody,colcont},
colbody=Blend[{aliCol,altcol},br^2];
colcont=Blend[{Darker@aliCol,White},br^2];
insetWrap[Graphics3D[{{shadingFun[colbody],rcub3D[-cubept,cubept,RoundingRadius->2]},{Scale[Translate[clockRaw[\[Pi]/2(idx-1)+ \[Pi]/4,colcont],{0,0,2.1}],2]}},
Sequence@@opts3D,PlotRange->1.1{5.1{-1,1},5.1{-1,1},2.5{-1,1}}],1.1]
]


(* ::Input::Initialization:: *)
aliBoxFunRaw[idx_,stage_,t_]:=Module[{rad=0.95,rad1=0.5,dev,devAct,idxidle=Complement[Range[4],{idx}],t0=0.8,movef},
(*stage: 0 - idle state, 1 - active box coloring, 2 - moving boxes, 3 - moving active box, 4 - retreating active box*)

movef[tloc_]:=Piecewise[{{-((tloc(tloc - 2t0))/t0^2), tloc < t0}, {1, tloc <= 1}}];
dev[idxl_,br_:0,rad_:rad1]:=Translate[aliDev[idxl,br],rad  AngleVector[(2idxl-1)\[Pi]/4]];
devAct[idxl_,fac_:1]:=Translate[aliDevActive[idxl,fac,devCol],{hoffEnt movef[fac],0} ];

{(*devices*)
Switch[stage,
0,dev/@Range[4],
1,{dev[idx,t],dev/@idxidle},
2,{dev[idx,1,Rescale[popFun[t],{0,1},{rad1,0}]],dev[#,0,Rescale[1-popFun[1-t],{0,1},{rad1,rad}]]&/@idxidle},
3,{devAct[idx,t],dev[#,0,rad]&/@idxidle},
4,{devAct[idx,1-t],dev[#,0,rad]&/@idxidle}
]
}
]


(* ::Input::Initialization:: *)
aliBoxFun[idx_,stage_,t_]:=Translate[aliBoxFunRaw[idx,stage,t],{-hoff,0}]


(* ::Section:: *)
(*Bob*)


(* ::Input::Initialization:: *)
bobBgRaw={Lighter[bobCol,.8],EdgeForm[],Rectangle[-{1.1,1.7},{1.1,1.1},RoundingRadius->.1],Lighter[bobCol,.5],StadiumShape[{{-hoffEnt,-0.3},{-hoffEnt,0.3}},.25]};
bobBg=Translate[bobBgRaw,{hoff,0}];


(* ::Input::Initialization:: *)
bobCube=Graphics3D[{{Transparent,rcyl3D[{{0,0,-.1},{0,0.6,-.1}},.4],rcyl3D[{{0,0,0},{0.6,0,0}},.4]},{shadingFun[bobCol,"Glazed"],rcub3D[-.5{1,1,1},.5{1,1,1},RoundingRadius->.12],rcyl3D[{{-0.6,0,0},{0,0,0}},.4],rcyl3D[{{0,0,-.1},{0,-0.6,-.1}},.4]}},Sequence@@opts3D];
bobCubeRast=rastFun[bobCube];


(* ::Input::Initialization:: *)
pointer[col_]:=With[{w=0.24,wf=0.06,l=0.75,h=0.24},
{col,EdgeForm[],Cone[{{0,0,0},{0,0,1}},.3],GraphicsComplex[Join[{{0,w,0},{l,wf,0},{l,-wf,0},{0,-w,0}},ScalingTransform[{1,.8,.8}]@{{0,w,h},{l,wf,h},{l,-wf,h},{0,-w,h}}],Polyhedron[{{1,2,3,4},{5,6,7,8},{1,2,6,5},{3,4,8,7},{2,3,7,6},{4,1,5,8}}]]
}];


(* ::Input::Initialization:: *)
gauge[idx_,idle_,t_]:=With[{col=Lighter[bobCol,.6],endang=\[Pi]/2(idx-1)+\[Pi]/4,notch=rcub3D[{0.8,-0.15,-0.15},{1.4,0.15,0.15},RoundingRadius->.02]},
Graphics3D[{
(*background*)
{If[idle,col,Blend[{col,White},1-t]],disk3D[{0,0,0},1.4]},

(*rim*)
bobCol,rann3D[{{0,0,0},{0,0,.2}},{1.3,1.5}],

(*notches*)
Rotate[notch,# \[Pi]/4,{0,0,1}]&/@{1,3,5,7},

(*pointer*)
Rotate[pointer[Lighter[col,.7]],If[idle,\[Pi]/2,Rescale[t,{0,1},{\[Pi]/2,endang}]],{0,0,1}]
},Sequence@@opts3D,PlotRange->{2{-1,1},2{-1,1},{-0.01,1}}
]]


(* ::Input::Initialization:: *)
bobBoxFunRaw[idx_,stage_,t_]:=Module[{},
(*stages: 0 - idle state, 1 - flashing box and moving gauge*)
{(*device*)
insetWrap[bobCubeRast(*bobCube*),2],
insetWrap[gauge[idx,stage==0,Switch[stage,1,t,_,1]],1.2]
}
]


(* ::Input::Initialization:: *)
bobBoxFun[idx_,stage_,t_]:=Translate[bobBoxFunRaw[idx,stage,t],{hoff,0}]


(* ::Chapter:: *)
(*Scene 0*)


(* ::Section:: *)
(*Subroutines*)


(* ::Input::Initialization:: *)
lineSegFun[t_,initpt_:{-3,0},endpt_:{0,0},tt_:.8]:=initpt+Piecewise[{{Rescale[t,{0,tt},{0,1}],t<=tt},{1,True}}](endpt-initpt)


(* ::Input::Initialization:: *)
entTraj={Rescale[#1,{0,1},{0.1,2.5-hoffEnt}],Rescale[#2,{0,1},{-1,-0.3}]}&@@@{{0,0},{.1,.9},{.2,1}{.4,1},{1,1}};
{entTrajFunR,entTrajFunL}=BezierFunction/@{entTraj,{-#1,#2}&@@@entTraj};


(* ::Input::Initialization:: *)
{aliSquare,bobSquare}=rastFun[Graphics3D[{shadingFun[#],rcub3D[-{1,1,1},{1,1,1},RoundingRadius->.2]},Sequence@@opts3D]]&/@{aliCol,bobCol};
aliSquareFun[t_]:=Translate[insetWrap[unfadeImg[aliSquare,t],0.7],{-hoffExt,0}];
bobSquareFun[t_]:=Translate[insetWrap[unfadeImg[bobSquare,t],0.7],{hoffExt,0}];


(* ::Input::Initialization:: *)
aliBoxRast=rastFun[Graphics[aliBoxFunRaw[0,0,0],PlotRange->1]];
bobBoxRast=rastFun[Graphics[bobBoxFunRaw[0,0,0],PlotRange->1]];


(* ::Input::Initialization:: *)
aliBoxEndRast=rastFun[Graphics[aliBoxFunRaw[idxGlob,2,0],PlotRange->1]];
bobBoxEndRast=rastFun[Graphics[bobBoxFunRaw[idxGlob,2,1],PlotRange->1]];


(* ::Input::Initialization:: *)
aliBoxFixed=aliBoxFun[idxGlob,2,0];


(* ::Input::Initialization:: *)
aliTransf[t_]:=TranslationTransform[Rescale[t,{0,1},{{0,0},{-0.492,0.066}}]]@*ScalingTransform[Rescale[t,{0,1},{{1,1},{0.407,0.332}}]]
bobTransf[t_]:=TranslationTransform[Rescale[t,{0,1},{{0,0},{0.492,0.099}}]]@*ScalingTransform[Rescale[t,{0,1},{{1,1},{0.407,0.332}}]]


(* ::Input::Initialization:: *)
boxTransProtBg[bck_,trfun_][t_]:=Piecewise[{
{{},t<0.3},
{GeometricTransformation[bck,trfun[Rescale[t,{0.3,0.6},{1,0}]]],t<0.6},
{bck,True}
}]
aliBoxTransBg=Translate[boxTransProtBg[aliBgRaw,aliTransf][#],{-hoff,0}]&;
bobBoxTransBg=Translate[boxTransProtBg[bobBgRaw,bobTransf][#],{hoff,0}]&;


(* ::Input::Initialization:: *)
boxTransProtFg[img_][t_]:=Piecewise[{
{{},t<=0.5},
{insetWrap[unfadeImg[img,Rescale[t,{0.5,1},{0,1}]],2],0.5<t<0.8},
{insetWrap[img,2],True}
}]
aliBoxTransFg=Translate[boxTransProtFg[aliBoxRast][#],{-hoff,0}]&;
bobBoxTransFg=Translate[boxTransProtFg[bobBoxRast][#],{hoff,0}]&;
aliBoxTransRevFg=Translate[boxTransProtFg[aliBoxEndRast][#],{-hoff,0}]&; (*used in scene 2*)
bobBoxTransRevFg=Translate[boxTransProtFg[bobBoxEndRast][#],{hoff,0}]&; (*used in scene 2*)


(* ::Section:: *)
(*Scene*)


(* ::Input::Initialization:: *)
ClearAll[scene0]
scene0[idx_,stage_,t_,tglob_]:=Module[{fontSize=30,messFontSizeFac=1.5},
(*stage: 0 - idle state, 1 - landscape pops up, 2 - stations pop up, 3 - message pops up, 4 - waiting, 5 - message  moves, 6 - waiting, 7 - landscape blurs away, 8 - large stations and source pop up, 9 - waiting, 10 - entangled photons fly out, 11 - source fades away, 12 - waiting *)

Graphics[{
{(*landscape*)
insetWrap[Switch[stage,
0,Graphics[],
1,sceneBackground[t],
2|3|4|5|6,landBg,
7,Blur[landBg,Rescale[t,{0,1},{0,blurMax}]],
_,landBlurBg
],5]
},
{(*message*)
Switch[stage,
0|1|2,{},
3,Translate[clockLabel[idx,0,Blend[{mesCol,White},1-t],messFontSizeFac],{-hoffExt,voffQ}],
4,Translate[clockLabel[idx,t,mesCol,Rescale[t,{0,1},{messFontSizeFac,1}]],{-hoffExt,voffQ}],
5,Translate[clockBox[idx,7,1-popFun[1-t],0],{-hoffExt,voffQ}],
6,Translate[clockBox[idx,1,popFun[t],0],{-hoffExt,voffQ}],
7,Translate[clockBox[idx,2,t,0],{-hoffExt,voffQ}],
8,Translate[clockBox[idx,2,1,0],Rescale[1-popFun[1-t],{0,1},{{-hoffExt,voffQ},{-hoff,voffClock}}]],
_,Translate[clockBox[idx,2,1,0],{-hoff,voffClock}]
]
},
{(*stations*)
Switch[stage,
0|1,{},
2,{(*small stations pop up*)
aliSquareFun[t],bobSquareFun[t],aliText[{-hoffExt,voffTextS},1-t],bobText[{hoffExt,voffTextS},1-t]
},
3|4|5|6|7,{(*small stations stay static*)
aliSquareFun[1],bobSquareFun[1],aliText[{-hoffExt,voffTextS}],bobText[{hoffExt,voffTextS}]
},
8,{(*large stations pop up and small stations fade away*)
aliSquareFun[1-t],bobSquareFun[1-t],
aliBoxTransBg[t],bobBoxTransBg[t],
aliDiskFun[popFun[t]],
aliBoxTransFg[t],bobBoxTransFg[t],
aliText[lineSegFun[t,{-hoffExt,voffTextS},{-hoff,voffTextL}]],
bobText[lineSegFun[t,{hoffExt,voffTextS},{hoff,voffTextL}]]
},
_,{(*large stations stay static*)
aliBg,bobBg,
aliDiskFun[1],
aliBoxFun[idx,0,0],aliText[{-hoff,voffTextL}],
bobBoxFun[idx,0,0],bobText[{hoff,voffTextL}]
}
]
},
{(*entangled state*)
Switch[stage,
10,entIdleFun[t,tglob],
11|12,entIdleFun[1,tglob],
_,{}
]
},
{(*source*)
insetWrap[Switch[stage,
8,unfadeImg[sourceRast,t],
9|10,unfadeImg[sourceRast,1],
11,unfadeImg[sourceRast,1-popFun[t]],
_,Graphics[]
],1.3,{0,-1.35}]
}
},Sequence@@opts2D]]


(* ::Input::Initialization:: *)
mainStage[0]=serialize[scene0,12,idxGlob,Normalize[Accumulate[{0,1,1,1,0.5,1.5,1,1.5,1,1,1,1,1}],Max]];


(* ::Chapter:: *)
(*Scene 1*)


(* ::Section:: *)
(*Subroutines*)


(* ::Input::Initialization:: *)
meaBoxFun[stage_,ti_]:=Module[{t=ti,inix=0.15,iniy=-0.6,finx=0.20,finy=-1,ball=insetWrap[meaBallRast,0.3]},
(*stage: 0 - idle state, 1 - photons fly out of Alice's device, 2 - photons fade away *)
Switch[stage,
0,{},
1,{(*outgoing photons*)
Translate[ball,{
{hoff,0}+Rescale[popFun[t],{0,1},{{-inix,iniy},{-finx,finy}}],
{hoff,0}+Rescale[popFun[t],{0,1},{{inix,iniy},{finx,finy}}]
}]
},
2,{(*static measured photons*)
ball=insetWrap[unfadeImg[meaBallRast,fadFun[t]],0.3];
Translate[ball,{{hoff-finx,finy},{hoff+finx,finy}}]
}
]
]


(* ::Input::Initialization:: *)
Module[{corr={0.1,0},hoffent=.65,voffent=0.25,offset={0,0.6},t0=0.8,movef},
(*wiggling wavy line between entangled photons*)
entIdleFun[tloc_,tglob_]:=entMeasFun[tglob,entTrajFunL[tloc],entTrajFunR[tloc],entCol];

(*left entangled photon flies into Alice's device*)
movef[t_]:=Piecewise[{{-(t(t - 2t0))/t0^2/2,t<t0},{1/2,t<=1}}];
ptL1a[tloc_]:=entTrajFunL[1]+movef[tloc] offset;
ptL1b[tloc_]:=entTrajFunL[1]+(1/2+movef[tloc] ) offset;

(*left entangled photon flies to Bob's device*)
ptL2[tloc_]:=entTrajFunL[1]+tloc (entTrajFunR[1]-entTrajFunL[1])+offset;

(*both entangled photons fly into Bob's device*)
ptL3[tloc_]:=entTrajFunR[1]+tloc {hoffent,-voffent}+offset;
ptR3[tloc_]:=entTrajFunR[1]+tloc {hoffent,voffent};

entMeasFun[tglob_,ptL_,ptR_:entTrajFunR[1],col_:entColAfter]:={entWavyFun[ptL,ptR,tglob],Translate[ballFun[col],ptL],Translate[ballFun[entCol],ptR]}
]


(* ::Section:: *)
(*Scene*)


(* ::Input::Initialization:: *)
ClearAll[scene1]
scene1[idx_,stage_,t_,tglob_]:=Module[{},
(*stage: 0 - idle state, 1 - Alice chooses her device, 2 - device moves to center, 3 - waiting, 4 - photon flies into Alice's device, 5 - Alice applies her device, 6 - device retracts, 7 - photon leaves the device, 8 - devices move to center, 9 - waiting, 10 - photon flies to Bob's device, 11 - waiting, 12 - both photons fly into Bob's device, 13 - Bob measures photons, 14 - measured photons fly out of Bob's device*)
Graphics[{
{(*landscape*)
insetWrap[landBlurBg,5]
},
{(*message*)
Switch[stage,
1|2|3|4|5|6|7|8|9,Translate[clockBox[idx,2,1,0],{-hoff,voffClock}],
10,Translate[clockBox[idx,3,t,0],{-hoff,voffClock}],
_,{}
]
},
{(*colored boxes*)
aliBg,bobBg
},
{(*entangled state*)
Switch[stage,
0|1|2|3,entIdleFun[1,tglob],
4,entMeasFun[tglob,ptL1a[t],entTrajFunR[1],entCol],
5,entMeasFun[tglob,ptL1a[1],entTrajFunR[1],entCol],
6,entMeasFun[tglob,ptL1a[1]],
7,entMeasFun[tglob,ptL1b[t]],
8|9,entMeasFun[tglob,ptL1b[1]],
10,entMeasFun[tglob,ptL2[t]],
11,entMeasFun[tglob,ptL2[1]],
12, entMeasFun[tglob,ptL3[t],ptR3[t]],
_,{}
]
},
{(*stations*)
aliDiskFun[1],
Switch[stage,
0,aliBoxFun[idx,0,0],
1,aliBoxFun[idx,1,t],
2,aliBoxFun[idx,2,t],
3,aliBoxFun[idx,2,1],
4,aliBoxFun[idx,3,0],
5,aliBoxFun[idx,3,t],
6,aliBoxFun[idx,4,t],
7,aliBoxFun[idx,4,1],
8,aliBoxFun[idx,2,1-t],
_,aliBoxFixed
],
Switch[stage,
13,bobBoxFun[idx,1,t],
14,{meaBoxFun[1,t],bobBoxFun[idx,1,1]},
_,bobBoxFun[idx,0,0]
],
aliText[{-hoff,voffTextL}],bobText[{hoff,voffTextL}]
}
},Sequence@@opts2D]]


(* ::Input::Initialization:: *)
mainStage[1]=serialize[scene1,14,idxGlob,Normalize[Accumulate[{0,1,1,1,1,1,1,1,1,1,1,1,1,1,1}],Max]];


(* ::Chapter:: *)
(*Scene 2*)


(* ::Section:: *)
(*Subroutines*)


(* ::Input::Initialization:: *)
(*created with the help of ResourceFunction["EasingFunction"]:*)
jumpFun[t_]:=Piecewise[{
{-13.444t(-0.545+t),0<=t<=3/11},
{-0.063+7.799t-14.298t^2,3/11<t<65/121},
{-6.157+19.143t-14.298t^2,65/121<=t<=97/121},
{-10.704+24.814t-14.298t^2,97/121<=t<=113/121},
{-13.353+27.650t-14.298t^2,t>=113/121}
},-(11/3)t - (121/9)t^2]


(* ::Section:: *)
(*Scene*)


(* ::Input::Initialization:: *)
ClearAll[scene2]
scene2[idx_,stage_,t_,tglob_]:=Module[{finpt={hoffQ+hoff,0},fontSize=30,messFontSizeFac=1.5},
(*stage: 0 - idle state, 1 - Bob's clock appears, 2 - waiting, 3 - both devices shrink, 4 - landscape appears, 5 - clock turns into bits, 6 - bits turn into message, 7 - message jumps, 8 - waiting, 9 - everything fades away *)
Graphics[{
{(*landscape*)
insetWrap[Switch[stage,
0|1|2|3,landBlurBg,
4,Blur[landBg,Rescale[t,{0,1},{blurMax,0}]],
5|6|7|8,landBg,
9,sceneFadingBackground[t]
],5]
},
{(*Bob's qubit continuation*)
Switch[stage,
0,{},
1,Translate[clockBox[idx,3,1-t,0],{hoff,voffClock}],
2,Translate[clockBox[idx,3,0,0],{hoff,voffClock}],
3,Translate[clockBox[idx,3,0,0],Rescale[1-popFun[t],{0,1},{{hoffExt,voffQ},{hoff,voffClock}}]],
4,Translate[clockBox[idx,4,popFun[t],0],{hoffExt,voffQ}],
5,Translate[clockBox[idx,5,t,0],{hoffExt,voffQ}],
6,Translate[clockBox[idx,6,popFun[t],0],{hoffExt,voffQ}],
7,Translate[clockLabel[idx,popFun[1-t],mesCol,Rescale[1-popFun[1-t],{0,1},{1,messFontSizeFac}]],{hoffExt,voffQ}],
8,Translate[clockLabel[idx,0,mesCol,messFontSizeFac],{hoffExt,voffQ+jumpFun[t]/2}],
_,Translate[clockLabel[idx,0,Blend[{mesCol,White},t],messFontSizeFac],{hoffExt,voffQ}]
]
},
{(*stations*)
Switch[stage,
0|1,{(*static stations, photon flies through Bob's device*)
aliBg,bobBg,
aliDiskFun[1],
meaBoxFun[1,1],
aliBoxFixed,
bobBoxFun[idx,2,1],
aliText[{-hoff,voffTextL}],
bobText[{hoff,voffTextL}]
},
2,{(*waiting*)
aliBg,bobBg,
aliDiskFun[1],
meaBoxFun[1,1],
aliBoxFixed,
bobBoxFun[idx,2,1],
aliText[{-hoff,voffTextL}],bobText[{hoff,voffTextL}]
},
3,{(*stations transition from large versions to the small ones*)
aliSquareFun[t],bobSquareFun[t],
aliBoxTransBg[1-t],bobBoxTransBg[1-t],
meaBoxFun[2,1-t],
aliDiskFun[popFun[1-t]],
aliBoxTransRevFg[1-t],bobBoxTransRevFg[1-t],
aliText[lineSegFun[1-t,{-hoffExt,voffTextS},{-hoff,voffTextL}]],
bobText[lineSegFun[1-t,{hoffExt,voffTextS},{hoff,voffTextL}]]
},
4|5|6|7|8,{(*static small stations*)
aliText[{-hoffExt,voffTextS}],aliSquareFun[1],
bobText[{hoffExt,voffTextS}],bobSquareFun[1]
},
9,{(*stations fade away*)
aliText[{-hoffExt,voffTextS},t],aliSquareFun[1-popFun[t]],
bobText[{hoffExt,voffTextS},t],bobSquareFun[1-popFun[t]]
}
]
}
},Sequence@@opts2D]]


(* ::Input::Initialization:: *)
mainStage[2]=serialize[scene2,9,idxGlob,Normalize[Accumulate[{0,1,1,1,1.5,1,2,2,1,1}],Max]];


(* ::Chapter:: *)
(*Audio*)


(* ::Text:: *)
(*The code assumes that all the sound-sample files lie in subdirectory "sounds"*)


(* ::Input::Initialization:: *)
SetDirectory[NotebookDirectory[]]
SetDirectory["sounds"]


(* ::Input::Initialization:: *)
audfiles=audfileslic[[;;,1]];
{backSoundRaw,popSound,jumpSound,incSoundRaw,entSoundRaw,flySoundRaw,ringSound,garbSoundRaw,dragSoundRaw,flySoundLongRaw}=Normal@*Audio/@audfiles;


(* ::Input::Initialization:: *)
(*background music*)
Module[{tstart=.5,tend=totaldur-4,audioEnvelope},audioEnvelope[t_]:=Piecewise[{{Rescale[t,{0,tstart},{0,1}],t<tstart},{1,tstart<=t<tend},{Rescale[t,{tend,totaldur},{1,0}],tend<=t<totaldur}}];backSound=AudioGenerator[audioEnvelope,totaldur]AudioJoin[0.05{backSoundRaw,backSoundRaw,backSoundRaw}];backSound=AudioTrim[backSound,totaldur];
]


(* ::Input::Initialization:: *)
(*transitions*)
incSoundFun[dur_]:=4AudioGenerator[Rescale[#,{0,dur},{1,0}]&,dur]AudioTrim[incSoundRaw,2.5+{0,dur}]
incSound=incSoundFun[0.8];
incSound2=incSoundFun[0.5];
incSoundLong=incSoundFun[1.2];


(* ::Input::Initialization:: *)
(*entangled qubits*)
entSound=AudioTrim[3 entSoundRaw,15];


(* ::Input::Initialization:: *)
(*flight of qubits*)
flySound=AudioTrim[flySoundRaw,2];


(* ::Input::Initialization:: *)
(*long flight of qubit*)
With[{bot=2.9,up=4.4},
flySoundLong=AudioTrim[flySoundLongRaw,{bot,up}];
flySoundLong=AudioGenerator[Rescale[#,{0,up-bot},{1,0}]&,up-bot] flySoundLong;
]


(* ::Input::Initialization:: *)
(*flight of measured qubits*)
garbSound=AudioTrim[garbSoundRaw,{6,6.5}];
garbSound=0.3AudioTimeStretch[garbSound,2];


(* ::Input::Initialization:: *)
(*moving of Alice's device*)
dragSound=3AudioTrim[0.3dragSoundRaw,1];


(* ::Input::Initialization:: *)
(*soundtrack*)
aud=AudioOverlay[{
(*background*)
{backSound,0},

(*landscape appears*)
{popSound,0.1},{popSound,0.3},{popSound,0.5},{popSound,0.7},{popSound,1},

(*message appears*)
{incSound,3},

(*stations enlarge*)
{incSoundLong,10.8},{incSound2,11.5},

(*entangled qubits*)
{entSound,13.5},

(*Alice chooses her device and qubit flies through it*)
{dragSound,19},{flySound,20.2},{dragSound,21.5},{ringSound,22},{dragSound,22.1},{flySound,23},{dragSound,23.8},

(*qubit flies from Alice to Bob*)
{flySoundLong,25.7},

(*both qubits fly into Bob's device, which rings and spits out the qubits*)
{flySound,27.1},{ringSound,28.1},{garbSound,29.5},

(*stations shrink*)
{AudioReverse@incSoundLong,31.5},

(*message reappears and jumps*)
{incSound,36.5},{jumpSound,38.1}
}];


(* ::Chapter:: *)
(*Composition and export*)


(* ::Section:: *)
(*Video*)


(* ::Input::Initialization:: *)
sceneAll[t_]:=Module[{q,r,t0=0.45,t1=0.75},
{q,r}=Which[
t<t0,{0,Rescale[t,{0,t0},{0,1}]},
t<t1,{1,Rescale[t,{t0,t1},{0,1}]},
True,{2,Rescale[t,{t1,1},{0,1}]}
];
mainStage[q][r,5(*3*)t]
]


(* ::Input:: *)
(*Manipulate[sceneAll[t],{t,0,1}]*)


(* ::Input::Initialization:: *)
frameVideo[inumframes_]:=Module[{anim,numframes,time,frames},
numframes=Floor[inumframes/totaldur]totaldur;
Print["Actual number of frames: ",numframes];
{time,frames}=AbsoluteTiming[Most@ParallelTable[Rasterize[sceneAll[t]],{t,0,1,1/numframes}]];
Print["Generation of frames took ",time," seconds."];
anim=Video@AnimatedImage[frames,FrameRate->numframes/totaldur];
anim
]


(* ::Input:: *)
(*(*may take some time...*)*)
(*AbsoluteTiming[vid=Parallelize@VideoGenerator[sceneAll[#/totaldur]&,totaldur,RasterSize->2500];]*)


(* ::Input:: *)
(*(*--- alternative that does not take that long: ---*)*)
(*(*anim=frameVideo[500]*)*)


(* ::Section:: *)
(*Combine with audio and export*)


(* ::Input:: *)
(*vidaud=VideoCombine[{vid,aud}];*)


(* ::Input:: *)
(*SetDirectory[NotebookDirectory[]]*)
(*Export["video_dense_coding.ogg",vidaud]*)

Historie souboru

Kliknutím na datum a čas se zobrazí tehdejší verze souboru.

Datum a časNáhledRozměryUživatelKomentář
současná15. 2. 2023, 16:4240 s, 2 500 × 1 250 (12,25 MB)JozumBjada (diskuse | příspěvky)Uploaded while editing "Wikipedista:JozumBjada/Pískoviště" on cs.wikipedia.org

Na tento soubor neodkazuje na Commons žádná stránka.

Stav transkódování

Aktualizovat stav transkódování
Formát Přenosová rychlost Stáhnout Stav Čas kódování
VP9 1080P Nepřipraveno Chyba v 15. 2. 2023, 16:42
Streaming 1080p (VP9) Nepřipraveno Neznámý stav
VP9 720P Nepřipraveno Chyba v 15. 2. 2023, 16:42
Streaming 720p (VP9) Nepřipraveno Neznámý stav
VP9 480P 201 kbps Dokončeno v 15. 2. 2023, 16:42 33 s
Streaming 480p (VP9) Nepřipraveno Neznámý stav
VP9 360P 172 kbps Dokončeno v 15. 2. 2023, 16:42 23 s
Streaming 360p (VP9) Nepřipraveno Neznámý stav
VP9 240P 155 kbps Dokončeno v 15. 2. 2023, 16:42 21 s
Streaming 240p (VP9) 33 kbps Dokončeno v 21. 12. 2023, 21:41 1,0 s
WebM 360P 247 kbps Dokončeno v 15. 2. 2023, 16:42 23 s
Streaming 144p (MJPEG) 918 kbps Dokončeno v 13. 11. 2023, 13:23 3,0 s
Stereo (Opus) 123 kbps Dokončeno v 11. 11. 2023, 12:10 2,0 s
Stereo (MP3) 128 kbps Dokončeno v 11. 11. 2023, 12:20 1,0 s

Globální využití souboru

Tento soubor využívají následující wiki:

Metadata