I am releasing Weekful, an app that shows your life in weeks. Its mascot is a pixel-art tree that has grown exactly as far as your life has: a sprout when you are a kid, an old crooked tree at the end.
In this post I will show you how the tree grows. There is more about the app itself at the end.
Three drawings
I am no pixel artist, so I wanted to draw as little as possible. The whole tree is three drawings on a 19×19 grid: a sprout, an adult tree and an old one.

They live right in the code as ASCII art, W for the wood and g for the leaves:
static let sprout = PixelGrid(art: """
...
.......g...........
........Wg.........
.......gW..........
.........Wg........
........W..........
""")
Everything between the drawings has to be computed. My first attempt was a simple cross-fade and it looked terrible, more like a slideshow than a tree. A tree does not fade in as a whole. It grows up from the ground, gets thicker, and the leaves follow the branches.
The idea
The trick is to decide, for every pixel of a drawing, when it should appear. I call it the growth time of the pixel: a number from 0 (appears right at the start) to 1 (appears last). Once every pixel has its growth time, the animation is simple: as the progress goes from 0 to 1, each pixel fades in when its time comes.
So the whole problem is giving the pixels the right order. I wanted the order a real tree would follow:
- Height first. A thin line of wood grows from the ground up to the tip of every branch.
- Thickness second. The trunk and the branches get thicker, starting at the base.
- Leaves follow the wood. The leaves closest to a branch appear first, then the crown spreads outward.
And one extra rule for going from one drawing to the next: a pixel that is no longer in the next drawing does not just vanish, it leaves when a new pixel appears next to it.
That is all. The rest of the post goes through these steps in more detail.
Height first: the skeleton
To grow the wood from the ground up, I first need to know how far from the ground each wood pixel is. Not in a straight line, but along the wood, the way the sap would travel.
This is a classic flood fill. I start at the lowest wood pixel and give it the number 0. Its wood neighbours get 1, their neighbours 2, and so on until every wood pixel has a number. In the code the number is called depth:
// queue starts with the root pixel, where depth is 0
while !queue.isEmpty {
let pixel = queue.removeFirst()
for neighbour in woodNeighbours(of: pixel) where depth[neighbour] == nil {
depth[neighbour] = depth[pixel]! + 1
queue.append(neighbour)
}
}
Now I can find the branch tips: wood pixels that have no neighbour with a higher depth. From the tip with the highest depth I walk back down to the root, always stepping to a neighbour with a lower depth. That path is the main spine of the tree. Every other tip then walks down until it meets a path that already exists.
The result is a one pixel wide skeleton of the whole tree. Here it is in pink for the adult and the old tree:

The skeleton pixels are the first to appear. Each one gets its growth time from its distance from the root, measured along the skeleton: the root is 0, the farthest tip is 0.6. So after 60 % of the animation the tree has its full height and all its branches, but everything is just one pixel wide.
Measuring along the skeleton matters. A branch that runs sideways grows outward pixel by pixel, instead of popping in as a whole row.
Thickness second
The wood pixels that are not on the skeleton share the remaining 40 %, the growth times from 0.6 to 1. They are sorted by two things: pixels near the ground go before pixels high up, and pixels touching the skeleton go before the ones further out.
One more rule makes it look right: bark only grows onto bark that is already there. A pixel is never allowed to appear before the pixel between it and the skeleton.
Leaves follow the wood
For the leaves I run the same flood fill once more, this time starting from all the wood pixels at once and spreading through the leaf pixels. A leaf touching the wood gets 1, the leaf behind it 2, and so on. I call this number the ring of the leaf.
While spreading, every leaf also remembers woodTime: the growth time of the wood pixel it hangs off. The growth time of a leaf is then the later of two candidates:
let evenly = Double(ring) / Double(outermostRing) // rings spread over the whole growth
let afterWood = woodTime + Double(ring) * smallDelay // but never before the branch is there
growthTime[leaf] = max(evenly, afterWood)
The first line makes the crown get wider steadily during the whole growth. The second one guarantees that no leaf hangs in the air waiting for its branch.
Here are the final growth times of the adult and the old tree. The brighter the pixel, the sooner it appears:

You can see the bright skeleton, the darker bark around it and the leaves getting darker towards the edge of the crown.
From one drawing to the next
The growth times are computed for every drawing. To grow from one drawing (the source) to the next (the target), I compare them pixel by pixel. With t as the progress between the two drawings, from 0 to 1, each pixel gets its opacity:
switch (isInSource, isInTarget) {
case (false, true): // a new pixel: fades in when its growth time comes
alpha = clamp((t - growthTime[pixel]) / fadeDuration)
case (true, true): // in both drawings: just stays
alpha = 1
case (true, false): // only in the old drawing: fades out
alpha = 1 - clamp((t - leaveTime[pixel]) / fadeDuration)
case (false, false): // empty in both
continue
}
clamp keeps the value between 0 and 1, so a pixel is invisible before its growth time, then fades in during a short fadeDuration and stays fully visible.
The leaveTime is the extra rule from the beginning. The old tree is not just a bigger adult tree, some pixels have to go. Each of them looks for the nearest new pixel and takes its growth time as its own leaveTime. One pixel fades out while its neighbour fades in, and it reads as if the pixel moved there.
And this is the growth from the sprout to the adult tree:

The last thing is to place the drawings in time. The sprout is complete at 20 % of the life, the adult tree at 60 % and the old tree at 100 %, so the tree looks adult for most of the adult years.
Draw it
Rendering is the easy part. The tree is a single Canvas, and the view is Animatable, so growing a whole life is just one withAnimation call. Simplified:
struct PixelTreeView: View, Animatable {
/// 0 = birth, 1 = end of expected life
var progress: Double
var animatableData: Double {
get { progress }
set { progress = newValue }
}
var body: some View {
Canvas { context, size in
for pixel in model.pixels(at: progress) {
context.opacity = pixel.alpha
context.fill(Path(rect(for: pixel, in: size)), with: .color(pixel.color))
}
}
}
}
All the growth times are computed once, so pixels(at:) is just a loop over 361 pixels. A nice bonus: the same view draws the Home Screen widget. Widgets cannot animate like this, so there it uses a fixed time value.
About the app
The tree lives in Weekful, and here is its launch video:
I started Weekful in the summer of 2025 as my intended entry to Shipaton, the RevenueCat hackathon. In a few evenings I had the core idea, the onboarding and a couple of tree-like widgets. And then, as you can guess, the deadline passed, life happened and the project went to the drawer where all my side projects live.
This autumn, when Shipaton 2026 had just ended, I realized that a full year had passed and my entry for the previous one was still not finished. So I cut the scope down to an MVP and went for it.
The lesson I took from it: finish your side projects and publish more. Weekful is not perfect, but an MVP in the store beats a perfect app that nobody can download.
If you would like to see your own tree, get Weekful on the AppStore. And let me know what you think on Twitter!