{
  "$schema": "https://vega.github.io/schema/vega/v5.json",
  "width": 200,
  "height": 200,
  "padding": 5,

  "signals": [
    { "name": "path", "value": "M-50,-50 L50,50 V-50 L-50,50 Z",
      "bind": {"input": "text", "placeholder": "SVG Path String"} },
    { "name": "x", "value": 100,
      "bind": {"input": "range", "min": 10, "max": 190, "step": 1} },
    { "name": "y", "value": 100,
      "bind": {"input": "range", "min": 10, "max": 190, "step": 1} },
    { "name": "scaleX", "value": 1,
      "bind": {"input": "range", "min": 0.1, "max": 2, "step": 0.1} },
    { "name": "scaleY", "value": 1,
      "bind": {"input": "range", "min": 0.1, "max": 2, "step": 0.1} },
    { "name": "angle", "value": 0,
      "bind": {"input": "range", "min": -180, "max": 180, "step": 1} },
    { "name": "strokeWidth", "value": 4,
      "bind": {"input": "range", "min": 0, "max": 10, "step": 0.5} },
    { "name": "strokeCap", "value": "butt",
      "bind": {"input": "radio", "options": ["butt", "round", "square"]} },
    { "name": "strokeJoin", "value": "miter",
      "bind": {"input": "radio", "options": ["bevel", "miter", "round"]} },
    { "name": "color", "value": "both",
      "bind": {"input": "radio", "options": ["fill", "stroke", "both"]} }
  ],

  "marks": [
    {
      "type": "path",
      "encode": {
        "enter": {
          "fill": {"value": "#939597"},
          "stroke": {"value": "#652c90"}
        },
        "update": {
          "x": {"signal": "x"},
          "y": {"signal": "y"},
          "path": {"signal": "path"},
          "opacity": {"value": 1},
          "strokeWidth": {"signal": "strokeWidth"},
          "fillOpacity": {"signal": "color === 'fill' || color === 'both' ? 1 : 0"},
          "strokeOpacity": {"signal": "color === 'stroke' || color === 'both' ? 1 : 0"},
          "strokeCap": {"signal": "strokeCap"},
          "strokeJoin": {"signal": "strokeJoin"},
          "angle": {"signal": "angle"},
          "scaleX": {"signal": "scaleX"},
          "scaleY": {"signal": "scaleY"}
        },
        "hover": {
          "opacity": {"value": 0.5}
        }
      }
    }
  ]
}
