@import url('https://fonts.googleapis.com/css2?family=Marck+Script&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Marck+Script&family=Oleo+Script&display=swap');
body {
  background-color: lightblue;
  font-size: 20px;
  font-family: 'Marck Script';
}
h2 {
  font-family: 'Oleo Script', cursive;
}

My Meme

I often write notes for all my courses and I’ve recently found problems with paper notes getting lost and disorganised. This meme represents the process I went through as I slowly found better methods for writing more effective notes.

```r
library(magick)
# I had to use mediocre images to not break copyright restrictions. I previously had better images but quickly replaced them and rescaled them because of copyright
#because this was a lot of different images, and every change to my images was done using pipes, most of this is just adding images and sorting them out.

#creating first row
#creating the text box
paper_text <- image_blank(200, 50, "#000000") %>%
  image_annotate("Paper Notes", color = "#FF7A00", size = 20, font = "Impact", gravity = "center")

#creating the image of the notetaking method
paper_image <- image_read("images/paper_notes.jpg")  %>%
  image_scale("200")

#stacking image under description
paper_stack <- image_append(c(paper_text, paper_image), stack = TRUE)

#adding comparison image
dumb_brain <- image_read("images/dumb_face.jpg") %>%
  image_scale("207")

#combining notetaking method with comparison image (intelligence meter)
paper_vector <- image_append(c(paper_stack, dumb_brain))


#creating second row follows same steps as first row
computer_text <- image_blank(200, 50, "#000000") %>%
  image_annotate("Computer Notes", color = "#FF7A00", size = 20, font = "Impact", gravity = "center")

computer_image <- image_read("images/computer_notes.jpg") %>%
  image_scale("200")

computer_stack <- image_append(c(computer_text, computer_image), stack = TRUE)

thinking_brain <- image_read("images/thinking_brain.jpg") %>%
  image_scale("207") %>%
  image_scale("207x173!")# scaling it so the image fits in nicely which it doesn't do naturally

computer_vector <- image_append(c(computer_stack, thinking_brain))


#creating third row follows same steps as first row
tablet_text <- image_blank(200, 50, "#000000") %>%
  image_annotate("Tablet Notes", color = "#FF7A00", size = 20, font = "Impact", gravity = "center")

tablet_image <- image_read("images/tablet_notes.jpg")  %>%
  image_scale("200") %>%
  image_resize("200x150!")

tablet_stack <- image_append(c(tablet_text, tablet_image), stack = TRUE)

galaxy_brain <- image_read("images/galaxy_brain.jpg") %>%
  image_crop("640x640+160") %>%
  image_scale("207")

tablet_vector <- image_append(c(tablet_stack, galaxy_brain))


#creating last row follows same steps as first row
memorised_text <- image_blank(200, 50, "#000000") %>%
  image_annotate("Memorised notes", color = "#FF7A00", size = 20, font = "Impact", gravity = "center")

memorised_notes <- image_read("images/memorised_notes.jpg") %>%
  image_scale("200")

beyond_galaxy_brain <- image_read("images/beyond_galaxy_brain.jpg") %>%
  image_crop("400x300+75") %>% #cropping early because I already had decided on my scale and I wanted the graphic.
  image_scale("207")
  
memorised_stack <- image_append(c(memorised_text, memorised_notes), stack = TRUE)
memorised_vector <- image_append(c(memorised_stack, beyond_galaxy_brain))

#creating the final meme
final_product <- image_append(c(paper_vector, computer_vector, tablet_vector, memorised_vector), stack = TRUE)
final_product
image_write(final_product, "final_meme/my_meme.png")
```

My Animation

I watch a lot of videos and anime, so I thought I would create an animation with a story. In this short sequence, we see a wizard cast a spell but it backfires, turning him into a frog. I used this idea because it’s a reasonably simple scenario but I could use the different tools from the magick package (like the mosaic and the kernel convolution functions.)
```r
library(magick)

#importing images
wizard <- image_read("gif_images/wizard.jpg")
frog <- image_read("gif_images/frog.jpg")
magic_book <- image_read("gif_images/magic_book.jpg")
lightning <- image_read("gif_images/lightning.jpg")
particles <- image_read("gif_images/glitter.png")

#rotate the wizard so he faces the book and scales him so he works in the image
used_wizard <- image_flip(wizard) %>%
  image_rotate(180) %>%
  image_scale(150)

# creating an image of particles to indicate the spell is in play, had to scale them to make it more compact
particles <- image_scale(particles, "200") %>%
  image_crop("120x190")

#overlaying book and particles for future frames.
book_particles <- image_composite(magic_book, particles, offset = "+0+125")

#creating the frames of the animation
frame1 <- image_composite(magic_book, used_wizard, offset = "+0+150")
frame2 <- image_composite(book_particles, image_convolve(used_wizard), offset = "+0+150")
frame3 <- image_convolve(frame2, 'Sobel')
frame4 <- image_composite(frame2, image_scale(lightning, 200), offset = "+0+100")
frame5 <- image_convolve(frame4, 'Sobel')
frame6 <- image_composite(book_particles, image_scale(frog, 100), offset = "+0+190")
frame7 <- image_convolve(frame7, "Sobel")
frame8 <- image_composite(magic_book, image_scale(frog, 100), offset = "+0+190")

#creating the animation
frames <- c(frame1, frame2, frame3, frame4, frame5, frame6, frame7, frame8)
image_animate(frames, fps=2) %>%
  image_write("my_animation.gif")

#playing the animation (just for me)
image_animate(frames, fps = 2)
```