Components / RuleOfThirdsGrid

RuleOfThirdsGrid

Composition lines over a picture: thirds, divisions, squares or the golden ratio.

Example

The component itself, running in WebAssembly, beside its code in a playground. Try it.

Code

use ravenrs::prelude::*;

fn rule_of_thirds_grid() -> impl View {
    let picture = Canvas::new(|frame, scene| {
        // ravenrs-lint: allow(raw_color) the sky of the stand-in photograph the grid is laid over
        let sky = LinearGradient::vertical(Color::rgb(0.3, 0.45, 0.7), Color::rgb(0.85, 0.6, 0.45));
        scene.push_quad(Quad::new(frame, sky));
    })
    .size(300.0, 170.0);
    RuleOfThirdsGrid::new().guide(CompositionGuide::GoldenRatio).stage(picture)
}

Open in the playground, with every example →

Full API of RuleOfThirdsGrid →