Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

animation

Animate


Description

Animate graph components.

Usage

sg_animate(sg, mapping, options = list(easing = "cubicInOut"), delay = 5000)

Arguments

sg

An object of class sigmajsas intatiated by sigmajs.

mapping

Variables to map animation to.

options

Animations options.

delay

Delay in milliseconds before animation is triggered.

Details

You can animate, x, y, size and color.

Value

An object of class htmlwidget which renders the visualisation on print.

See Also

Examples

# generate graph
nodes <- sg_make_nodes(20)
edges <- sg_make_edges(nodes, 30)

# add transition
n <- nrow(nodes)
nodes$to_x <- runif(n, 5, 10)
nodes$to_y <- runif(n, 5, 10)
nodes$to_size <- runif(n, 5, 10)

sigmajs() %>%
  sg_nodes(nodes, id, label, size, color, to_x, to_y, to_size) %>%
  sg_edges(edges, id, source, target) %>% 
  sg_animate(mapping = list(x = "to_x", y = "to_y", size = "to_size"))

sigmajs

Interface to 'Sigma.js' Graph Visualization Library

v0.1.5
MIT + file LICENSE
Authors
John Coene [aut, cre, cph] (<https://orcid.org/0000-0002-6637-4107>)
Initial release
2020-06-17

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.