Created
September 14, 2023 15:49
-
-
Save wchargin/6a4bb941fae99d6eb04bbf8da0eb46d9 to your computer and use it in GitHub Desktop.
qqlrs animation schedule patch to slow down around larger rings
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/art.rs b/src/art.rs | |
index 97a18d1..cf2b600 100644 | |
--- a/src/art.rs | |
+++ b/src/art.rs | |
@@ -1646,12 +1646,30 @@ pub fn draw<F: FnMut(Frame)>( | |
let batch_sizes = match config.animate { | |
Animation::None => None, | |
Animation::Groups => Some(group_sizes.0), | |
- Animation::Points { step } => { | |
- let step = step as usize; | |
- let (n_groups, remainder) = (num_points / step, num_points % step); | |
- let mut result = vec![step; n_groups]; | |
- if remainder > 0 { | |
- result.push(remainder); | |
+ Animation::Points { step: _ } => { | |
+ let mut result = Vec::new(); | |
+ let mut area = 0.0; | |
+ let mut group = 0; | |
+ for point in points.0.iter() { | |
+ area += point.scale * point.scale; | |
+ group += 1; | |
+ if area >= 5_000.0 || group >= 50 { | |
+ println!("frame: group={}, area={}", group, area); | |
+ result.push(group); | |
+ if area >= 10_000.0 { | |
+ result.push(0); | |
+ result.push(0); | |
+ result.push(0); | |
+ } | |
+ if area >= 5_000.0 { | |
+ result.push(0); | |
+ } | |
+ area = 0.0; | |
+ group = 0; | |
+ } | |
+ } | |
+ if group > 0 { | |
+ result.push(group); | |
} | |
Some(result) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment