fabric_shape {fabricerin}R Documentation

Create shapes inside a canvas

Description

Create shapes inside a canvas

Usage

fabric_shape(
  cid,
  cwidth = 800,
  cheight = 600,
  cfill = "#FFFFFF",
  shapeId,
  shape = "Rect",
  left = 100,
  top = 100,
  fill = "red",
  width = 200,
  height = 200,
  angle = 0,
  opacity = 1,
  strokecolor = "darkblue",
  strokewidth = 5,
  selectable = TRUE,
  isDrawingMode = FALSE,
  radius = NULL,
  xPolygon = NULL,
  yPolygon = NULL
)

Arguments

cid

the id of the canvas element

cwidth

the width of the canvas element. Defaults to 800

cheight

the height of the canvas element. Defaults to 600

cfill

the color of the canvas element

shapeId

the id of the shape object

shape

the shape of the object. Choices include 'Circle', 'Triangle' and 'Rect'. Defaults to 'Rect'

left

the shape's position from the left relative to the canvas element. Defaults to 100

top

the shape's position from the top relative to the canvas element. Defaults to 100

fill

the color of the shape. Defaults to 'red'

width

the width of the shape. Defaults to 200

height

the height of the shape. Defaults to 200

angle

the angle of rotation of the shape. Defaults to 0 (no rotation)

opacity

the opacity of the shape (from 0 to 1). Defaults to 1

strokecolor

the stroke color of the shape. Defaults to 'darkblue'

strokewidth

the stroke width of the shape. Defaults to 5.

selectable

logical. If TRUE, the user can modify interactively the shape's size, position and rotation. Defaults to TRUE

isDrawingMode

logical. If TRUE, the user can draw inside the canvas element.

radius

mandatory if the chosen shape is a 'Circle'. Defaults to NULL

xPolygon

a vector of the coordinate points of the polygon, from the left.

yPolygon

a vector of the coordinate points of the polygon, from the top

Value

a shape object inside a canvas

Examples


if(interactive()){

ui <- fluidPage(


h2("Below you'll find a red Rectangle with a darkblue stroke"),

fabric_shape(cid = "canvas", shapeId = "shape1", shape = "Rect")

)

server <- function(input, output) {


}


shinyApp(ui = ui, server = server)

}


[Package fabricerin version 0.1.2 Index]