Rstats
Animation
Author

George Girton

Published

September 27, 2023

Wings away

Butterfly disappears

These butterfly frames come from what the phone says is a 4K movie … this is just part of the frame, but even so, the weight of each picture is greater, so this might take a bit longer to load.

Click button at right or left to advance by frame:

Code
library(slickR)
## Using the slickR package, which wraps a javascript carousel library slick

butterfly_frame_filenames <- list.files("frames/", pattern=".jpg", full.names = TRUE)

slickR(butterfly_frame_filenames, height = 250, width='80%') +
  settings(dots = TRUE,
  infinite= TRUE,
  speed = 0,
  fade = TRUE,
  cssEase = 'linear')

Butterfly, the movie

  • First, edit the endpoints, the “In” and the “Out”. Drag them in to make fewer frames.
  • Then “save as movie” from the “dot-dot-dot”menu in the photos app on the phone.
  • Make a publish folder called “OrangeButterfly” in the ‘posts’ folder of this Quatro blog
  • use a previous working folder (here named “movieHummingbirdRest” in my ‘repos’ folder).
  • Within ‘movieHumingbirdRest’ use a subfolder previously named ‘moviesHere’
  • put the OrangeButterfly.mov movie into ‘moviesHere’!

Here’s the code below for exporting the frames. (Run interactively in R Studio, it isn’t part of this live Quarto page.)

``` {{r}}
library(magick)

#install.packages("av")
library(av)
library(magick)
library(here)     

OBfly <- magick::image_read_video("movieHere/OrangeButterfly.mov", fps=NULL)

#Reference:
#https://www.r-bloggers.com/2020/08/basic-manipulation-of-gif-frames-with-magick/

holderfolder <- "bframes/"

dir.create(here(holderfolder))  ## make the butterfly frames folder

for(i in 1: length(OBfly)) {
  zeropadnum <- sprintf("%03i",i)
  eachname = paste0("OBfly",zeropadnum,".jpg")
  magick::image_write(frame,path=paste0(holderfolder,eachname))
}


```

Summary:

  • Take a live photo

  • transfer it to video

  • think up good folder names for your repo and your post

  • process it to frames

  • Re-do it (in case you have to)

  • Clip a still photo out of there and put it in your publish folder

  • Do it again!

— all photos Copyright © 2022-2024 George D Girton all rights reserved