Skip to content

Commit

Permalink
rect angle
Browse files Browse the repository at this point in the history
  • Loading branch information
juliapaci committed Aug 8, 2024
1 parent 55e9005 commit 83d9584
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/rect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ impl Vector for VelloRect {
}

fn border_translation(&self, time: f64) -> DVec2 {
let t = time * 4.;
let t = time * 4.0;
let time = t.ceil() as u64;
let t = t % 1.0;

Expand All @@ -84,6 +84,17 @@ impl Vector for VelloRect {
}

fn border_rotation(&self, time: f64) -> f64 {
self.border_translation(time).to_angle()
let diff =
self.border_translation(time) - self.border_translation((4.0 * time).floor() / 4.0);

if diff.y > 0.0 {
0.0
} else if diff.y < 0.0 {
std::f64::consts::TAU
} else if diff.x > 0.0 {
std::f64::consts::PI
} else {
3.0 * std::f64::consts::FRAC_2_PI
}
}
}

0 comments on commit 83d9584

Please sign in to comment.