library(gifski)
x <- c(rep(-2,500),seq(-2,-1, length.out = 1000),rep(-1,250),seq(-1,-2, length.out = 1000),
rep(0,500),seq(0,1,length.out=1000), rep(1,500))
y <- c(seq(-1,1,length.out=500), seq(1,0.5,length.out=1000), seq(0.5,-0.5,length.out=250),seq(-0.5,-1,length.out=1000),
seq(-1,1,length.out=500),rep(0,1000), seq(-1,1,length.out=500))
z <- rbind(x,y)
plot(y~x, xlim=c(-3,3), ylim=c(-3,3), col = "turquoise",
main = "My Initials")
x11()
for (val in seq(-2,2,length.out=50)) {
shear_matrix <- matrix(c(2, 0, val, 1), nrow=2, ncol=2)
shear <- apply(z, 2, function(x) x %*% shear_matrix)
plot(shear[2,] ~ shear[1,], xlim=c(-8, 8), ylim=c(-8, 8), col = "turquoise",
main = "Shear")
Sys.sleep(0.05)
}
x11()
for (val in seq(1,3,length.out=50)) {
scale_matrix <- matrix(c(val, 0, 0, val), nrow=2, ncol=2)
scale <- apply(z, 2, function(x) x %*% scale_matrix)
plot(scale[2,] ~ scale[1,], xlim=c(-8,8), ylim=c(-8,8), col = "turquoise",
main = "Scale")
Sys.sleep(0.05)
}
x11()
for (val in seq(-3,3,length.out=50)) {
rotation_matrix <- matrix(c(cos(val), -sin(val), sin(val), cos(val)), nrow=2, ncol=2)
rotate <- apply(z, 2, function(x) x %*% rotation_matrix)
plot(rotate[2,] ~ rotate[1,], xlim=c(-8,8), ylim=c(-8,8), col = "turquoise",
main = "Rotate")
Sys.sleep(0.05)
}
x11()
for (val in seq(-3,3,length.out=50)) {
projection_matrix <- matrix(c(val,0,0,1), nrow=2, ncol=2)
projection <- apply(z, 2, function(x) x %*% projection_matrix)
plot(projection[2,] ~ projection[1,], xlim=c(-8,8), ylim=c(-8,8), col = "turquoise", main = "Projection")
Sys.sleep(0.05)
}