# Animated growing Mycelis Muralis

by NightElfik

Short link: http://malsys.cz/g/99ezF3si

### Comments

comments powered by Disqus### Source code

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | lsystem MycelisMuralis extends Branches { set symbols axiom = / I(13) F A(0); set iterations = 63; set interpretEveryIteration = true; set initialAngle = 90; set canvasOriginSize = {-24, 0, 54, 72}; set scale = 5; set autoTrim = true; // to optimize animation set margin = 0; set frameDelay = 35/100; set tropismVector = {0, -1, 0}; set tropismCoefficient = 2.2; // transparent bg to "hide" trimmed parts in some browsers set bgColor = #FF000000; set antiAlias = false; // to save animation size // following iterations do not change model set skipFollowingIterations = {0,2,3,4, 6,7, 9,10, 12,13, 15,16, 18,19, 21,22, 24,25}; set symbols contextIgnore = + / F W I K; interpret K(x) as lsystem Organ(x); interpret F as DrawForward(8, 1.5, #387700); interpret G as DrawForward(8, 1, #57B504); interpret + as TurnLeft(30); interpret / as Roll(180); rewrite {S} A to T V K(0); rewrite {V} A to T V K(0); rewrite A(t) where t > 0 to A(t-1); rewrite A(t) to M [ + G ] F / A(2); rewrite {S} M to S; rewrite S {T} to T; rewrite {T} G to F A(2); rewrite {V} M to S; rewrite T {V} to W; rewrite W to V; rewrite I(t) where t > 0 to I(t - 1); rewrite I to S; rewrite K(t) to K(t+1); } abstract lsystem Organ(age) extends Polygons { set symbols axiom = S; set iterations = 1; interpret K(x) as DrawCircle(x, #005500); interpret B(x) as lsystem Bloom(x, #FFFF00, 5); interpret P(x) as lsystem Seed(x, #BB4400); interpret f as MoveForward(4); interpret + as TurnLeft; rewrite S where age > 13 to <(#442211, 0) . [ +(30) f . ] [ +(-30) f . ] >; rewrite S where age > 8 to P(age - 8); rewrite S where age > 3 to B(age - 3); rewrite S to K(1 + age / 4); } abstract lsystem Bloom(age, color, leafCount) extends Polygons { let angle = 120 / leafCount; let size = 0.6 + age / 4; set symbols axiom = + leaf; set iterations = leafCount; interpret G as MoveForward(size); interpret + as TurnLeft(angle); interpret - as TurnLeft(-angle); interpret | as TurnLeft(180); rewrite leaf to +(360 / leafCount) [ <(color, size/8, darken(color,0.3)) . + G . - - G . + | + G . > ] leaf; } abstract lsystem Seed(age = 2, color = #AAAAAA) extends Polygons { set symbols axiom = <(color, 0) . + f . - - f . + X(7) [ F ] | + f . >; set iterations = age; let size = 1.5 + age / 4; interpret F as DrawForward(size * 0.8, 0.2, lighten(color,0.1)); interpret f as MoveForward(size); interpret + as TurnLeft(30); interpret - as TurnLeft(-30); interpret | as TurnLeft(180); rewrite X(a) to [+(a) F] [+(-a) F] X(a + 15); rewrite Y to Y ; } process all with AnimationRenderer; |

### Thumbnail extension

1 2 | process all with AnimationRenderer set scaleOutputToFit = {512, 256}; |