Process Map Token Replay Animation

Token replay animation for process maps created with 'processmapR' by using SVG animations ('SMIL') and the 'htmlwidget' package.

CRAN_Status_Badge lifecycle Travis-CI Build Status

processanimateR example

Flexible token replay animation for process maps created through the processmapR package from the bupaR suite, which uses DiagrammeR and viz.js library to render process maps using GraphViz. ProcessanimateR adds a htmlwidget that uses SVG animations (SMIL) to create the animation. Sizes, colors, and the image used for tokens are customizable based on trace, event attributes, or a secondary data frame if an attribute does not change according to the original event log.

Getting Started


ProcessanimateR can be installed from CRAN:


You can also use the development or specific released version by using the remotes package. Note that the current development version may break without warning.

# install the remotes package
# use remotes to install the latest version of processanimateR
# or install a specific tag
remotes::install_github("fmannhardt/[email protected]")

Warnings and Limitations

  • Tokens travel through the process approximately according to the times at which (start and complete) events of the activities occur. In some cases processanimateR will add a small epsilon time to make sure that the SMIL animation works fine, since there seem to be some limitations with regard to zero duration animations.
  • Be aware that the perceived speed in which tokens travel depends on the length of edges in the process map, which is the result of an automatic layout algorithm and does not represent any kind of real distance between activities.
  • Parallelism is still handled poorly as to be expected from a process map. In particular overlapping start and completion times of activities may result in tokens moving unexpectedly.
  • The timeline slider option cannot be used in Internet Explorer due to missing support for certain SVG animation functions.


There are two main functions: animate_process and ianimate_process (interactive version).

We use the patients event log provided by the eventdataR package.


A basic animation with static color and token size:


Default token color, size, or image can be changed as follows:

animate_process(patients, token_size = 2)
animate_process(patients, token_color = "red")
animate_process(patients, token_image = "", token_size = 15)

Dynamic token colors or sizes based on event attributes can be configured. Based on ordinal scales:

                animation_legend = "color", token_color = "employee", 
                token_color_scale = "ordinal", token_color_scale_range = RColorBrewer::brewer.pal(8, "Paired"))

Based on linear scales:

animate_process(sample_n(traffic_fines,1000) %>% filter_trace_frequency(percentage = 0.95),
                animation_legend = "color", token_color = "amount", 
                token_color_scale = "linear", token_color_scale_range = c("yellow","red"), animation_mode = "relative")

Based on time scales (no legend yet):

                animation_legend = "color", token_color = "time", 
                token_color_scale = "time", token_color_scale_range = c("blue","red"))

It is also possible to use a secondary data frame to color the tokens irregardless of the event times. This can be useful if measurement are taken throughout a process, but the measurement event itself should not be included in the process map. For example, the lactic acid measurements of the sepsis data could be used in that way:

# Extract only the lacticacid measurements
lactic <- sepsis %>%
    mutate(lacticacid = as.numeric(lacticacid)) %>%
    filter_activity(c("LacticAcid")) %>% %>%
    select("case" = case_id, 
            "time" =  timestamp, 
            color = lacticacid) # format needs to be 'case,time,color'
# Remove the measurement events from the sepsis log
sepsisBase <- sepsis %>%
    filter_activity(c("LacticAcid", "CRP", "Leucocytes", "Return ER",
                      "IV Liquid", "IV Antibiotics"), reverse = T) %>%
    filter_trace_frequency(percentage = 0.95)
# Animate with the secondary data frame `lactic`
animate_process(sepsisBase, animation_mode = "relative", animation_duration = 600,
                animation_legend = "color", token_color = lactic,
                token_color_scale = "linear", token_color_scale_range = c("#fff5eb","#7f2704"))

More usage examples:

Libraries Used

This package makes use of the following libraries:

  • bupaR, for the base process mining functions in R.
  • viz.js, for the GraphViz layout;
  • d3, for SVG management;
  • d3-legend, to render D3 scales;
  • fakesmil, to provide SMIL support in most browsers;
  • svg-pan-zoom, for the panning/zooming option;
  • MomentJS, for parsing and formatting times and durations.


We use SemVer for versioning. For the versions available, see the tags on this repository.


Felix Mannhardt (SINTEF Læring og beslutningsstøtte)


This software is licensed under the MIT License - see the LICENSE file for details


This software was partly developed in the HUMAN project, which has received funding from the European Union's Horizon 2020 research and innovation programme under grant agreement no. 723737 (HUMAN)


Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.


1.0.0 by Felix Mannhardt, 2 months ago

Report a bug at

Browse source code at

Authors: Felix Mannhardt [aut, cre] , Gert Janssenswillen [ctb]

Documentation:   PDF Manual  

MIT + file LICENSE license

Imports bupaR, processmapR, rlang, magrittr, dplyr, tidyr, htmlwidgets, DiagrammeR, zoo, grDevices

Suggests eventdataR, edeaR, testthat, knitr, rmarkdown, shiny, RColorBrewer

See at CRAN