|
28 | 28 | #include "ink/brush/brush_tip.h" |
29 | 29 | #include "ink/geometry/angle.h" |
30 | 30 | #include "ink/geometry/internal/algorithms.h" |
| 31 | +#include "ink/geometry/internal/modulo.h" |
31 | 32 | #include "ink/geometry/point.h" |
32 | 33 | #include "ink/geometry/vec.h" |
33 | 34 | #include "ink/strokes/input/stroke_input.h" |
@@ -539,6 +540,7 @@ struct BrushTipStateModifiers { |
539 | 540 | float corner_rounding_offset = 0; |
540 | 541 | Angle rotation_offset; |
541 | 542 | float pinch_offset = 0; |
| 543 | + float texture_animation_progress_offset = 0; |
542 | 544 | Angle hue_offset; |
543 | 545 | float saturation_multiplier = 1; |
544 | 546 | float luminosity = 0; |
@@ -597,6 +599,9 @@ void ApplyModifierToTarget(float modifier, BrushBehavior::Target target, |
597 | 599 | modifier * brush_size); |
598 | 600 | } |
599 | 601 | break; |
| 602 | + case BrushBehavior::Target::kTextureAnimationProgressOffset: |
| 603 | + tip_state_modifiers.texture_animation_progress_offset += modifier; |
| 604 | + break; |
600 | 605 | case BrushBehavior::Target::kHueOffsetInRadians: |
601 | 606 | tip_state_modifiers.hue_offset += Angle::Radians(modifier); |
602 | 607 | break; |
@@ -637,6 +642,13 @@ void ApplyModifiersToTipState(const BrushTipStateModifiers& modifiers, |
637 | 642 | tip_state.percent_radius = std::clamp( |
638 | 643 | tip_state.percent_radius + modifiers.corner_rounding_offset, 0.f, 1.f); |
639 | 644 | } |
| 645 | + if (modifiers.texture_animation_progress_offset != 0) { |
| 646 | + tip_state.texture_animation_progress_offset = |
| 647 | + geometry_internal::FloatModulo( |
| 648 | + tip_state.texture_animation_progress_offset + |
| 649 | + modifiers.texture_animation_progress_offset, |
| 650 | + 1); |
| 651 | + } |
640 | 652 | if (modifiers.hue_offset != Angle()) { |
641 | 653 | tip_state.hue_offset_in_full_turns = |
642 | 654 | modifiers.hue_offset.Normalized() / kFullTurn; |
|
0 commit comments