svg_basic.rs 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. use dioxus::prelude::*;
  2. fn app() -> Element {
  3. rsx!( svg {
  4. width: "200",
  5. height: "250",
  6. xmlns: "http://www.w3.org/2000/svg",
  7. version: "1.1",
  8. rect {
  9. x: "10",
  10. y: "10",
  11. width: "30",
  12. height: "30",
  13. stroke: "black",
  14. fill: "transparent",
  15. stroke_width: "5",
  16. }
  17. rect {
  18. x: "60",
  19. y: "10",
  20. width: "30",
  21. height: "30",
  22. stroke: "black",
  23. fill: "transparent",
  24. stroke_width: "5",
  25. }
  26. circle {
  27. cx: "25",
  28. cy: "75",
  29. r: "20",
  30. stroke: "red",
  31. fill: "transparent",
  32. stroke_width: "5",
  33. }
  34. ellipse {
  35. cx: "75",
  36. cy: "75",
  37. rx: "20",
  38. ry: "5",
  39. stroke: "red",
  40. fill: "transparent",
  41. stroke_width: "5",
  42. }
  43. line {
  44. x1: "10",
  45. x2: "50",
  46. y1: "110",
  47. y2: "150",
  48. stroke: "orange",
  49. stroke_width: "5",
  50. }
  51. polyline {
  52. points: "60 110 65 120 70 115 75 130 80 125 85 140 90 135 95 150 100 145",
  53. stroke: "orange",
  54. fill: "transparent",
  55. stroke_width: "5",
  56. }
  57. polygon {
  58. points: "50 160 55 180 70 180 60 190 65 205 50 195 35 205 40 190 30 180 45 180",
  59. stroke: "green",
  60. fill: "transparent",
  61. stroke_width: "5",
  62. }
  63. path {
  64. d: "M20,230 Q40,205 50,230 T90,230",
  65. fill: "none",
  66. stroke: "blue",
  67. stroke_width: "5",
  68. }
  69. path {
  70. d: "M9.00001 9C9 62 103.5 124 103.5 178",
  71. stroke: "#3CC4DC",
  72. "stroke-linecap": "square",
  73. "stroke-width": "square",
  74. }
  75. }
  76. }
  77. fn main() {
  78. dioxus_desktop::launch(app);
  79. }