"Koch Snowflake Animation
'Initial triangle coordinates
#def a$ = sqrt(3)/2
x = [0; 1; 0.5; 0]', 'y = [0; 0; a$; 0]
'Number of iterations -'n = 6

#val
'<style>polygon{display:none; stroke:none;}</style> 
#hide 
w = 300', 'h = 1.2*w', 'k = 100
#show
'<svg viewbox="0 10 'k' 'k'" style="width:'w'pt; height:'h'pt">
'<defs><radialGradient id="sff" cx="50%" cy="50%"><stop offset="0%" stop-color="lightCyan"/><stop offset="70%" stop-color="lightBlue"/><stop offset="120%" stop-color="#8ac8df"/></defs>
#for i = 1 : n
	#hide
	n_p = len(x)
	#show
	'<polygon id="fr-'i'" points="
	#for j = 1 : n_p
		x.j*k','(a$ - y.j)*k' '
	#loop
	'" fill="url(#sff)" fill-opacity="0.6"/>
	#hide
	x1 = [x.1]', 'y1 = [y.1]
	'Iterate over the segments
	#for j = 1 : n_p - 1
		p1 = [x.j; y.j]'- the first point of the current segment
		p2 = [x.(j + 1); y.(j + 1)]'- the second point
		Δ = p2 - p1'- difference
		'Add three intermediate points
		A = p1 + Δ/3
		B = p1 + Δ/2 + [Δ.2; -Δ.1]*a$/3
		C = p1 + Δ*2/3
		'Build new vectors by concatenation
		x1 = [x1; A.1; B.1; C.1; p2.1]
		y1 = [y1; A.2; B.2; C.2; p2.2]
	#loop
	'Reassign to the original vectors
	x = [x1; p2.1]
	y = [y1; p2.2]
	#show
#loop
'</svg>
'<script>var i='1';f=$("#fr-1");f.show(950);setInterval(function(){if(++i>'n'){i=1;$("polygon:not(#fr-1)").hide(500);}f=$("#fr-"+i);f.show(950);},'1000');</script>