From ba3d555da29f2da7ca04bf225218e22c8d12d7f8 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Sun, 18 Jul 2021 03:00:52 +0000 Subject: CTAN sync 202107180300 --- graphics/pgf/contrib/easing/README | 18 + graphics/pgf/contrib/easing/easing.dtx | 1073 ++++++++++++++++++++++++++++++++ graphics/pgf/contrib/easing/easing.ins | 44 ++ graphics/pgf/contrib/easing/easing.pdf | Bin 0 -> 313369 bytes 4 files changed, 1135 insertions(+) create mode 100644 graphics/pgf/contrib/easing/README create mode 100644 graphics/pgf/contrib/easing/easing.dtx create mode 100644 graphics/pgf/contrib/easing/easing.ins create mode 100644 graphics/pgf/contrib/easing/easing.pdf (limited to 'graphics/pgf') diff --git a/graphics/pgf/contrib/easing/README b/graphics/pgf/contrib/easing/README new file mode 100644 index 0000000000..77ce821189 --- /dev/null +++ b/graphics/pgf/contrib/easing/README @@ -0,0 +1,18 @@ +easing -- easing functions for pgfmath + +DESCRIPTION + +This library implements a collection of easing functions, and adds +them to the PGF mathematical engine. + +Works with TeX and LaTeX. The latest version (0.1) of this package was +tested with PGF version 3.19a. + +LICENSE + +This material is subject to the LaTeX Project Public License version +1.3 or later. + +CHANGELOG + +0.1 2021/07/18 - initial release. diff --git a/graphics/pgf/contrib/easing/easing.dtx b/graphics/pgf/contrib/easing/easing.dtx new file mode 100644 index 0000000000..cca229ae57 --- /dev/null +++ b/graphics/pgf/contrib/easing/easing.dtx @@ -0,0 +1,1073 @@ +% \iffalse meta-comment +% +% Copyright (C) 2021 Lo̍h Ka-tsùn +% +% This file may be distributed and/or modified under the conditions of +% the LaTeX Project Public License, either version 1.3 of this license +% or (at your option) any later version. The latest version of this +% license is in: +% +% http://www.latex-project.org/lppl.txt +% +% and version 1.3 or later is part of all distributions of LaTeX version +% 2005/12/01 or later. +% +% \fi +% \iffalse +%<*driver> +\documentclass{ltxdoc} +\usepackage{parskip} +\usepackage{pgfplots} +\usepgflibrary{easing} +% \usepackage{hyperref} +\newcommand{\pgf}{\textsc{pgf}} +\EnableCrossrefs +\CodelineIndex +\RecordChanges +\CheckSum{594} +\changes{0.1}{2021/07/18}{Initial version} +\begin{document} +\DocInput{easing.dtx} +\end{document} +% +% \fi +% ^^A for drawing nice little graphs of the functions. pgfplots is +% ^^A probably overkill for this, so here's some ad-hoc TikZ-ing; +% ^^A hopefully to be tidied up substantially in a future version: +% +% \def\graphmargindefaulty{0.16} +% \def\graphmarginx{0.12} +% \edef\graphmarginy{\graphmargindefaulty} +% \newenvironment{easinggraph}{% +% \begin{tikzpicture}[x=2.8cm,y=2.8cm] +% \fill[white!97!black, use as bounding box] +% (-\graphmarginx,-\graphmarginy) rectangle +% ({1+\graphmarginx},{1+\graphmarginy}); +% \draw[white!60!black] +% ({1+\graphmarginx},0) -- (-\graphmarginx,0) node[left] {$0$} +% ({1+\graphmarginx},1) -- (-\graphmarginx,1) node[left] {$1$}; +% \draw[white!60!black,dashed] +% (0,1) -- (0,-\graphmarginy) node[below] {$a$} +% (1,1) -- (1,-\graphmarginy) node[below] {$b$}; +% }{\end{tikzpicture}} +% \newcommand{\easinggraphplot}[2]{% +% \pgfmathparse{#2} +% \draw[white!\pgfmathresult!black,thick] +% (-\graphmarginx,0) -- (0,0) +% \foreach\x in{0,0.01,...,1}{--(\x,{#1(0,1,\x)})} +% -- (1,1) -- ({1+\graphmarginx},1); +% } +% \newcommand{\easinggraphplotfive}[4]{% +% \easinggraphlabel{#1\easingtype}{ +% \foreach[count=\countv]\paramv +% in{#4}{\pgfmathparse{ +% 18*(5-\countv)}{\color{ +% white!\pgfmathresult!black}\ifnum\countv=1\relax +% #3=\else,\fi\paramv}}} +% \foreach[count=\countv]\paramv in{#4}{% +% \pgfkeys{/easing/#1/#2=\paramv} +% \easinggraphplot{#1\easingtype}{18*(5-\countv)} +% } +% } +% \newcommand{\easinggraphlabel}[2]{% +% \node[anchor=text] at (-\graphmarginx,{1+\graphmarginy}) +% {\footnotesize\tt\raisebox{\baselineskip}{\parbox{3.5cm}{#1\\[-0.4ex]#2}}}; +% } +% \newcommand{\foreachtypeeasinggraph}[1]{% +% \vspace{2\baselineskip} +% \foreach[count=\easingtypen]\easingtype in{easein,step,easeout}{% +% \ifnum\easingtypen>1\hspace{\fill}\fi +% \begin{easinggraph}#1\end{easinggraph} +% } +% \vspace{\baselineskip} +% } +% +% ^^A for printing code listings. again, there's probably a "proper" +% ^^A way to do this, but this is good enough i guess +% +% \newenvironment{fakelisting}{ +% \begingroup\parskip 0pt\par\hrulefill}{ +% \vspace{-1.3\baselineskip}\hrulefill\endgroup +% \vspace{\parskip}} +% +% ^^A body of documentation proper begins here. +% +% \title{The \textsf{easing}\thanks{version 0.1, dated +% 2021/07/18. This version was tested with \pgf{} version 3.1.9a} +% \ Library for \pgf} +% +% \author{Loh Ka-tsun\thanks{\texttt{loh.ka.tsun@gmail.com}}} +% \date{} +% \maketitle +% +% \thispagestyle{empty} +% \vspace{-2em} +% \begin{center} +% \begin{easinggraph} +% \easinggraphplot{smootherstep}{46} +% \easinggraphplot{smoothstep}{0} +% \end{easinggraph} +% \end{center} +% +% \tableofcontents\pagebreak +% +% \section{Introduction} +% This library adds easing functions to the \pgf{} mathematical engine. +% +% \section{Installation} +% +% The \textsf{easing} library is a \pgf{} library; it works both with +% \LaTeX{} and with plain \TeX{}. Once the file +% |pgflibraryeasing.code.tex| is in a directory searched by \TeX, the +% library can be loaded as follows: +% +% with plain \TeX: +% \begin{fakelisting}\begin{verbatim} +% \input pgf +% \usepgflibrary{easing} +% \end{verbatim}\end{fakelisting} +% +% with \LaTeX: +% \begin{fakelisting}\begin{verbatim} +% \usepackage{pgf} +% \usepgflibrary{easing} +% \end{verbatim}\end{fakelisting} +% +% The \textsf{easing} library is compatible with, but does not depend +% on, the floating point unit library provided by \pgf{}. To use both +% \textsf{easing} and the FPU, the FPU (or any packages/libraries +% which use the FPU, such as \textsf{pgfplots}) must be loaded +% before the \textsf{easing} library. +% +% \section{Usage} +% +% The routines implemented by the \textsf{easing} library are added to +% \pgf{}'s mathematical engine with |\pgfmathdeclarefunction|, so that +% they are recognised by by |\pgfmathparse| and can be used in any +% expression which is processed by the parser. +% As a first example, the following code produces plots of the +% function |smoothstep(|$a$|,|$b$|,|$x$|)| against the argument $x$, +% with one endpoint $a=0$ and the other endpoint $b$ ranging through +% the integers $-1$ to $3$: +% +% \vspace{\parskip} +% \hspace{-0.05\textwidth} +% \begin{minipage}[h]{0.55\textwidth} +% \tikzpicture +% \axis[ +% width=\textwidth, ^^A we lie a little and omit this from the source listing +% domain=-1.2:3.2, samples=64, +% xmin=-1.2, xmax=3.2, +% cycle list={[samples of colormap=6 of viridis]}, +% no marks, thick] +% \pgfplotsinvokeforeach{-1,...,3}{\addplot{smoothstep(0,#1,x)};} +% \endaxis +% \endtikzpicture +% \end{minipage}% +% \begin{minipage}[h]{0.5\textwidth} +% \begin{fakelisting}\begin{verbatim} +% \input pgfplots +% \usepgflibrary{easing} +% \tikzpicture +% \axis[ +% domain=-1.2:3.2, samples=64, +% xmin=-1.2, xmax=3.2, +% cycle list={ +% [samples of colormap=6 of viridis]}, +% no marks, thick] +% \pgfplotsinvokeforeach{-1,...,3}{ +% \addplot{smoothstep(0,#1,x)};} +% \endaxis +% \endtikzpicture +% \end +% \end{verbatim}\end{fakelisting} +% \end{minipage} +% \vspace{\parskip} +% +% (This example also demonstrates the behaviour of the easing +% functions in some special cases: when the endpoints $b\le a$, and in +% particular the degenerate case where $a=b$, in which the library +% chooses to consider the function that is $1$ for all $x\ge 0$ and +% $0$ otherwise.) +% +% Like all functions declared in this way, the functions implemented +% by \textsf{easing} are also available as ``public'' macros, such as +% |\pgfmathsmoothstep|: +% +% \vspace{\parskip} +% \begin{minipage}[h]{0.5\textwidth} +% \foreach\x in{0,0.25,...,1}{ +% \pgfmathsmoothstep{0}{1}{\x} +% $S_1(\x)=\pgfmathresult$\par +% } +% \end{minipage}% +% \begin{minipage}[h]{0.5\textwidth} +% \begin{fakelisting}\begin{verbatim} +% \input pgf +% \usepgflibrary{easing} +% \foreach\x in{0,0.25,...,1}{ +% \pgfmathsmoothstep{0}{1}{\x} +% $S_1(\x)=\pgfmathresult$\par +% } +% \end +% \end{verbatim}\end{fakelisting} +% \end{minipage} +% \vspace{\parskip} +% +% See Part VIII of the \pgf{} manual for more details on the +% mathematical engine. +% +% \subsection{Naming conventions} +% +% For each shape, three functions are declared, all of which take +% three arguments $a,b$, and $x$. Where $a0.5$. For $0\pgf@x\pgf@x 0pt\fi + \pgfmathreturn\pgf@x + \endgroup +}% +\expandafter\def +\csname easing@linearstep\ifeasing@withfpu @fixed\fi\endcsname#1#2#3{% + \begingroup + \pgf@xa#3pt + \pgf@xb#2pt + \pgf@xc#1pt + \ifdim\pgf@xb=\pgf@xc + \edef\pgfmathresult{\ifdim\pgf@xa>\pgf@xb 1\else 0\fi}% + \else + \advance\pgf@xa-\pgf@xc + \advance\pgf@xb-\pgf@xc + \easing@divide{\pgfmath@tonumber\pgf@xa}{\pgfmath@tonumber\pgf@xb}% + \easing@linearstep@ne\pgfmathresult + \fi + \pgfmathsmuggle\pgfmathresult + \endgroup +}% +\ifeasing@withfpu +\def\easing@linearstep@float#1#2#3{% + \begingroup + \pgfmathfloatsubtract{#3}{#1}% + \edef\pgf@tempa{\pgfmathresult}% + \pgfmathfloatsubtract{#2}{#1}% + \edef\pgf@tempb{\pgfmathresult}% + \pgfmathfloatifflags{\pgf@tempb}{0}{% + \pgfmathfloatifflags{\pgf@tempa}{-}{% + \edef\pgfmathresult{0}% + }{% + \edef\pgfmathresult{1}% + }% + }{% + \pgfmathfloatdivide\pgf@tempa\pgf@tempb + \pgfmathfloattofixed{\pgfmathresult}% + \easing@linearstep@ne\pgfmathresult + }% + \pgfmathsmuggle\pgfmathresult + \endgroup +}% +\def\easing@linearstep#1#2#3{% + \pgflibraryfpuifactive{% + \easing@linearstep@float{#1}{#2}{#3}}{% + \easing@linearstep@fixed{#1}{#2}{#3}}% +}% +\fi +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\easing@linearstep@easein@ne} +% \begin{macro}{\easing@linearstep@easeout@ne} +% +% The linear ease-in and ease-out functions are identical to the +% linear step function. We define the respective macros so as not to +% surprise the user with their absence. +% +% \begin{macrocode} +\let\easing@lineareasein\easing@linearstep +\pgfmathdeclarefunction{lineareasein}{3}{% + \easing@lineareasein{#1}{#2}{#3}}% +\let\easing@lineareaseout\easing@linearstep +\pgfmathdeclarefunction{lineareaseout}{3}{% + \easing@lineareasein{#1}{#2}{#3}}% +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% ^^A the next few macros have long names, so we scoot this page to +% ^^A the right to make space in the margins: +% +% \begingroup +% \addtolength\oddsidemargin{50pt} +% \addtolength\evensidemargin{50pt} +% +% \begin{macro}{\easing@derive@easein@nefromstep@ne} +% \begin{macro}{\easing@derive@easeout@nefromstep@ne} +% \begin{macro}{\easing@derive@step@nefromeasein@ne} +% \begin{macro}{\easing@derive@easeout@nefromeasein@ne} +% +% The pattern in general is that, for each shape, we define the +% one-parameter version of the step, ease-in, and ease-out routines +% interpolating between values $0$ at $1$ at the ends of the unit +% interval. Then by composing with |\easing@linearstep|, we obtain the +% three-parameter versions that allow the user to specify the begin +% and end points of the interpolation. +% +% Most of the time it suffices to define just one of the three +% one-parameter versions of a shape to be able to infer the form of +% all three. This is done with the |\easing@derive|--|from|-- macros. +% +% \begin{macrocode} +\def\easing@derive@easein@nefromstep@ne#1{% + \expandafter\def\csname easing@#1easein@ne\endcsname##1{% + \begingroup + \pgf@x##1 pt + \divide\pgf@x 2 + \csname easing@#1step@ne\endcsname{\pgfmath@tonumber\pgf@x}% + \pgf@x\pgfmathresult pt + \multiply\pgf@x 2 + \pgfmathreturn\pgf@x + \endgroup + }% +}% +\def\easing@derive@easeout@nefromstep@ne#1{% + \expandafter\def\csname easing@#1easeout@ne\endcsname##1{% + \begingroup + \pgf@x##1 pt + \divide\pgf@x 2 + \advance\pgf@x 0.5pt + \csname easing@#1step@ne\endcsname{\pgfmath@tonumber\pgf@x}% + \pgf@x\pgfmathresult pt + \multiply\pgf@x 2 + \advance\pgf@x -1pt + \pgfmathreturn\pgf@x + \endgroup + }% +}% +\def\easing@derive@step@nefromeasein@ne#1{% + \expandafter\def\csname easing@#1step@ne\endcsname##1{% + \begingroup + \pgf@x##1 pt + \multiply\pgf@x 2 + \ifdim\pgf@x<1pt + \csname easing@#1easein@ne\endcsname{\pgfmath@tonumber\pgf@x}% + \pgf@x\pgfmathresult pt + \divide\pgf@x 2 + \else + \multiply\pgf@x -1 + \advance\pgf@x 2pt + \csname easing@#1easein@ne\endcsname{\pgfmath@tonumber\pgf@x}% + \pgf@x\pgfmathresult pt + \divide\pgf@x 2 + \multiply\pgf@x -1 + \advance\pgf@x 1pt + \fi + \pgfmathreturn\pgf@x + \endgroup + }% +}% +\def\easing@derive@easeout@nefromeasein@ne#1{% + \expandafter\def\csname easing@#1easeout@ne\endcsname##1{% + \begingroup + \pgf@x##1pt + \multiply\pgf@x -1 + \advance\pgf@x 1pt + \csname easing@#1easein@ne\endcsname{\pgfmath@tonumber\pgf@x}% + \pgf@x\pgfmathresult pt + \multiply\pgf@x -1 + \advance\pgf@x 1pt + \pgfmathreturn\pgf@x + \endgroup + }% +}% +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \endgroup ^^A marginpar modifications +% +% \begin{macro}{\easing@pgfmathinstall} +% +% The three-parameter versions of each routine is installed +% into the mathematical engine, so that they are available in +% |\pgfmathparse|. +% +% \begin{macrocode} +\def\easing@pgfmathinstall#1{% + \pgfmathdeclarefunction{#1step}{3}{% + \easing@linearstep{##1}{##2}{##3}% + \csname easing@#1step@ne\endcsname\pgfmathresult + }% + \pgfmathdeclarefunction{#1easein}{3}{% + \easing@linearstep{##1}{##2}{##3}% + \csname easing@#1easein@ne\endcsname\pgfmathresult + }% + \pgfmathdeclarefunction{#1easeout}{3}{% + \easing@linearstep{##1}{##2}{##3}% + \csname easing@#1easeout@ne\endcsname\pgfmathresult + }% +}% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\easing@smoothstep@ne} +% \begin{macro}{\easing@smootheasein@ne} +% \begin{macro}{\easing@smootheaseout@ne} +% +% The |smooth| shape. +% +% \begin{macrocode} +\def\easing@smoothstep@ne#1{% + \begingroup + \pgf@x#1pt + \edef\pgf@temp{\pgfmath@tonumber\pgf@x}% + \multiply\pgf@x-2 + \advance\pgf@x 3pt + \pgf@x\pgf@temp\pgf@x + \pgf@x\pgf@temp\pgf@x + \pgfmathreturn\pgf@x + \endgroup +}% +\easing@derive@easein@nefromstep@ne{smooth}% +\easing@derive@easeout@nefromstep@ne{smooth}% +\easing@pgfmathinstall{smooth}% +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\easing@smootherstep@ne} +% \begin{macro}{\easing@smoothereasein@ne} +% \begin{macro}{\easing@smoothereaseout@ne} +% +% The |smoother| shape. +% +% \begin{macrocode} +\def\easing@smootherstep@ne#1{% + \begingroup + \pgf@x#1pt + \edef\pgf@temp{\pgfmath@tonumber\pgf@x}% + \multiply\pgf@x 6 + \advance\pgf@x -15pt + \pgf@x\pgf@temp\pgf@x + \advance\pgf@x 10pt + \pgf@x\pgf@temp\pgf@x + \pgf@x\pgf@temp\pgf@x + \pgf@x\pgf@temp\pgf@x + \pgfmathreturn\pgf@x + \endgroup +}% +\easing@derive@easein@nefromstep@ne{smoother}% +\easing@derive@easeout@nefromstep@ne{smoother}% +\easing@pgfmathinstall{smoother}% +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\easing@powstep@ne} +% \begin{macro}{\easing@poweasein@ne} +% \begin{macro}{\easing@poweaseout@ne} +% +% The |pow| shape. +% +% Because of some wonkiness in the FPU, |\pgfmath@pow@basic@| actually +% doesn't work. Instead of invoking the |pow| function, we compute +% $t^n$ approximately by computing $e^{n\ln t}$ using |ln| and |exp| +% instead (which is what |pgfmath| does anyway when the exponent is +% not an integer.) +% +% \begin{macrocode} +\pgfkeys{/easing/.is family}% +\pgfkeys{easing, + pow/exponent/.estore in=\easing@param@pow@exponent, + pow/exponent/.default=2.4, + pow/exponent}% +\def\easing@poweasein@ne#1{% + \begingroup + \pgf@x#1pt + \ifdim\pgf@x=0pt + \edef\pgfmathresult{0}% + \else + \easing@ln{#1}% + \pgf@x\pgfmathresult pt + \pgf@x\easing@param@pow@exponent\pgf@x + \easing@exp{\pgfmath@tonumber\pgf@x}% + \fi + \pgfmathsmuggle\pgfmathresult + \endgroup +}% +\easing@derive@easeout@nefromeasein@ne{pow}% +\easing@derive@step@nefromeasein@ne{pow}% +\easing@pgfmathinstall{pow}% +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\easing@quadstep@ne} +% \begin{macro}{\easing@quadeasein@ne} +% \begin{macro}{\easing@quadeaseout@ne} +% +% \begin{macro}{\easing@cubicstep@ne} +% \begin{macro}{\easing@cubiceasein@ne} +% \begin{macro}{\easing@cubiceaseout@ne} +% +% \begin{macro}{\easing@quartstep@ne} +% \begin{macro}{\easing@quarteasein@ne} +% \begin{macro}{\easing@quarteaseout@ne} +% +% \begin{macro}{\easing@quintstep@ne} +% \begin{macro}{\easing@quinteasein@ne} +% \begin{macro}{\easing@quinteaseout@ne} +% +% The |quad|--, |cubic|--, |quart|--, and |quint|-- routines have +% explicit definitions. +% +% \begin{macrocode} +\def\easing@quadeasein@ne#1{% + \begingroup + \pgf@x#1pt + \edef\pgf@temp{\pgfmath@tonumber\pgf@x}% + \pgf@x\pgf@temp\pgf@x + \pgfmathreturn\pgf@x + \endgroup +}% +\easing@derive@step@nefromeasein@ne{quad}% +\easing@derive@easeout@nefromeasein@ne{quad}% +\easing@pgfmathinstall{quad}% +% +\def\easing@cubiceasein@ne#1{% + \begingroup + \pgf@x#1pt + \edef\pgf@temp{\pgfmath@tonumber\pgf@x}% + \pgf@x\pgf@temp\pgf@x + \pgf@x\pgf@temp\pgf@x + \pgfmathreturn\pgf@x + \endgroup +}% +\easing@derive@step@nefromeasein@ne{cubic}% +\easing@derive@easeout@nefromeasein@ne{cubic}% +\easing@pgfmathinstall{cubic}% +% +\def\easing@quarteasein@ne#1{% + \begingroup + \pgf@x#1pt + \edef\pgf@temp{\pgfmath@tonumber\pgf@x}% + \pgf@x\pgf@temp\pgf@x + \pgf@x\pgf@temp\pgf@x + \pgf@x\pgf@temp\pgf@x + \pgfmathreturn\pgf@x + \endgroup +}% +\easing@derive@step@nefromeasein@ne{quart}% +\easing@derive@easeout@nefromeasein@ne{quart}% +\easing@pgfmathinstall{quart}% +% +\def\easing@quinteasein@ne#1{% + \begingroup + \pgf@x#1pt + \edef\pgf@temp{\pgfmath@tonumber\pgf@x}% + \pgf@x\pgf@temp\pgf@x + \pgf@x\pgf@temp\pgf@x + \pgf@x\pgf@temp\pgf@x + \pgf@x\pgf@temp\pgf@x + \pgfmathreturn\pgf@x + \endgroup +}% +\easing@derive@step@nefromeasein@ne{quint}% +\easing@derive@easeout@nefromeasein@ne{quint}% +\easing@pgfmathinstall{quint}% +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \end{macro} +% \end{macro} +% \end{macro} +% +% \end{macro} +% \end{macro} +% \end{macro} +% +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\easing@backstep@ne} +% \begin{macro}{\easing@backeasein@ne} +% \begin{macro}{\easing@backeaseout@ne} +% +% The |back| shape. +% +% \begin{macrocode} +\pgfkeys{easing, + back/overshoot/.estore in=\easing@param@back@overshoot, + back/overshoot/.default=1.6, + back/overshoot}% +\def\easing@backeasein@ne#1{% + \begingroup + \pgf@x#1pt + \edef\pgf@temp{\pgfmath@tonumber\pgf@x}% + \advance\pgf@x -1pt + \pgf@x\easing@param@back@overshoot\pgf@x + \advance\pgf@x\pgf@temp pt + \pgf@x\pgf@temp\pgf@x + \pgf@x\pgf@temp\pgf@x + \pgfmathreturn\pgf@x + \endgroup +}% +\easing@derive@step@nefromeasein@ne{back}% +\easing@derive@easeout@nefromeasein@ne{back}% +\easing@pgfmathinstall{back}% +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\easing@sinestep@ne} +% \begin{macro}{\easing@sineeasein@ne} +% \begin{macro}{\easing@sineeaseout@ne} +% +% The |sine| shape. +% +% We write down both the |easein| and |step| forms of this, since they +% are simple compared to what would have been obtained by +% |\easing@derive|--. +% +% \begin{macrocode} +\def\easing@sineeasein@ne#1{% + \begingroup + \pgf@x#1pt + \multiply\pgf@x 90 + \easing@cos{\pgfmath@tonumber\pgf@x}% + \pgf@x\pgfmathresult pt + \multiply\pgf@x -1 + \advance\pgf@x 1pt + \pgfmathreturn\pgf@x + \endgroup +}% +\def\easing@sinestep@ne#1{% + \begingroup + \pgf@x#1pt + \multiply\pgf@x 180 + \easing@cos{\pgfmath@tonumber\pgf@x}% + \pgf@x\pgfmathresult pt + \divide\pgf@x 2 + \multiply\pgf@x -1 + \advance\pgf@x 0.5pt + \pgfmathreturn\pgf@x + \endgroup +}% +\easing@derive@easeout@nefromeasein@ne{sine}% +\easing@pgfmathinstall{sine}% +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\easing@expstep@ne} +% \begin{macro}{\easing@expeasein@ne} +% \begin{macro}{\easing@expeaseout@ne} +% +% The |exp| shape. +% +% \begin{macrocode} +\pgfkeys{easing, + exp/speed/.estore in=\easing@param@exponent@speed, + exp/speed/.default=7.2, + exp/speed}% +\def\easing@expeasein@ne#1{% + \begingroup + \pgf@x#1pt + \advance\pgf@x -1pt + \pgf@x\easing@param@exponent@speed\pgf@x + \easing@exp{\pgfmath@tonumber\pgf@x}% + \pgfmathsmuggle\pgfmathresult + \endgroup +}% +\easing@derive@step@nefromeasein@ne{exp}% +\easing@derive@easeout@nefromeasein@ne{exp}% +\easing@pgfmathinstall{exp}% +% \end{macrocode} +% +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\easing@circstep@ne} +% \begin{macro}{\easing@circeasein@ne} +% \begin{macro}{\easing@circeaseout@ne} +% +% The |circ| shape. +% +% \begin{macrocode} +\def\easing@circeasein@ne#1{% + \begingroup + \pgf@x#1pt + \advance\pgf@x -1pt + \edef\pgf@temp{\pgfmath@tonumber\pgf@x}% + \pgf@x\pgf@temp\pgf@x + \multiply\pgf@x -1 + \advance\pgf@x 1pt + \easing@sqrt{\pgfmath@tonumber\pgf@x}% + \pgfmathsmuggle\pgfmathresult + \endgroup +}% +\easing@derive@step@nefromeasein@ne{circ}% +\easing@derive@easeout@nefromeasein@ne{circ}% +\easing@pgfmathinstall{circ}% +% \end{macrocode} +% +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\easing@elasticstep@ne} +% \begin{macro}{\easing@elasticeasein@ne} +% \begin{macro}{\easing@elasticeaseout@ne} +% +% The |elastic| shape. +% +% \begin{macrocode} +\pgfkeys{easing, + elastic/frequency/.estore in=\easing@param@elastic@frequency, + elastic/damping/.estore in=\easing@param@elastic@damping, + elastic/frequency/.default=3, + elastic/damping/.default=7.2, + elastic/frequency, elastic/damping}% +\def\easing@elasticeasein@ne#1{% + \begingroup + \pgf@xa#1pt + \advance\pgf@xa -1pt + \pgf@xb-\pgf@xa + \pgf@xa\easing@param@elastic@damping\pgf@xa + \easing@exp{\pgfmath@tonumber\pgf@xa}% + \pgf@xa\pgfmathresult pt + \pgf@xb 360\pgf@xb + \pgf@xb\easing@param@elastic@frequency\pgf@xb + \easing@cos{\pgfmath@tonumber\pgf@xb}% + \pgf@xa\pgfmathresult\pgf@xa + \pgfmathreturn\pgf@xa + \endgroup +}% +\easing@derive@step@nefromeasein@ne{elastic}% +\easing@derive@easeout@nefromeasein@ne{elastic}% +\easing@pgfmathinstall{elastic}% +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \Finale diff --git a/graphics/pgf/contrib/easing/easing.ins b/graphics/pgf/contrib/easing/easing.ins new file mode 100644 index 0000000000..d095a93a3d --- /dev/null +++ b/graphics/pgf/contrib/easing/easing.ins @@ -0,0 +1,44 @@ +%% Copyright (C) 2021 Loh Ka-tsun +%% +%% This file may be distributed and/or modified under the conditions of +%% the LaTeX Project Public License, either version 1.3 of this license +%% or (at your option) any later version. The latest version of this +%% license is in: +%% +%% http://www.latex-project.org/lppl.txt +%% +%% and version 1.3 or later is part of all distributions of LaTeX version +%% 2005/12/01 or later. +\input docstrip.tex +\keepsilent +\askforoverwritefalse +\usedir{tex/generic/easing} +\preamble + +This is a generated file. + +Copyright (C) 2021 Loh Ka-tsun + +This file may be distributed and/or modified under the conditions of +the LaTeX Project Public License, either version 1.3 of this license +or (at your option) any later version. The latest version of this +license is in: + + http://www.latex-project.org/lppl.txt + +and version 1.3 or later is part of all distributions of LaTeX version +2005/12/01 or later. + +\endpreamble +\generate{\file{pgflibraryeasing.code.tex}{\from{easing.dtx}{package}}} +\obeyspaces +\Msg{*********************************************************} +\Msg{* To finish the installation, move the following file *} +\Msg{* into a directory searched by TeX: *} +\Msg{* *} +\Msg{* pgflibraryeasing.code.tex *} +\Msg{* *} +\Msg{* To produce the documentation, run the file easing.dtx *} +\Msg{* through LaTeX. *} +\Msg{*********************************************************} +\endbatchfile diff --git a/graphics/pgf/contrib/easing/easing.pdf b/graphics/pgf/contrib/easing/easing.pdf new file mode 100644 index 0000000000..683ed7a6e5 Binary files /dev/null and b/graphics/pgf/contrib/easing/easing.pdf differ -- cgit v1.2.3