1
0

svg_basic.rs 2.3 KB

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