-
Notifications
You must be signed in to change notification settings - Fork 10
Animations
Michael Sumner edited this page Sep 23, 2020
·
2 revisions
https://twitter.com/mdsumner/status/1308774083010547712?s=20
library(silicate)
library(anglr)
library(gganimate)
data("wrld_simpl", package = "maptools")
mesh <- DEL0(wrld_simpl, max_area = 0.8)
d <- sc_vertex(mesh)[c(t(as.matrix(do.call(rbind, mesh$object$topology_)[c(".vx0", ".vx1", ".vx2")]))), ]
d$triangle <- rep(seq_len(nrow(d)/3), each = 3)
d$distance <- traipse::track_distance_to(d$x_, d$y_, 147, -42)
d[c("X", "Y")] <- reproj::reproj(d[1:2], "+proj=moll")[, 1:2]
ggplot(d) + geom_polygon(aes(X, Y, group = triangle, fill = -distance)) + scale_fill_viridis_c() + coord_equal() +
transition_reveal(-distance)
mesh
# class : DEL0
# type : Primitive
# vertices : 35734 (2-space)
# primitives : 45313 (2-space)
# crs : +proj=longlat +ellps=WGS84 +towgs84=0,0,0,0,0,0,0 +no_defs