-
Notifications
You must be signed in to change notification settings - Fork 0
/
tikzvid.sty
25 lines (21 loc) · 1.03 KB
/
tikzvid.sty
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
\ProvidesPackage{tikzvid}
\newwrite\tikzvidfile
\begingroup\lccode`!=`\\\lowercase{\endgroup\def\@backslashchar{!}}
% \tikzvidtarget{myid}
\newcommand{\tikzvidtarget}[1] {run:\jobname-#1.tikzvid-sh}
\newcommand{\tikzvidtargetboth}[3] {
\openout\tikzvidfile=\jobname-#1.tikzvid-sh
\write\tikzvidfile{pwd}
\write\tikzvidfile{sh `dirname $0`/\jobname-#2.tikzvid-sh &}
\write\tikzvidfile{sh `dirname $0`/\jobname-#3.tikzvid-sh &}
\closeout\tikzvidfile
}
% \tikzvidplayat{myid}{mynode}{relative/path/to/movie.mp4}{args}
\newcommand{\tikzvidplayat}[4] {
\openout\tikzvidfile=\jobname-#1.tikzvid-sh
\write\tikzvidfile{python `dirname $0`/play.py \@backslashchar}
\node[inner sep=0pt] at (#2.north east) {\pdfsavepos\write\tikzvidfile{ --ne-x=\the\pdflastxpos \space --ne-y=\the\pdflastypos \space \@backslashchar}};
\node[inner sep=0pt] at (#2.south west) {\pdfsavepos\write\tikzvidfile{ --sw-x=\the\pdflastxpos \space --sw-y=\the\pdflastypos \space \@backslashchar}};
\write\tikzvidfile{ --video=#3 #4}
\closeout\tikzvidfile
}