-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(svg): not convert
'transparent'
color to 'none'
to fix gradie…
…nt color rendering bug
- Loading branch information
1 parent
247e119
commit 7f423d6
Showing
2 changed files
with
40 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<title>SVG Gradient</title> | ||
<script src="./lib/config.js"></script> | ||
<script src="../dist/zrender.js"></script> | ||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
</head> | ||
<body> | ||
<div id="main"></div> | ||
<script type="text/javascript"> | ||
var zr = zrender.init(document.getElementById('main'), { | ||
renderer: 'svg', | ||
width: 200, | ||
height: 200 | ||
}); | ||
zr.setBackgroundColor('navajowhite'); | ||
|
||
var linearGradient = new zrender.LinearGradient(0, 0, 0, 1); | ||
linearGradient.addColorStop(0, 'transparent'); | ||
linearGradient.addColorStop(1, 'orange'); | ||
|
||
zr.add( | ||
new zrender.Rect({ | ||
shape: { | ||
x: 100, | ||
y: 100, | ||
width: 20, | ||
height: 100, | ||
}, | ||
style: { | ||
fill: linearGradient | ||
} | ||
}) | ||
); | ||
</script> | ||
</body> | ||
</html> |