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.
ageControl(births, ages, objids, value = 0, colors = NULL, alpha = NULL, radii = NULL, vertices = NULL, normals = NULL, origins = NULL, texcoords = NULL, x = NULL, y = NULL, z = NULL, red = NULL, green = NULL, blue = NULL)
ages
."rglControl"
of cleaned up parameter
values, to be used in an rgl widget.
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.
saveopts <- options(rgl.useNULL = TRUE)
theta <- seq(0, 4*pi, len=100)
xyz <- cbind(sin(theta), cos(theta), sin(theta/2))
lineid <- rgl::plot3d(xyz, type="l", alpha = 1:0, lwd = 5, col = "blue")["data"]
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)
options(saveopts)
Run the code above in your browser using DataLab