Description Usage Arguments Details Value Author(s) Examples

View source: R/rglcontroller.R

This is a function to produce actions in response to
a `playwidget`

or Shiny input control. The
mental model is that each of the vertices of some object has
a certain birth time; a control sets the current time, so that
vertices have ages depending on the control setting.
Attributes of those vertices can then be changed.

1 2 3 4 5 |

`births` |
Numeric birth times of vertices. |

`ages` |
Chosen ages at which the following attributes will apply. |

`objids` |
Object ids to which the changes apply. |

`value` |
Initial value; typically overridden by input. |

`colors, alpha, radii, vertices, normals, origins, texcoords` |
Attributes of the vertices that can be changed. There should be
one entry or row for each entry in |

`x, y, z, red, green, blue` |
These one-dimensional components of vertices and colors are provided for convenience. |

All attributes must have the same number of entries (rows for the matrices) as the ages vector. The births vector must have the same number of entries as the number of vertices in the object.

Not all objects contain all attributes; if one is chosen that is
not a property of the corresponding object, a Javascript `alert()`

will be
generated. (This restriction may be removed in the future by attempting
to add the attribute when it makes sense.)

If a `births`

entry is `NA`

, no change will be made to that
vertex.

A list of class `"rglControl"`

of cleaned up parameter
values, to be used in an rgl widget.

Duncan Murdoch

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | ```
saveopts <- options(rgl.useNULL = TRUE)
theta <- seq(0, 4*pi, len=100)
xyz <- cbind(sin(theta), cos(theta), sin(theta/2))
lineid <- plot3d(xyz, type="l", alpha = 0, lwd = 5, col = "blue")["data"]
widget <- rglwidget(width=500, height=300) %>%
playwidget(ageControl(births = theta,
ages = c(-4*pi, -4*pi, 1-4*pi, 0, 0, 1),
objids = lineid,
alpha = c(0, 1, 0, 0, 1, 0)),
start = 0, stop = 4*pi,
step = 0.1, rate = 4)
if (interactive())
widget
options(saveopts)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.