use std::f32::consts::PI; use bevy::prelude::Vec2; use bevy_prototype_lyon::prelude::{Path, PathBuilder}; pub fn turtle() -> Path { let polygon = &[ [-2.5f32, 14.0f32], [-1.25f32, 10.0f32], [-4.0f32, 7.0f32], [-7.0f32, 9.0f32], [-9.0f32, 8.0f32], [-6.0f32, 5.0f32], [-7.0f32, 1.0f32], [-5.0f32, -3.0f32], [-8.0f32, -6.0f32], [-6.0f32, -8.0f32], [-4.0f32, -5.0f32], [0.0f32, -7.0f32], [4.0f32, -5.0f32], [6.0f32, -8.0f32], [8.0f32, -6.0f32], [5.0f32, -3.0f32], [7.0f32, 1.0f32], [6.0f32, 5.0f32], [9.0f32, 8.0f32], [7.0f32, 9.0f32], [4.0f32, 7.0f32], [1.25f32, 10.0f32], [2.5f32, 14.0f32], ]; let mut turtle_path = PathBuilder::new(); turtle_path.line_to(Vec2::new(1.0, 1.0)); turtle_path.line_to(Vec2::new(-1.0, 1.0)); turtle_path.line_to(Vec2::new(-1.0, -1.0)); turtle_path.line_to(Vec2::new(1.0, -1.0)); turtle_path.close(); turtle_path.move_to(Vec2::new(0.0, 16.0).rotate(Vec2::from_angle(-PI / 2.))); for coord in polygon { turtle_path.line_to(Vec2::from_array(*coord).rotate(Vec2::from_angle(-PI / 2.))); } turtle_path.close(); turtle_path.build() }