<!doctype html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>实用绘制和动画SVG描边路径的JavaScript插件</title>
<link rel="stylesheet" type="text/css" href="css/normalize.css" />
<link rel="stylesheet" type="text/css" href="css/default.css">
<link rel="stylesheet" href="css/demo.css">
<script src="js/ease.min.js"></script>
<script src="dist/segment.min.js"></script>
<!--[if IE]>
<script src="http://libs.useso.com/js/html5shiv/3.7/html5shiv.min.js"></script>
<![endif]-->
</head>
<body>
<article class="htmleaf-container">
<header class="htmleaf-header">
<h1>实用绘制和动画SVG描边路径的JavaScript插件 <span>A little JavaScript class (without dependencies) to draw and animate SVG path strokes</span></h1>
<div class="htmleaf-links">
<a class="htmleaf-icon icon-htmleaf-home-outline" href="http://www.jb51.net/" title="脚本之家" target="_blank"><span> 脚本之家</span></a>
<a class="htmleaf-icon icon-htmleaf-arrow-forward-outline" href="http://www.jb51.net/" title="返回下载页" target="_blank"><span> 返回下载页</span></a>
</div>
</header>
<div class="container">
<div>
<h1>Segment</h1>
<button id="random" class="bordered">Random</button>
<div class="svg-container">
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 474 200">
<path d="M10 100 C 40 200, 130 200, 160 100 S 280 0, 310 100 S 430 200, 460 100" stroke="rgba(0, 0, 0, 0.2)" stroke-width="1px" fill="transparent"/>
<path id="path" d="M10 100 C 40 200, 130 200, 160 100 S 280 0, 310 100 S 430 200, 460 100" stroke="#2980b9" stroke-width="10px" fill="transparent"/>
</svg>
</div>
</div>
<p>下面的参数可以进行修改。</p>
<div class="demo-code">
<div class="code-snippet">
segment.draw(
<div class="selectable">
<label for="begin"></label>
<select name="begin" id="begin">
<option value="0">0</option>
<option value="100">100</option>
<option value="25% + 50">25% + 50</option>
<option value="50% - 50">50% - 50</option>
<option value="50%">50%</option>
</select>
<span class="tooltip">Segment begin</span>
</div>
,
<div class="selectable">
<label for="end"></label>
<select name="end" id="end">
<option value="50%">50%</option>
<option value="400">400</option>
<option value="50% + 50">50% + 50</option>
<option value="75% - 50">75% - 50</option>
<option value="100%" selected="selected">100%</option>
</select>
<span class="tooltip">Segment end</span>
</div>
,
<div class="selectable">
<label for="duration"></label>
<select name="duration" id="duration">
<option value="0.5">0.5</option>
<option value="1" selected="selected">1</option>
<option value="1.5">1.5</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
<span class="tooltip">Duration</span>
</div>
,
{easing:
<div class="selectable">
<label for="easing"></label>
<select name="easing" id="easing">
<option value="linear-in">linear</option>
<option value="quad-in">quad_in</option>
<option value="quad-out">quad_out</option>
<option value="quad-in-out">quad_in_out</option>
<option value="cubic-in">cubic_in</option>
<option value="cubic-out" selected="selected">cubic_out</option>
<option value="cubic-in-out">cubic_in_out</option>
<option value="sin-in">sin_in</option>
<option value="sin-out">sin_out</option>
<option value="sin-in-out">sin_in_out</option>
<option value="exp-in">exp_in</option>
<option value="exp-out">exp_out</option>
<option value="exp-in-out">exp_in_out</option>
<option value="circle-in">circle_in</option>
<option value="circle-out">circle_out</option>
<option value="circle-in-out">circle_in_out</option>
<option value="bounce-in">bounce_in</option>
<option value="bounce-out">bounce_out</option>
<option value="bounce-in-out">bounce_in_out</option>
<option value="back-in">back_in</option>
<option value="back-out">back_out</option>
<option value="back-in-out">back_in_out</option>
<option value="elastic-in">elastic_in</option>
<option value="elastic-out">elastic_out</option>
<option value="elastic-in-out">elastic_in_out</option>
</select>
<span class="tooltip">Easing function</span>
</div>
}
);
</div>
</div>
<div>
<button id="draw">Draw</button>
</div>
</div>
</article>
<script src="js/demo.js"></script>
</body>
</html>