rglwidget (version 0.1.1402)

playwidget: Add a widget to play animations.

Description

This is a widget that can be put in a web page to allow animations without needing Shiny.

Usage

playwidget(sceneId, ...,
            start = 0, stop = Inf, interval = 0.05, rate = 1,
            components = c("Reverse", "Play", "Slower", "Faster",
                           "Reset", "Slider", "Label"),
            loop = TRUE,
            step = 1, labels = seq(from = start, to = stop, by = step),
            precision = 3, width = "auto",
            elementId = NULL, respondTo = NULL)

Arguments

sceneId
The HTML id of the rgl scene being controlled.
...
A number of controller functions, e.g. propertyControl.
start, stop
The starting and stopping values of the animation.
interval
The requested interval (in seconds) between updates. Updates may occur at longer intervals.
rate
The number of units of nominal time per real world second.
components
Which components should be displayed? See Details below.
loop
When the player reaches the end of the interval, should it loop back to the beginning?
step
Step size in the slider.
labels
Optional labels to use, corresponding to slider steps. Set to NULL for auto-generated labels.
precision
If labels=NULL, the precision to use when displaying timer values.
width
The CSS specification for the width of the slider.
elementId
The HTML id of the generated widget, containing buttons, slider, etc.
respondTo
The HTML ID of an input control (e.g. a sliderInput control) to respond to.

Value

  • A widget suitable for use in an Rmarkdown-generated web page.

Details

The components are buttons to control the animation, a slider for manual control, and a label to show the current value. They will be displayed in the order given in components. Not all need be included.

The buttons have the following behaviour: [object Object],[object Object],[object Object],[object Object],[object Object]

If respondTo is used, the components are cleared. It makes more sense to use rglcontroller.

See Also

rglcontroller for embedding controls in a Shiny app. subsetControl, propertyControl, ageControl and vertexControl are possible controls to use.

Examples

Run this code
saveopts <- options(rgl.useNULL = TRUE)
example("plot3d", "rgl")
rglwidget(elementId = "theplot")
control <- ageControl(value=0,
             births=rep(0, 21),
             ages = c(-5,0,5),
             colors = c("green", "yellow", "red"),
             objids = 123)
playwidget("theplot", control, start = -5, stop = 5, rate = 3, loop = TRUE)
options(saveopts)

Run the code above in your browser using DataLab