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.

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)

## Arguments

births Numeric birth times of vertices. Chosen ages at which the following attributes will apply. Object ids to which the changes apply. Initial value; typically overridden by input. Attributes of the vertices that can be changed. There should be one entry or row for each entry in ages. These one-dimensional components of vertices and colors are provided for convenience.

## Details

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.

## Value

A list of class "rglControl" of cleaned up parameter values, to be used in an RGL widget.

Duncan Murdoch

## Examples

  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() %>%
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() || in_pkgdown_example())
widget

{"x":{"data":[{"material":{"color":"#000000","alpha":1,"lit":true,"ambient":"#000000","specular":"#FFFFFF","emission":"#000000","shininess":50,"smooth":true,"front":"filled","back":"filled","size":3,"lwd":1,"fog":true,"point_antialias":false,"line_antialias":false,"texture":null,"textype":"rgb","texmipmap":false,"texminfilter":"linear","texmagfilter":"linear","texenvmap":false,"depth_mask":true,"depth_test":"less","isTransparent":false,"polygon_offset":[0,0],"margin":"","floating":false},"rootSubscene":32,"objects":{"40":{"id":40,"type":"linestrip","material":{"alpha":0,"lit":false,"lwd":5,"isTransparent":true},"vertices":[[0,1,0],[0.126592457294464,0.991954803466797,0.0634239166975021],[0.251147985458374,0.96794867515564,0.126592457294464],[0.371662467718124,0.928367912769318,0.189251244068146],[0.486196726560593,0.873849391937256,0.251147985458374],[0.592907905578613,0.805270254611969,0.312033444643021],[0.690079033374786,0.723734021186829,0.371662467718124],[0.776146471500397,0.630552649497986,0.429794907569885],[0.849725425243378,0.527225494384766,0.486196726560593],[0.909631967544556,0.415415018796921,0.540640830993652],[0.954902231693268,0.296920388936996,0.592907905578613],[0.984807729721069,0.173648178577423,0.642787635326385],[0.998867332935333,0.0475819148123264,0.690079033374786],[0.996854782104492,-0.0792499557137489,0.734591722488403],[0.978802442550659,-0.204806670546532,0.776146471500397],[0.945000827312469,-0.327067971229553,0.814575970172882],[0.895993769168854,-0.444066613912582,0.849725425243378],[0.83256983757019,-0.553920090198517,0.881453335285187],[0.755749583244324,-0.654860734939575,0.909631967544556],[0.666769027709961,-0.74526447057724,0.934147834777832],[0.567059874534607,-0.823676586151123,0.954902231693268],[0.458226531744003,-0.888835430145264,0.971811592578888],[0.342020153999329,-0.939692616462708,0.984807729721069],[0.220310539007187,-0.975429773330688,0.993838489055634],[0.0950560420751572,-0.995471894741058,0.998867332935333],[-0.0317279323935509,-0.999496519565582,0.999874114990234],[-0.158001393079758,-0.987438917160034,0.996854782104492],[-0.281732559204102,-0.959492981433868,0.989821434020996],[-0.400930523872375,-0.916108429431915,0.978802442550659],[-0.513677418231964,-0.857983410358429,0.963842153549194],[-0.618158996105194,-0.786053121089935,0.945000827312469],[-0.71269416809082,-0.701474905014038,0.922354280948639],[-0.795761823654175,-0.605609714984894,0.895993769168854],[-0.866025388240814,-0.5,0.866025388240814],[-0.922354280948639,-0.386345118284225,0.83256983757019],[-0.963842153549194,-0.266473799943924,0.795761823654175],[-0.989821434020996,-0.142314836382866,0.755749583244324],[-0.999874114990234,-0.0158659629523754,0.71269416809082],[-0.993838489055634,0.110838197171688,0.666769027709961],[-0.971811592578888,0.235758930444717,0.618158996105194],[-0.934147834777832,0.356886208057404,0.567059874534607],[-0.881453335285187,0.472271084785461,0.513677418231964],[-0.814575970172882,0.58005690574646,0.458226531744003],[-0.734591722488403,0.678509414196014,0.400930523872375],[-0.642787635326385,0.766044437885284,0.342020153999329],[-0.540640830993652,0.841253519058228,0.281732559204102],[-0.429794907569885,0.902926564216614,0.220310539007187],[-0.312033444643021,0.950071096420288,0.158001393079758],[-0.189251244068146,0.981928706169128,0.0950560420751572],[-0.0634239166975021,0.997986674308777,0.0317279323935509],[0.0634239166975021,0.997986674308777,-0.0317279323935509],[0.189251244068146,0.981928706169128,-0.0950560420751572],[0.312033444643021,0.950071096420288,-0.158001393079758],[0.429794907569885,0.902926564216614,-0.220310539007187],[0.540640830993652,0.841253519058228,-0.281732559204102],[0.642787635326385,0.766044437885284,-0.342020153999329],[0.734591722488403,0.678509414196014,-0.400930523872375],[0.814575970172882,0.58005690574646,-0.458226531744003],[0.881453335285187,0.472271084785461,-0.513677418231964],[0.934147834777832,0.356886208057404,-0.567059874534607],[0.971811592578888,0.235758930444717,-0.618158996105194],[0.993838489055634,0.110838197171688,-0.666769027709961],[0.999874114990234,-0.0158659629523754,-0.71269416809082],[0.989821434020996,-0.142314836382866,-0.755749583244324],[0.963842153549194,-0.266473799943924,-0.795761823654175],[0.922354280948639,-0.386345118284225,-0.83256983757019],[0.866025388240814,-0.5,-0.866025388240814],[0.795761823654175,-0.605609714984894,-0.895993769168854],[0.71269416809082,-0.701474905014038,-0.922354280948639],[0.618158996105194,-0.786053121089935,-0.945000827312469],[0.513677418231964,-0.857983410358429,-0.963842153549194],[0.400930523872375,-0.916108429431915,-0.978802442550659],[0.281732559204102,-0.959492981433868,-0.989821434020996],[0.158001393079758,-0.987438917160034,-0.996854782104492],[0.0317279323935509,-0.999496519565582,-0.999874114990234],[-0.0950560420751572,-0.995471894741058,-0.998867332935333],[-0.220310539007187,-0.975429773330688,-0.993838489055634],[-0.342020153999329,-0.939692616462708,-0.984807729721069],[-0.458226531744003,-0.888835430145264,-0.971811592578888],[-0.567059874534607,-0.823676586151123,-0.954902231693268],[-0.666769027709961,-0.74526447057724,-0.934147834777832],[-0.755749583244324,-0.654860734939575,-0.909631967544556],[-0.83256983757019,-0.553920090198517,-0.881453335285187],[-0.895993769168854,-0.444066613912582,-0.849725425243378],[-0.945000827312469,-0.327067971229553,-0.814575970172882],[-0.978802442550659,-0.204806670546532,-0.776146471500397],[-0.996854782104492,-0.0792499557137489,-0.734591722488403],[-0.998867332935333,0.0475819148123264,-0.690079033374786],[-0.984807729721069,0.173648178577423,-0.642787635326385],[-0.954902231693268,0.296920388936996,-0.592907905578613],[-0.909631967544556,0.415415018796921,-0.540640830993652],[-0.849725425243378,0.527225494384766,-0.486196726560593],[-0.776146471500397,0.630552649497986,-0.429794907569885],[-0.690079033374786,0.723734021186829,-0.371662467718124],[-0.592907905578613,0.805270254611969,-0.312033444643021],[-0.486196726560593,0.873849391937256,-0.251147985458374],[-0.371662467718124,0.928367912769318,-0.189251244068146],[-0.251147985458374,0.96794867515564,-0.126592457294464],[-0.126592457294464,0.991954803466797,-0.0634239166975021],[-4.89858741034067e-16,1,-2.44929370517034e-16]],"colors":[[0,0,1,0]],"centers":[[0,1,0],[0.126592457294464,0.991954803466797,0.0634239166975021],[0.251147985458374,0.96794867515564,0.126592457294464],[0.371662467718124,0.928367912769318,0.189251244068146],[0.486196726560593,0.873849391937256,0.251147985458374],[0.592907905578613,0.805270254611969,0.312033444643021],[0.690079033374786,0.723734021186829,0.371662467718124],[0.776146471500397,0.630552649497986,0.429794907569885],[0.849725425243378,0.527225494384766,0.486196726560593],[0.909631967544556,0.415415018796921,0.540640830993652],[0.954902231693268,0.296920388936996,0.592907905578613],[0.984807729721069,0.173648178577423,0.642787635326385],[0.998867332935333,0.0475819148123264,0.690079033374786],[0.996854782104492,-0.0792499557137489,0.734591722488403],[0.978802442550659,-0.204806670546532,0.776146471500397],[0.945000827312469,-0.327067971229553,0.814575970172882],[0.895993769168854,-0.444066613912582,0.849725425243378],[0.83256983757019,-0.553920090198517,0.881453335285187],[0.755749583244324,-0.654860734939575,0.909631967544556],[0.666769027709961,-0.74526447057724,0.934147834777832],[0.567059874534607,-0.823676586151123,0.954902231693268],[0.458226531744003,-0.888835430145264,0.971811592578888],[0.342020153999329,-0.939692616462708,0.984807729721069],[0.220310539007187,-0.975429773330688,0.993838489055634],[0.0950560420751572,-0.995471894741058,0.998867332935333],[-0.0317279323935509,-0.999496519565582,0.999874114990234],[-0.158001393079758,-0.987438917160034,0.996854782104492],[-0.281732559204102,-0.959492981433868,0.989821434020996],[-0.400930523872375,-0.916108429431915,0.978802442550659],[-0.513677418231964,-0.857983410358429,0.963842153549194],[-0.618158996105194,-0.786053121089935,0.945000827312469],[-0.71269416809082,-0.701474905014038,0.922354280948639],[-0.795761823654175,-0.605609714984894,0.895993769168854],[-0.866025388240814,-0.5,0.866025388240814],[-0.922354280948639,-0.386345118284225,0.83256983757019],[-0.963842153549194,-0.266473799943924,0.795761823654175],[-0.989821434020996,-0.142314836382866,0.755749583244324],[-0.999874114990234,-0.0158659629523754,0.71269416809082],[-0.993838489055634,0.110838197171688,0.666769027709961],[-0.971811592578888,0.235758930444717,0.618158996105194],[-0.934147834777832,0.356886208057404,0.567059874534607],[-0.881453335285187,0.472271084785461,0.513677418231964],[-0.814575970172882,0.58005690574646,0.458226531744003],[-0.734591722488403,0.678509414196014,0.400930523872375],[-0.642787635326385,0.766044437885284,0.342020153999329],[-0.540640830993652,0.841253519058228,0.281732559204102],[-0.429794907569885,0.902926564216614,0.220310539007187],[-0.312033444643021,0.950071096420288,0.158001393079758],[-0.189251244068146,0.981928706169128,0.0950560420751572],[-0.0634239166975021,0.997986674308777,0.0317279323935509],[0.0634239166975021,0.997986674308777,-0.0317279323935509],[0.189251244068146,0.981928706169128,-0.0950560420751572],[0.312033444643021,0.950071096420288,-0.158001393079758],[0.429794907569885,0.902926564216614,-0.220310539007187],[0.540640830993652,0.841253519058228,-0.281732559204102],[0.642787635326385,0.766044437885284,-0.342020153999329],[0.734591722488403,0.678509414196014,-0.400930523872375],[0.814575970172882,0.58005690574646,-0.458226531744003],[0.881453335285187,0.472271084785461,-0.513677418231964],[0.934147834777832,0.356886208057404,-0.567059874534607],[0.971811592578888,0.235758930444717,-0.618158996105194],[0.993838489055634,0.110838197171688,-0.666769027709961],[0.999874114990234,-0.0158659629523754,-0.71269416809082],[0.989821434020996,-0.142314836382866,-0.755749583244324],[0.963842153549194,-0.266473799943924,-0.795761823654175],[0.922354280948639,-0.386345118284225,-0.83256983757019],[0.866025388240814,-0.5,-0.866025388240814],[0.795761823654175,-0.605609714984894,-0.895993769168854],[0.71269416809082,-0.701474905014038,-0.922354280948639],[0.618158996105194,-0.786053121089935,-0.945000827312469],[0.513677418231964,-0.857983410358429,-0.963842153549194],[0.400930523872375,-0.916108429431915,-0.978802442550659],[0.281732559204102,-0.959492981433868,-0.989821434020996],[0.158001393079758,-0.987438917160034,-0.996854782104492],[0.0317279323935509,-0.999496519565582,-0.999874114990234],[-0.0950560420751572,-0.995471894741058,-0.998867332935333],[-0.220310539007187,-0.975429773330688,-0.993838489055634],[-0.342020153999329,-0.939692616462708,-0.984807729721069],[-0.458226531744003,-0.888835430145264,-0.971811592578888],[-0.567059874534607,-0.823676586151123,-0.954902231693268],[-0.666769027709961,-0.74526447057724,-0.934147834777832],[-0.755749583244324,-0.654860734939575,-0.909631967544556],[-0.83256983757019,-0.553920090198517,-0.881453335285187],[-0.895993769168854,-0.444066613912582,-0.849725425243378],[-0.945000827312469,-0.327067971229553,-0.814575970172882],[-0.978802442550659,-0.204806670546532,-0.776146471500397],[-0.996854782104492,-0.0792499557137489,-0.734591722488403],[-0.998867332935333,0.0475819148123264,-0.690079033374786],[-0.984807729721069,0.173648178577423,-0.642787635326385],[-0.954902231693268,0.296920388936996,-0.592907905578613],[-0.909631967544556,0.415415018796921,-0.540640830993652],[-0.849725425243378,0.527225494384766,-0.486196726560593],[-0.776146471500397,0.630552649497986,-0.429794907569885],[-0.690079033374786,0.723734021186829,-0.371662467718124],[-0.592907905578613,0.805270254611969,-0.312033444643021],[-0.486196726560593,0.873849391937256,-0.251147985458374],[-0.371662467718124,0.928367912769318,-0.189251244068146],[-0.251147985458374,0.96794867515564,-0.126592457294464],[-0.126592457294464,0.991954803466797,-0.0634239166975021],[-4.89858741034067e-16,1,-2.44929370517034e-16]],"ignoreExtent":false,"flags":41056},"42":{"id":42,"type":"text","material":{"lit":false,"margin":0,"floating":true,"edge":[0,1,1]},"vertices":[[null,4,1]],"colors":[[0,0,0,1]],"texts":[["xyz[,1]"]],"cex":[[1]],"adj":[[0.5,0.5,0.5]],"centers":[[null,4,1]],"family":[["sans"]],"font":[[1]],"ignoreExtent":true,"flags":33808},"43":{"id":43,"type":"text","material":{"lit":false,"margin":1,"floating":true,"edge":[1,1,1]},"vertices":[[null,4,1]],"colors":[[0,0,0,1]],"texts":[["xyz[,2]"]],"cex":[[1]],"adj":[[0.5,0.5,0.5]],"centers":[[null,4,1]],"family":[["sans"]],"font":[[1]],"ignoreExtent":true,"flags":33808},"44":{"id":44,"type":"text","material":{"lit":false,"margin":2,"floating":true,"edge":[1,1,1]},"vertices":[[null,4,1]],"colors":[[0,0,0,1]],"texts":[["xyz[,3]"]],"cex":[[1]],"adj":[[0.5,0.5,0.5]],"centers":[[null,4,1]],"family":[["sans"]],"font":[[1]],"ignoreExtent":true,"flags":33808},"36":{"id":36,"type":"light","vertices":[[0,0,1]],"colors":[[1,1,1,1],[1,1,1,1],[1,1,1,1]],"viewpoint":true,"finite":false},"37":{"id":37,"type":"background","material":{"lit":false,"back":"lines"},"colors":[[1,1,1,1]],"centers":[[0,0,0]],"sphere":false,"fogtype":"none","fogscale":1,"flags":32768},"41":{"id":41,"type":"bboxdeco","material":{"front":"lines","back":"lines"},"vertices":[[-0.5,null,null],[0,null,null],[0.5,null,null],[null,-0.5,null],[null,0,null],[null,0.5,null],[null,1,null],[null,null,-0.5],[null,null,0],[null,null,0.5]],"colors":[[0,0,0,1]],"axes":{"mode":["pretty","pretty","pretty"],"step":[0.5,0.5,0.5],"nticks":[5,5,5],"marklen":[15,15,15],"expand":[1.02999997138977,1.02999997138977,1.02999997138977]},"draw_front":true},"32":{"id":32,"type":"subscene","par3d":{"antialias":8,"FOV":30,"ignoreExtent":false,"listeners":32,"mouseMode":{"none":"none","left":"trackball","right":"zoom","middle":"fov","wheel":"pull"},"observer":[0,0,8.47527694702148],"modelMatrix":[[0.999958038330078,0,0,0],[0,0.342048853635788,0.939653158187866,-8.60972577356733e-05],[0,-0.939771473407745,0.342005789279938,-8.47504043579102],[0,0,0,1]],"projMatrix":[[3.73205065727234,0,0,0],[0,3.73205065727234,0,0],[0,0,-3.86370301246643,-30.5523910522461],[0,0,-1,0]],"skipRedraw":false,"userMatrix":[[1,0,0,0],[0,0.342020143325668,0.939692620785909,0],[0,-0.939692620785909,0.342020143325668,0],[0,0,0,1]],"userProjection":[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]],"scale":[0.999958038330078,1.00008392333984,0.999958038330078],"viewport":{"x":0,"y":0,"width":1,"height":1},"zoom":1,"bbox":[-0.999874114990234,0.999874114990234,-0.999496519565582,1,-0.999874114990234,0.999874114990234],"windowRect":[20,65,276,321],"family":"sans","font":1,"cex":1,"useFreeType":true,"fontname":"/Library/Frameworks/R.framework/Versions/4.1/Resources/library/rgl/fonts/FreeSans.ttf","maxClipPlanes":6,"glVersion":2.1,"activeSubscene":0},"embeddings":{"viewport":"replace","projection":"replace","model":"replace","mouse":"replace"},"objects":[37,41,40,42,43,44,36],"subscenes":[],"flags":42352}},"crosstalk":{"key":[],"group":[],"id":[],"options":[]},"width":480,"height":480,"context":{"shiny":false,"rmarkdown":null},"players":"rgl-play33737","webGLoptions":{"preserveDrawingBuffer":true}},{"data":[{"actions":[{"type":"ageSetter","objids":40,"value":0,"births":[0,0.126933036508679,0.253866073017357,0.380799109526036,0.507732146034714,0.634665182543393,0.761598219052071,0.88853125556075,1.01546429206943,1.14239732857811,1.26933036508679,1.39626340159546,1.52319643810414,1.65012947461282,1.7770625111215,1.90399554763018,2.03092858413886,2.15786162064753,2.28479465715621,2.41172769366489,2.53866073017357,2.66559376668225,2.79252680319093,2.91945983969961,3.04639287620828,3.17332591271696,3.30025894922564,3.42719198573432,3.554125022243,3.68105805875168,3.80799109526036,3.93492413176903,4.06185716827771,4.18879020478639,4.31572324129507,4.44265627780375,4.56958931431243,4.69652235082111,4.82345538732978,4.95038842383846,5.07732146034714,5.20425449685582,5.3311875333645,5.45812056987318,5.58505360638185,5.71198664289053,5.83891967939921,5.96585271590789,6.09278575241657,6.21971878892525,6.34665182543393,6.4735848619426,6.60051789845128,6.72745093495996,6.85438397146864,6.98131700797732,7.108250044486,7.23518308099468,7.36211611750335,7.48904915401203,7.61598219052071,7.74291522702939,7.86984826353807,7.99678130004675,8.12371433655542,8.2506473730641,8.37758040957278,8.50451344608146,8.63144648259014,8.75837951909882,8.8853125556075,9.01224559211617,9.13917862862485,9.26611166513353,9.39304470164221,9.51997773815089,9.64691077465957,9.77384381116824,9.90077684767692,10.0277098841856,10.1546429206943,10.281575957203,10.4085089937116,10.5354420302203,10.662375066729,10.7893081032377,10.9162411397464,11.043174176255,11.1701072127637,11.2970402492724,11.4239732857811,11.5509063222897,11.6778393587984,11.8047723953071,11.9317054318158,12.0586384683245,12.1855715048331,12.3125045413418,12.4394375778505,12.5663706143592],"ages":[null,-12.5663706143592,-12.5663706143592,-11.5663706143592,0,0,1,null],"alpha":[0,0,1,0,0,1,0,0]}],"start":0,"stop":12.5663706143592,"value":0,"interval":0.05,"rate":4,"components":["Reverse","Play","Slower","Faster","Reset","Slider","Label"],"buttonLabels":["Reverse","Play","Slower","Faster","Reset","Slider","Label"],"pause":"Pause","loop":true,"step":0.1,"labels":null,"precision":3,"reinit":null,"sceneId":"rgl82459","respondTo":null}],"widgetType":"rglPlayer","elementId":"rgl-play33737","html":"<div class=\"cw-container\"><div class=\"cw-subcontainer\"><div class=\"cw-content cw-by-row\"><div class=\"cw-row cw-by-row\" style=\"flex:1;-webkit-flex:1\"><div class=\"cw-col\" style=\"flex:1;-webkit-flex:1\">\n              <div id=\"rgl-play33737\" class=\"rglPlayer cw-widget html-widget-static-bound\" style=\"width:100%;height:100%\"><\/div>\n              <\/div><\/div><\/div><\/div><\/div>","hasCrosstalkInputs":false}],"widgetType":["rglWebGL","combineWidgets"],"elementId":["rgl82459","widget958503520"],"html":"<div class=\"cw-container\"><div class=\"cw-subcontainer\"><div class=\"cw-content cw-by-row\"><div class=\"cw-row cw-by-row\" style=\"flex:480;-webkit-flex:480\"><div class=\"cw-col\" style=\"flex:1;-webkit-flex:1\">\n              <div id=\"rgl82459\" class=\"rglWebGL cw-widget html-widget-static-bound\" style=\"width:100%;height:100%\"><\/div>\n              <\/div><\/div><div class=\"cw-row cw-by-row\" style=\"flex:40;-webkit-flex:40\"><div class=\"cw-col\" style=\"flex:1;-webkit-flex:1\">\n              <div id=\"widget958503520\" class=\"combineWidgets cw-widget html-widget-static-bound\" style=\"width:100%;height:100%\"><\/div>\n              <\/div><\/div><\/div><\/div><\/div>","hasCrosstalkInputs":false},"evals":[],"jsHooks":[]}  options(saveopts)