Skip to content

Commit 8846573

Browse files
committed
using length
1 parent 7b8c56f commit 8846573

File tree

1 file changed

+2
-2
lines changed
  • examples/xtd.forms.examples/others/wiggly/src

1 file changed

+2
-2
lines changed

examples/xtd.forms.examples/others/wiggly/src/wiggly.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ namespace wiggly_example {
1717
auto pos = point {(e.clip_rectangle().size().width - as<int>(e.graphics().measure_string(text(), font()).width)) / 2, (e.clip_rectangle().size().height - as<int>(e.graphics().measure_string(text(), font()).height)) / 2};
1818
auto wiggly_text = text().to_u32string();
1919
for (auto i = 0_z; i < wiggly_text.length(); i++) {
20-
auto index = (step + i) % sins.size();
21-
e.graphics().draw_string(string::format("{}", wiggly_text[i]), font(), solid_brush {color::from_hsb(360.0f / sins.size() * index, 1.0f, 0.75f)}, point::subtract(pos, point(0, sins[index] * font().height() / 400)));
20+
auto index = (step + i) % sins.length();
21+
e.graphics().draw_string(string::format("{}", wiggly_text[i]), font(), solid_brush {color::from_hsb(360.0f / sins.length() * index, 1.0f, 0.75f)}, point::subtract(pos, point(0, sins[index] * font().height() / 400)));
2222
pos.x = pos.x + as<int>(e.graphics().measure_string(string::format("{}", wiggly_text[i]), font()).width);
2323
}
2424
}

0 commit comments

Comments
 (0)