## ----setup, echo=FALSE, message=FALSE,warning=FALSE,out.width='100%'----------
library(minixcali)
library(purrr)
library(svgchop)
bl <- svgchop::chop('maxwell_equation.svg', steps = 10, transform = TRUE)[[1]]
names(b)
d <- Excali_doc()
scale <- 10
for (b in seq_along(bl)) {
b <- bl[[ii]]
r_x <- range(b$points[1, ])
r_y <- range(b$points[2, ])
brks <- cumsum(abs(c(0, diff(b$points[1,]))) > 0.2 * abs(diff(r_x)) |
abs(c(0, diff(b$points[2,]))) > 0.2 * abs(diff(r_y)))
df <- data.frame(x = b$points[1, ],
y = b$points[2, ],
g = brks)
ls <- split(df, df$g)
for(s in ls){
s_x <- range(s$x)
s_y <- range(s$y)
m <- scale * cbind(s$x - s_x[1],
s$y - s_y[1])
shape <- xkd_draw(
x = scale * (b$x + s_x[1]),
y = scale * (b$y + s_y[1]),
width = scale * diff(s_x),
height = scale * diff(s_y),
strokeWidth = 1,
roughness = 0L,
strokeSharpness = "sharp",
groupIds = list("letter", paste0('part',unique(s$g))),
fillStyle = "solid",
strokeColor = '#000000',
backgroundColor = '#000000',
points = m)
d$add(shape)
}
}
d$export('max.json')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.