1#import bevy_sprite::mesh2d_vertex_output::VertexOutput 3@group(#{MATERIAL_BIND_GROUP}) @binding(0) var<uniform> frame: vec4<f32>; 5@group(#{MATERIAL_BIND_GROUP}) @binding(1) var<uniform> anchor: vec4<f32>; 8fn fragment(_in: VertexOutput) -> @location(0) vec4<f32> { 11 let current_world_x = anchor.z + frame.z; 12 let previous_world_x = anchor.z + frame.w; 13 let current_ndc_x = 2.0 * (current_world_x - frame.x) / anchor.w; 14 let previous_ndc_x = 2.0 * (previous_world_x - frame.y) / anchor.w; 15 let current_ndc = vec2<f32>(current_ndc_x, 0.0); 16 let previous_ndc = vec2<f32>(previous_ndc_x, 0.0); 19 let raw_motion = (current_ndc - previous_ndc) * vec2<f32>(0.5, -0.5); 20 let motion = select(raw_motion, vec2(0.0), raw_motion == vec2(0.0)); 21 return vec4<f32>(motion, 0.0, 1.0);