I'm trying to combine animate's \multiframe
command with a TikZ \fill
command so that in every fourth frame, the top of my rectangle is moved by one unit:
\multiframe{20}{rya=10+-0.25}{
\fill[green!10] (4,0) rectangle (6,\rya);
}
The problem with my current approach is that instead of resizing the rectangle by one unit every fourth frame, it gets resized by a quarter unit in each frame.
What I'm after is some kind of "floor" function that I could apply to \rya
, or any kind of alternative way to achieve the same result.
(There are some other things being animated at the same time, preventing me from simply lowering the frame rate and using iya=10+-1
instead of rya=10+-0.25
. I left them out here for the sake of brevity.)
floor
function in TikZ, so you might just be able to writefloor(\rya)
.{floor(\rya)}
.\rya
part and simply trying the variation(6,{floor(3.5)})
will give me that. I'm currenly only doing\usepackage{tikz}
, so maybe I need to include something else?\documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture} \fill (0,0) rectangle +(1,{floor(1.9)}); \fill (1.1,0) rectangle +(1,1.9); \end{tikzpicture} \end{document}
works fine here. Could you create a complete, minimal example (an MWE ) that demonstrates the problem?floor
but eventually got it right. Thanks a lot. Could someone please make this into an answer that I can accept?