每当我在闪亮的状态下渲染Giganimate gif时,都将出现空白

时间:2019-02-03 01:58:11

标签: r shiny gganimate

我建立具有曲棍球应用程式gganimate生成的动画,如图如下:

enter image description here

这是与相关的用户界面:

## UI----
ui <- fluidPage(

  titlePanel(tagList(
    img(src = "nhl-logo.png", height = 60, width = 60),
    "PLAY-BY-PLAY"),
    windowTitle = "NHL Play-by-Play"),

  hr(),

  fluidRow(
    column(7,
           imageOutput("anim")
           ),
    column(5,
           DT::dataTableOutput("game_id_table"))

    ),

和服务器:

  anim_test <- pbp_processed() %>% 
      mutate(event_frame = seq_along(event_index)) %>%
      ungroup() %>% 
      ggplot(aes(coords_x, coords_y, group = event_index)) +
      annotation_custom(rink, -100, 100, -45, 45) +
      annotation_raster(away_team_logo_alpha, ymin = -20, ymax = 18, xmin = -62, xmax = -25) +
      annotation_raster(home_team_logo_alpha, ymin = -20, ymax = 18, xmin = 27, xmax = 65) +
      geom_point(size = input$puck_size, color = "darkblue") +
      coord_fixed() +
      xlim(-100, 100) +
      ylim(-45, 45) +
      theme_nothing() +
      theme(plot.title = element_text(hjust = 0.5),
            plot.subtitle = element_text(hjust = 0.5)) +
      ggtitle(paste0(away_team, " vs ", home_team, "\n", game_date),
              subtitle = "Frame: {frame} / {nframes}") +
      labs(caption = "Rink: WAR On Ice\nData: Corsica Hockey") +
      transition_components(time=event_frame) +
      shadow_null() +
      NULL


    anim_save("outfile.gif", animate(anim_test, fps = input$anim_speed)) # New

    # Return a list containing the filename
    list(src = "outfile.gif",
         contentType = 'image/gif',
         width = "600px",
         height = "400px"
         # alt = "This is alternate text"
    )

pbp_processed是用于制备本动画数据集。 这是rink

enter image description here

基本上,I anim_save动画作为.gif,然后返回包含了文件名的列表(outfile.gif

我不知道为什么有那么多白周围的溜冰场(动画)的空间,如溜冰场在该应用程序...

该图像文件中看到

enter image description here

0 个答案:

没有答案