Skip to content

Commit

Permalink
added example for star and polygon
Browse files Browse the repository at this point in the history
  • Loading branch information
Nazariglez committed Nov 1, 2022
1 parent a91b3c7 commit 4f9165c
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 88 deletions.
4 changes: 2 additions & 2 deletions crates/notan_draw/src/shapes/polygon.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use super::path::Path;
use super::tess::TessMode;
use crate::builder::DrawProcess;
use crate::draw::{Draw, ShapeInfo};
use crate::draw::Draw;
use crate::transform::DrawTransform;
use crate::{DrawBuilder, DrawShapes};
use notan_graphics::color::Color;
use notan_graphics::pipeline::BlendMode;
use notan_math::{vec3, Mat3};
use notan_math::Mat3;
use std::f32::consts::PI;

pub struct Polygon {
Expand Down
2 changes: 1 addition & 1 deletion crates/notan_draw/src/shapes/star.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use super::path::Path;
use super::tess::TessMode;
use crate::builder::DrawProcess;
use crate::draw::{Draw, ShapeInfo};
use crate::draw::Draw;
use crate::transform::DrawTransform;
use crate::{DrawBuilder, DrawShapes};
use notan_graphics::color::Color;
Expand Down
82 changes: 0 additions & 82 deletions examples/draw_path_polygons.rs

This file was deleted.

33 changes: 30 additions & 3 deletions examples/draw_shapes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,45 @@ fn draw(gfx: &mut Graphics) {
.color(Color::YELLOW);

draw.rect((500.0, 100.0), (200.0, 150.0))
.color(Color::GREEN);
.fill_color(Color::GREEN)
.fill()
.stroke_color(Color::WHITE)
.stroke(15.0);

draw.ellipse((400.0, 300.0), (50.0, 100.0))
.color(Color::RED)
.rotate_degrees(-45.0);

draw.circle(40.0).position(600.0, 450.0).color(Color::BLUE);
draw.circle(40.0)
.position(600.0, 450.0)
.fill_color(Color::BLUE)
.fill()
.stroke_color(Color::WHITE)
.stroke(5.0);

draw.rect((100.0, 400.0), (150.0, 100.0))
draw.rect((100.0, 250.0), (150.0, 100.0))
.corner_radius(20.0)
.color(Color::ORANGE)
.stroke(15.0);

draw.star(10, 80.0, 40.0)
.position(150.0, 480.0)
.fill_color(Color::PINK)
.fill()
.stroke_color(Color::PURPLE)
.stroke(6.0);

draw.polygon(5, 50.0)
.position(350.0, 150.0)
.color(Color::WHITE)
.stroke(8.0);

draw.polygon(8, 80.0)
.position(350.0, 450.0)
.fill_color(Color::WHITE)
.fill()
.stroke_color(Color::ORANGE)
.stroke(8.0);

gfx.render(&draw);
}

0 comments on commit 4f9165c

Please sign in to comment.