Skip to content

Commit

Permalink
[svg] update linear-gradient-* & radial-gradient-* to require attrib map
Browse files Browse the repository at this point in the history
  • Loading branch information
postspectacular committed Jun 7, 2015
1 parent 4754320 commit e124cf9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
16 changes: 8 additions & 8 deletions geom-svg/src/core.org
Original file line number Diff line number Diff line change
Expand Up @@ -172,27 +172,27 @@ and will be automatically converted.
[:stop {:offset (*fmt-percent* pos) :stop-color col}]))

(defn linear-gradient-rgb
[id & stops]
[id attribs & stops]
[:linearGradient
{:id id}
(assoc attribs :id id)
(map #(gradient-stop col/rgba->css %) stops)])

(defn radial-gradient-rgb
[id & stops]
[id attribs & stops]
[:radialGradient
{:id id}
(assoc attribs :id id)
(map #(gradient-stop col/rgba->css %) stops)])

(defn linear-gradient-hsv
[id & stops]
[id attribs & stops]
[:linearGradient
{:id id}
(assoc attribs :id id)
(map #(gradient-stop col/hsva->css %) stops)])

(defn radial-gradient-hsv
[id & stops]
[id attribs & stops]
[:radialGradient
{:id id}
(assoc attribs :id id)
(map #(gradient-stop col/hsva->css %) stops)])

(defn group
Expand Down
6 changes: 3 additions & 3 deletions geom-svg/src/examples.org
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ is defined in its own namespace and can be loaded from the REPL via:
(->> (svg/svg
{:width 300 :height 300}
(svg/defs
(apply svg/radial-gradient-hsv "rainbow" rainbow-gradient))
(apply svg/radial-gradient-hsv "rainbow" {} rainbow-gradient))
(svg/line-strip
(spiral [150 150] 0 (* 6 m/TWO_PI) 0 140 300)
(assoc svg/stroke-round
Expand Down Expand Up @@ -248,8 +248,8 @@ is defined in its own namespace and can be loaded from the REPL via:
(->> (svg/svg
{:width 600 :height 300}
(svg/defs
(apply svg/radial-gradient-hsv "rainbow-rad" rainbow-gradient)
(apply svg/linear-gradient-hsv "rainbow-lin" rainbow-gradient)
(apply svg/radial-gradient-hsv "rainbow-rad" {} rainbow-gradient)
(apply svg/linear-gradient-hsv "rainbow-lin" {} rainbow-gradient)
(svg/line-strip
(spiral [0 0] 0 (* 6 m/TWO_PI) 0 140 300)
(assoc svg/stroke-round :id "spiral")))
Expand Down

0 comments on commit e124cf9

Please sign in to comment.