Skip to content

Instantly share code, notes, and snippets.

@agrahn
Last active August 29, 2017 10:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save agrahn/bb6e6c6911f8cb919a64d9b7ba3daf59 to your computer and use it in GitHub Desktop.
Save agrahn/bb6e6c6911f8cb919a64d9b7ba3daf59 to your computer and use it in GitHub Desktop.
[obsolete¹] Replacement for Powerdot clock. (1) as of Powerdot-1.5c, 2017-08-28
% Copyright 2017--today Alexander Grahn
%
% This material is subject to the LaTeX Project Public License. See
% http://mirrors.ctan.org/help/Catalogue/licenses.lppl.html
% for the details of that license.
%
% This work has the LPPL maintenance status "maintained".
\NeedsTeXFormat{LaTeX2e}
\def\@pdclock@version{2017/08/18}
\ProvidesPackage{pdclock}
[\@pdclock@version\space replacement for Powerdot clock]
\RequirePackage{pdfbase}
\ExplSyntaxOn
\let\pd@PdfAnnot\pbs_pdfannot:nnnn\let\pd@PdfLastAnn\pbs_pdflastann:
\let\pd@AppendToFields\pbs_appendtofields:n
\ExplSyntaxOff
\newcount\pd@clockcnt
\def\pd@startclock#1#2{%
function pdshowtime(){%
var pdtime=new Date();%
this.getField("pdclock.\the\pd@clockcnt").value=util.printd("#1",pdtime);%
this.dirty=false;%
}%
pdshowtime();%
var pdclock_\the\pd@clockcnt=app.setInterval("pdshowtime()",#2);%
}%
\let\pdclock@pdftrans\pd@pdftrans
\def\pd@pdftrans{%
\def\pd@tempa##1,##2,##3\@nil{##1 ##2 ##3}%
\extractcolorspec\pd@@clockcolor\pd@tempb
\expandafter\convertcolorspec\pd@tempb{rgb}\pd@tempb
\edef\pd@tempa{\expandafter\pd@tempa\pd@tempb\@nil}%
\ifx\pd@@clockpos\@empty\else
\@tempdima=\pd@@clockcharsize
\rput[\pd@@clockhook](\pd@@clockpos){%
\makebox[\pd@@clockwidth][l]{\rule{0pt}{\pd@@clockheight}%
\pd@PdfAnnot{\pd@@clockwidth}{\pd@@clockheight}{0pt}{%
/Subtype/Widget/FT/Tx/T (pdclock.\the\pd@clockcnt) /Ff 1
/DA (/Helv \strip@pt\@tempdima\space Tf \pd@tempa\space rg)
/MK<</R \ifnum\pd@orient=\z@ 90\else 0\fi /BG []/BC []>>
/Q \pd@@clockalign\space
/AA <<
/PO << /S/JavaScript/JS(\pd@startclock\pd@@clockformat\pd@@clockrefresh) >>
/PC << /S/JavaScript/JS(app.clearInterval(pdclock_\the\pd@clockcnt);) >>
>>
}%
}%
\pd@AppendToFields{\pd@PdfLastAnn}%
\global\advance\pd@clockcnt by \@ne%
}%
\fi
\pdclock@pdftrans%
}
\endinput
%%
%% End of file `pdclock.sty'.
@agrahn
Copy link
Author

agrahn commented Aug 17, 2017

Use package pdclock as follows:

\documentclass{powerdot} %don't use option `clock'

%this enables the new clock
\usepackage{pdclock}

%set up clock appearance as usual
\pdsetup{
  clockrefresh=60000,
  clockformat=h:MM tt
}

\usepackage{animate}

\begin{document}
\begin{slide}{Animation}

\begin{center}
  \begin{animateinline}[loop,autoplay]{1}
    \multiframe{10}{i=0+1}{\fbox{\Huge\i}}
  \end{animateinline}
\end{center}
  
\end{slide}

\begin{slide}{A dumb slide}

\end{slide}

\end{document}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment