R/primitives.R

Defines functions a_primitive a_entity a_box a_camera a_circle a_collada_model a_cone a_cursor a_curvedimage a_event a_cylinder a_gltf_model a_icosahedron a_image a_light a_link a_obj_model a_octahedron a_plane a_ring a_ring a_sky a_sound a_sphere a_tetrahedron a_text a_torus_knot a_torus a_triangle a_video a_videosphere

Documented in a_box a_camera a_circle a_collada_model a_cone a_cursor a_curvedimage a_cylinder a_entity a_event a_gltf_model a_icosahedron a_image a_light a_link a_obj_model a_octahedron a_plane a_primitive a_ring a_sky a_sound a_sphere a_tetrahedron a_text a_torus a_torus_knot a_triangle a_video a_videosphere

#' Primitives
#'
#' All aframe primitives.
#'
#' @param primitive The primitive, excluding \code{a-}.
#' @param opts A \code{list} of options.
#' @param ... Any aframe element or named options.
#'
#' @examples
#' x <- a_primitive("box", list(color = "red"))
#' y <- a_box(color = "red")
#'
#' identical(x, y)
#'
#' embed_aframe(
#'   a_scene(
#'     a_dep(),
#'     a_box(
#'       position = "-1 0.5 -3",
#'       rotation = "0 45 0",
#'       color = "#4CC3D9"
#'     )
#'   )
#' )
#'
#' @seealso \code{\link{a_scene}} and \code{\link{a_line}}
#'
#' @rdname primitives
#' @export
a_primitive <- function(primitive, opts = list()){

  if(missing(primitive))
    stop("missing primitive")

  primitive <- paste0("a-", primitive)

  tag(primitive, opts)
}

#' @rdname primitives
#' @export
a_entity <- function(...){
  a_primitive("entity", list(...))
}

#' @rdname primitives
#' @export
a_box <- function(...){
  a_primitive("box", list(...))
}

#' @rdname primitives
#' @export
a_camera <- function(...){
  a_primitive("camera", list(...))
}

#' @rdname primitives
#' @export
a_circle <- function(...){
  a_primitive("circle", list(...))
}

#' @rdname primitives
#' @export
a_collada_model <- function(...){
  a_primitive("collada-model", list(...))
}

#' @rdname primitives
#' @export
a_cone <- function(...){
  a_primitive("cone", list(...))
}

#' @rdname primitives
#' @export
a_cursor <- function(...){
  a_primitive("cursor", list(...))
}

#' @rdname primitives
#' @export
a_curvedimage <- function(...){
  a_primitive("curvedimage", list(...))
}

#' @rdname primitives
#' @export
a_event <- function(...){
  a_primitive("event", list(...))
}

#' @rdname primitives
#' @export
a_cylinder <- function(...){
  a_primitive("cylinder", list(...))
}

#' @rdname primitives
#' @export
a_gltf_model <- function(...){
  a_primitive("gltf-model", list(...))
}

#' @rdname primitives
#' @export
a_icosahedron <- function(...){
  a_primitive("icosahedron", list(...))
}

#' @rdname primitives
#' @export
a_image <- function(...){
  a_primitive("image", list(...))
}

#' @rdname primitives
#' @export
a_light <- function(...){
  a_primitive("light", list(...))
}

#' @rdname primitives
#' @export
a_link <- function(...){
  a_primitive("link", list(...))
}

#' @rdname primitives
#' @export
a_obj_model <- function(...){
  a_primitive("obj-model", list(...))
}

#' @rdname primitives
#' @export
a_octahedron <- function(...){
  a_primitive("octahedron", list(...))
}

#' @rdname primitives
#' @export
a_plane <- function(...){
  a_primitive("plane", list(...))
}

#' @rdname primitives
#' @export
a_ring <- function(...){
  a_primitive("ring", list(...))
}

#' @rdname primitives
#' @export
a_ring <- function(...){
  a_primitive("ring", list(...))
}

#' @rdname primitives
#' @export
a_sky <- function(...){
  a_primitive("sky", list(...))
}

#' @rdname primitives
#' @export
a_sound <- function(...){
  a_primitive("sound", list(...))
}

#' @rdname primitives
#' @export
a_sphere <- function(...){
  a_primitive("sphere", list(...))
}

#' @rdname primitives
#' @export
a_tetrahedron <- function(...){
  a_primitive("tetrahedron", list(...))
}

#' @rdname primitives
#' @export
a_text <- function(...){
  a_primitive("text", list(...))
}

#' @rdname primitives
#' @export
a_torus_knot <- function(...){
  a_primitive("torus-knot", list(...))
}

#' @rdname primitives
#' @export
a_torus <- function(...){
  a_primitive("torus", list(...))
}

#' @rdname primitives
#' @export
a_triangle <- function(...){
  a_primitive("triangle", list(...))
}

#' @rdname primitives
#' @export
a_video <- function(...){
  a_primitive("video", list(...))
}

#' @rdname primitives
#' @export
a_videosphere <- function(...){
  a_primitive("videosphere", list(...))
}
JohnCoene/aframer documentation built on March 10, 2020, 1:32 p.m.