JLoop: Looping transition timing function

View source: R/anim-tools.R

JLoopR Documentation

Looping transition timing function

Description

Creates a custom transition timing function that loops smoothly, i.e. the value animates from its initial value to the final value then back to the initial value. It is implemented as a sin function, so it starts and stops smoothly. JLoop is passed by name (i.e. without parentheses), whereas JLoops must be invoked with a single argument, nCycles.

Usage

JLoop(x)

JLoops(nCycles)

Arguments

x

x-value passed to the function automatically. See Examples below.

nCycles

Number of times to loop within the transition.

Value

A timing function.

See Also

JTransition, JEase, JBezier, JScene

Examples

## Not run: 
# Loop
JScene(1, 30,
       width = JTransition(0, 1, timing = JLoop), # Loop once during the transition
       height = JTransition(0, 1, timing = JLoops(3)), # Loop 3 times
       plotFn = function(width, height) {
           # width values will animate from 0 to 1 then back to 0
           # height values will change from 0 to 1 and back 3 times
       })

## End(Not run)


JimMcL/JUtils documentation built on Nov. 7, 2024, 11:25 a.m.