Where and When

Strands take coordinates and return values, but where do the coordinates actually come from? Your code describes what should exist at any point—something needs to supply the “any point.”

The me bundle

The me bundle provides the render context: where and when you are. When WEFT evaluates your code at each output point, me tells you which point you’re at.

What’s available in me depends on what backend you’re rendering to. Here are the built-in coordinates:

CoordinateDescriptionBackends
me.xHorizontal position (0 to 1)Visual
me.yVertical position (0 to 1)Visual
me.wCanvas width in pixelsVisual
me.hCanvas height in pixelsVisual
me.tTime in secondsVisual, Audio
me.iSample indexAudio
me.sampleRateSamples per secondAudio

The me coordinates are still in progress and subject to change

Backends can define their own coordinates beyond these. A 3D backend might provide me.z for depth, or me.vertex and me.normal for mesh rendering. The set of coordinates expands with the domains WEFT can talk to.

Every strand is a coordinate

The values in me are strands, which means they output numbers. But all strands output numbers. So any strand can be used as a coordinate—not just the ones in me.

When we said you can “use audio loudness to displace pixels,” this is how it works. An audio strand outputs a number. You use that number wherever you’d use a coordinate. There’s nothing special about me.x compared to any other strand; they’re all just numbers flowing through your program.

You can also build your own coordinate systems from the primitives. If you’re making music and want to think in beats:

beat.num = floor(me.t * bpm / 60)

Or if polar coordinates make more sense for what you’re building:

radius.val = sqrt((me.x - 0.5)^2 + (me.y - 0.5)^2)
angle.val = atan2(me.y - 0.5, me.x - 0.5)

You’re not stuck with what me gives you. The raw context is just a starting point—define whatever coordinates fit your problem, or pull them from other signals entirely. This is why different media can mix so freely: at the end of the day, everything is just numbers, and numbers can flow anywhere.