knitr::opts_chunk$set(echo = TRUE) library(brainspriteR) library(shiny) addResourcePath('img','.')
See brainsprite.js to see how should brain sprite and overlay images be prepared. This demo uses these brain sprites and these overlay sprites.
brainsprite(sprites = 'sprite.jpg', flagCoordinates = TRUE, spriteHeight = 233, spriteWidth = 189)
Overlay images can also be added
brainsprite(sprites = 'sprite.jpg', spriteHeight = 233, spriteWidth = 189, overlay = 'dmnSprite.png', overlayHeight = 233, overlayWidth = 189)
It can also be used as a shiny input
brainsprite(sprites = 'sprite.jpg', flagCoordinates = TRUE, inputId = 'spriteInput', spriteHeight = 233, spriteWidth = 189)
renderText({input$spriteInput})
The output is an array corresponding to X, Y, Z coordinates of the clicked location
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.