I. Methods of Use
Since Textures.js is based on d3.js, d3.js files must be introduced and textures.min.js files introduced.
<script src= "Js/d3.min.js" charset= "Utf-8" ></script>
<script src= "Js/textures.min.js" charset= "Utf-8" ></script>
Second, HTML structure
The HTML structure of the SVG pattern background is very simple, using an empty div element.
<div id= "Example" ></div>
Third, JavaScript
The attr property selects the element to make the pattern background and sets its width and height through the properties of the property:
var svg = d3.select ("#example"). Append ("SVG"). attr (' width '). attr (' height ', 140);
Then choose a pattern background, stored in a variable.
var t = textures.lines (). thicker ();
You can then invoke the pattern from the previous SVG object.
Svg.call (t);
Svg.append ("path"). attr ("D", "M 0 0 L 0 (0)"). Style ("Fill", T.url ()).
The Keymob mobile advertising platform is designed to provide developers with a simple and powerful advertising management tool. So his interface design is extremely delicate, a core single case, complete all functions; management system platform by the attention of the fine division.
HTML5 Add SVG create pattern pattern background Style JS Plugin tutorial