I'm working on a 2d drawing app. I'd like to make an effect where lines expand, like this:
This is for an animation where the lines expand and pop like balloons.
The lines are drawn as triangle strips. My idea is to make them expand by making each triangle larger in the vertex shader. Each vertex should be pushed away from the other vertices in the triangle.
To do this, I'd need to access the other vertices in the triangle. Is that possible in Metal?
vertex Vertex vertex_expand(device float2 *vertices [[buffer(0)]],
constant VertexUniforms *uniforms [[buffer(1)]],
uint vid [[vertex_id]]) {
// is vertices[vid - 1] and vertices[vid + 1] the previous and next vertices?
// is vid=0 the first vertex?
}