GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — libprocessing/examples/transforms.rs at python-particle-api · processing/libprocessing Expand file tree/ Copy pathtransforms.rsMore file actions 80 lines (64 loc) · 2.3 KB / Copy pathtransforms.rsFile metadata and controls80 lines (64 loc) · 2.3 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 use processing_glfw::GlfwContext; use bevy::math::{Vec2, Vec3}; use processing::prelude::*; use processing_render::render::command::DrawCommand; use std::f32::consts::PI; fn main() { sketch().unwrap(); exit(0).unwrap(); } fn sketch() -> error::Result<()> { let mut glfw_ctx = GlfwContext::new(400, 400, false)?; init(Config::default())?; let surface = glfw_ctx.create_surface(400, 400, false)?; let graphics = graphics_create(surface, 400, 400, TextureFormat::Rgba16Float)?; let mut t: f32 = 0.0; while glfw_ctx.poll_events() { graphics_begin_draw(graphics)?; graphics_record_command( graphics, DrawCommand::BackgroundColor(bevy::color::Color::srgb(0.1, 0.1, 0.1)), )?; for i in 0..4 { for j in 0..4 { graphics_record_command(graphics, DrawCommand::PushMatrix)?; graphics_record_command( graphics, DrawCommand::Translate( Vec2::new(50.0 + j as f32 * 100.0, 50.0 + i as f32 * 100.0).extend(0.0), ), )?; let angle = t + (i + j) as f32 * PI / 8.0; graphics_record_command( graphics, DrawCommand::Rotate { angle, axis: Vec3::Z, }, )?; let s = 0.8 + (t * 2.0 + (i * j) as f32).sin() * 0.2; graphics_record_command(graphics, DrawCommand::Scale(Vec2::splat(s).extend(1.0)))?; let r = j as f32 / 3.0; let g = i as f32 / 3.0; graphics_record_command( graphics, DrawCommand::Fill(bevy::color::Color::srgb(r, g, 0.8)), )?; graphics_record_command( graphics, DrawCommand::Rect { x: -20.0, y: -20.0, w: 40.0, h: 40.0, radii: [0.0; 4], }, )?; graphics_record_command(graphics, DrawCommand::PopMatrix)?; } } graphics_end_draw(graphics)?; t += 0.02; } Ok(()) } |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |