% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/orbit-3d.R
\name{orbit_3d-shiny}
\alias{orbit_3d-shiny}
\alias{orbit3dOutput}
\alias{renderOrbit3d}
\title{Shiny bindings for orbit_3d}
\usage{
orbit3dOutput(outputId, width = "100\%", height = "400px")

renderOrbit3d(expr, env = parent.frame(), quoted = FALSE)
}
\arguments{
\item{outputId}{Output variable to read from.}

\item{width, height}{Must be a valid CSS unit (like \code{"100\%"}, \code{"400px"},
\code{"auto"}) or a number, which will be coerced to a string and have \code{"px"}
appended.}

\item{expr}{An expression that generates a orbit (a call to
\code{\link[=orbit_3d]{orbit_3d()}}).}

\item{env}{The environment in which to evaluate \code{expr}.}

\item{quoted}{Is \code{expr} a quoted expression (with \code{quote()})? This is useful
if you want to save an expression in a variable.}
}
\description{
Output and render functions for using \code{\link[=orbit_3d]{orbit_3d()}} within Shiny
applications and interactive R Markdown documents.
}
\examples{
\dontshow{if (interactive() && requireNamespace("shiny", quietly = TRUE) && requireNamespace("base64enc", quietly = TRUE)) withAutoprint(\{ # examplesIf}
library(shiny)

p <- ggplot(mountain, aes(x, y, z, fill = z, color = z)) +
  geom_surface_3d(linewidth = .25) +
  coord_3d(light = light(anchor = "camera", direction = c(1, 1, 0)),
           ratio = c(1.5, 2, 1)) +
  scale_fill_viridis_c() + scale_color_viridis_c() +
  theme_void()

ui <- fluidPage(
  titlePanel("Interactive ggcube"),
  orbit3dOutput("fb", width = "500px", height = "500px")
)

server <- function(input, output, session) {
  output$fb <- renderOrbit3d({
    orbit_3d(p, yaw = c(360, 0), n = 12)
  })
}

shinyApp(ui, server)
\dontshow{\}) # examplesIf}
}
