-
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): parse opacity of empty/'none'/'transparent' color as 0 and …
…add warning for development environment
- Loading branch information
1 parent
247e119
commit df3b3f3
Showing
2 changed files
with
84 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,75 @@ | ||
<!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 linearGradient1 = new zrender.LinearGradient(0, 0, 0, 1); | ||
linearGradient1.addColorStop(0, 'transparent'); | ||
linearGradient1.addColorStop(1, 'orange'); | ||
|
||
var linearGradient2 = new zrender.LinearGradient(0, 0, 0, 1); | ||
linearGradient2.addColorStop(0, 'none'); | ||
linearGradient2.addColorStop(1, 'orange'); | ||
|
||
var linearGradient3 = new zrender.LinearGradient(0, 0, 0, 1); | ||
linearGradient3.addColorStop(0, ''); | ||
linearGradient3.addColorStop(1, 'orange'); | ||
|
||
zr.add( | ||
new zrender.Rect({ | ||
shape: { | ||
x: 20, | ||
y: 50, | ||
width: 20, | ||
height: 100, | ||
}, | ||
style: { | ||
fill: linearGradient1 | ||
} | ||
}) | ||
); | ||
|
||
zr.add( | ||
new zrender.Rect({ | ||
shape: { | ||
x: 60, | ||
y: 50, | ||
width: 20, | ||
height: 100, | ||
}, | ||
style: { | ||
fill: linearGradient2 | ||
} | ||
}) | ||
); | ||
|
||
zr.add( | ||
new zrender.Rect({ | ||
shape: { | ||
x: 100, | ||
y: 50, | ||
width: 20, | ||
height: 100, | ||
}, | ||
style: { | ||
fill: linearGradient3 | ||
} | ||
}) | ||
); | ||
</script> | ||
</body> | ||
</html> |