Google Classroom
GeoGebraGeoGebra Classroom

Koch fractal animated tiling

Script

K = Slider(1, 10, 1, 1, 160, false, true, false, false) k = Slider(1, 10, 0.01, 1, 160, false, true, false, false) T = Slider(0, 1, 0.01, 4, 160, false, true, false, false) d = Slider(0, 10, 0.01, 1, 160, false, true, false, false) L = Join({0}, Sequence(k, k, 1, 6*K-1) ) size = Length(L) #Define transition f(x) = x^k/(x^k + (1-x)^k) #The next function is just to change motion g(x) = x #g(x) = 1/2(sin(pi/2 cos(x))+1) #Define centres functions Fx(x, y, z) = x * sin( pi/3 *( y + (-1)^(floor(y/6)) * f(g(z)) ) ) / ( 3^(-g(z) + floor(y/6)) ) Fy(x, y, z) = x * cos( pi/3 *( y + (-1)^(floor(y/6)) * f(g(z)) ) ) / ( 3^(-g(z) + floor(y/6)) ) #as vectors Vec = Sequence(Vector( (0, 0), (Fx(d, Element(L, k), T), Fy(d, Element(L, k), T)) ), k, 1, Length(L)) #as points C = Sequence((x(Element(Vec, k)), y(Element(Vec, k))), k, 1, Length(L)) #Define rotation function G(x, y) = f(g(x)) * pi / 3 * (-1)^(floor(y/6)) #Define dilatation function H(x, y) = 1/3^(-g(x) + floor(y/6)) #Make lists: Sequence(, k, 1, Length(L)) #Step 1 translation K_0 = Sequence( Translate( pic1, Element(Vec, k) ), k, 1, Length(L) ) #Step 2 dilatation K_1 = Sequence( Dilate( Element(K_0, k), H(T, Element(L, k)), Element(C, k) ), k, 1, Length(L)) #Step 3 rotation K_2 = Sequence( Rotate( Element(K_1, k), G(T, Element(L, k)), Element(C, k) ), k, 1, Length(L)) SetVisibleInView(K_2, 1, false) SetVisibleInView(K_2, 2, true)
Also check this other version using the Zip() command https://www.geogebra.org/m/h4qhfrtn by Thijs