T49: round 1 fix: a change of mood, though the act stays as inside a wink, and a press each ease her from the pose she was in, where a mood that changed mid-hop dropped her 12 points and an old finish cleared mid-glance snapped her eyes back; her brows ease with her
CI / platforms (ubuntu-24.04) (push) Successful in 1m16s
CI / platforms (windows-latest) (push) Successful in 1m52s
CI / macos (push) Successful in 16m9s

This commit is contained in:
ZacharyZhang-NY committed 2026-10-18 14:49:34 -04:00
1 parent 9d9144f25e
commit a9be8ab8c4
6 files changed
+112 -20

No files matched your search

+6 -4
View File
@@ -119,7 +119,8 @@ pub struct Pose {
pub mouth: Mouth,
/// The mouth's size, which pops as it changes.
pub pop: f32,
pub brows: bool,
/// How much her worried brows show.
pub brows: f32,
pub flush: f32,
/// Each hand pressed down, left then right.
pub hands: [f32; 2],
@@ -148,7 +149,7 @@ pub fn pose(mood: Mood, held: f64, shown: f64, petted: Option<f64>) -> Pose {
pose
}
/// `to`, `since` seconds after a change of act, eased from `from`, her last pose before it: her place and her moves blend, the marks `to` lacks fade, and the shapes are `to`'s.
/// `to`, `since` seconds after a change of act or mood, or a press, eased from `from`, her pose then: her place, her moves and her brows blend, the marks `to` lacks fade, and the shapes are `to`'s.
pub fn blend(from: &Pose, to: Pose, since: f32) -> Pose {
let k = smooth((since / EASE).clamp(0.0, 1.0));
let mix = |a: f32, b: f32| a + (b - a) * k;
@@ -168,6 +169,7 @@ pub fn blend(from: &Pose, to: Pose, since: f32) -> Pose {
ahoge: mix(from.ahoge, to.ahoge),
look: (mix(from.look.0, to.look.0), mix(from.look.1, to.look.1)),
wide: mix(from.wide, to.wide),
brows: mix(from.brows, to.brows),
flush: mix(from.flush, to.flush),
hands: [
mix(from.hands[0], to.hands[0]),
@@ -196,7 +198,7 @@ fn idle(act: Act, t: f64, period: f32, amp: f32) -> Pose {
eyes: Eyes::Open,
mouth: Mouth::Smile,
pop: popping(early(t)),
brows: false,
brows: 0.0,
flush: 0.0,
hands: [0.0; 2],
marks: Vec::new(),
@@ -290,7 +292,7 @@ fn waiting(t: f64) -> Pose {
/// An error: brows up, a frown, a shake, a smaller one every 4.5 s, and a drop that runs down.
fn fretting(t: f64) -> Pose {
let mut pose = idle(Act::Fret, t, 2.4, 1.5);
pose.brows = true;
pose.brows = 1.0;
pose.mouth = Mouth::Frown;
pose.look = (0.0, 3.0);
pose.tilt = -3.0;
+7 -1
View File
@@ -139,7 +139,7 @@ fn a_wait_widens_her_eyes_and_hops_her_twice_every_round() {
#[test]
fn an_error_frets_her_with_a_shake_and_a_drop() {
let fret = |held: f64| at(Mood::Error, held);
assert!(fret(1.0).brows);
assert_eq!(fret(1.0).brows, 1.0);
assert_eq!((fret(1.0).act, fret(1.0).mouth), (Act::Fret, Mouth::Frown));
assert!(fret(0.15).shake.abs() > 1.0, "a shake");
assert_eq!(fret(1.0).shake, 0.0);
@@ -200,4 +200,10 @@ fn a_change_of_act_eases_her_from_her_last_pose() {
.1;
assert!(bang.alpha > 0.0 && bang.alpha < 1.0);
assert_eq!(leaving.eyes, Eyes::Open, "the shapes are the new act's");
let fretting = at(Mood::Error, 1.0);
let calming = blend(&fretting, at(Mood::Calm, 0.1), 0.1);
assert!(
calming.brows > 0.0 && calming.brows < 1.0,
"her brows ease down"
);
}
+1 -1
View File
@@ -196,7 +196,7 @@ fn moved(
Bone::Iris(side) if open(side) => (shift(squash(side, pose.wide), by(pose.look)), 1.0),
Bone::Arc(side) if shut(side) => (squash(side, 1.0), 1.0),
Bone::Lines if pose.eyes == Eyes::Lines => (head, 1.0),
Bone::Brows if pose.brows => (head, 1.0),
Bone::Brows if pose.brows > 0.0 => (head, pose.brows),
Bone::Blush => (head, 1.0 + 0.6 * pose.flush),
Bone::Mouth(mouth) if mouth == pose.mouth => (grow(head, pivot, (pose.pop, pose.pop)), 1.0),
Bone::Lock(side) => {