NodeList
isn't a good idea for the KUTE.selector utility, it's not workin in IE8.
Added a link in the documentation for a pathToAbslute utility for SVG morphing.
This commit is contained in:
parent
ee713e86c4
commit
3819cd0f3a
|
@ -23,7 +23,7 @@ var morphTween21 = KUTE.fromTo('#triangle', {path: '#triangle', fill: '#673AB7'}
|
|||
duration: 1500, easing: 'easingCubicOut',
|
||||
});
|
||||
var morphTween22 = KUTE.fromTo('#triangle', {path: '#square', fill: '#2196F3'}, { path: '#star2', fill: 'deeppink' }, {
|
||||
morphIndex: 9,
|
||||
morphIndex: 9,
|
||||
delay: 500, duration: 1500, easing: 'easingCubicOut'
|
||||
});
|
||||
var morphTween23 = KUTE.fromTo('#triangle', {path: '#star2', fill: 'deeppink'}, { path: '#triangle', fill: '#673AB7' }, {
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
selector = function(el,multi){ // a selector utility
|
||||
var nl;
|
||||
if (multi){
|
||||
nl = el instanceof NodeList ? el : document.querySelectorAll(el);
|
||||
nl = typeof el === 'object' ? el : document.querySelectorAll(el);
|
||||
} else {
|
||||
nl = typeof el === 'object' ? el
|
||||
: /^#/.test(el) ? document.getElementById(el.replace('#','')) : document.querySelector(el);
|
||||
|
|
|
@ -158,6 +158,7 @@ If the current animation is not satisfactory, consider reversing one of the path
|
|||
|
||||
<h4>Morphing Polygon Paths</h4>
|
||||
<p>When your paths are only <code>lineto</code>, <code>vertical-lineto</code> and <code>horizontal-lineto</code> based shapes (the <code>d</code> attribute consists of <code>L</code>, <code>V</code> and <code>H</code> path commands), the SVG Plugin will work differently: it will use their points instead of sampling new ones. As a result, we boost the visual and maximize the performance. The <code>morphPrecision</code> option will not apply since the paths are already polygons, still you will have access to all the other options.</p>
|
||||
<p>The plugin will try to convert paths to absolute values for polygons, but it might not find most accurate coordinates values for relative <code>v</code> and <code>h</code> path commands. I highly recommend using my <a href="http://codepen.io/thednp/full/EgVqLw/">utility converter</a> to prepare your paths in that case.</p>
|
||||
<pre><code class="language-javascript">// let's morph a triangle into a star
|
||||
var tween1 = KUTE.to('#triangle', { path: '#star' }).start();
|
||||
|
||||
|
@ -186,7 +187,8 @@ var tween2 = KUTE.to('#triangle', { path: '#square' }).start();
|
|||
</div>
|
||||
</div>
|
||||
<p>The morph for polygon paths is the best morph in terms of performance so it's worth keeping that in mind. Also using paths with only <code>L</code> path command will make sure to prevent value processing and allow the animation to start as fast as possible.</p>
|
||||
|
||||
|
||||
|
||||
<h4>Multi Path Example</h4>
|
||||
<p>In other cases, you may want to morph paths that have subpaths. Let's have a look at the following paths:</p>
|
||||
<pre><code class="language-markup"><svg id="multi-morph-example" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 600 600">
|
||||
|
@ -556,6 +558,7 @@ var tween7 = KUTE.to('#myStopOpacity',{stopOpacity: 0.2});
|
|||
|
||||
<!--<script src="http://cdn.jsdelivr.net/kute.js/0.9.2/kute.full.min.js"></script> KUTE CDN -->
|
||||
<script src="./src/kute.js"></script> <!-- some stuff -->
|
||||
<!--<script src="./../dist/kute-svg.min.js"></script> some stuff -->
|
||||
<script src="./src/kute-svg.js"></script> <!-- some stuff -->
|
||||
<script src="./assets/js/scripts.js"></script> <!-- global scripts stuff -->
|
||||
<script src="./assets/js/svg.js"></script> <!-- css plugin stuff -->
|
||||
|
|
33
dist/kute.min.js
vendored
33
dist/kute.min.js
vendored
File diff suppressed because one or more lines are too long
2
kute.js
2
kute.js
|
@ -28,7 +28,7 @@
|
|||
selector = function(el,multi){ // a selector utility
|
||||
var nl;
|
||||
if (multi){
|
||||
nl = el instanceof NodeList ? el : document.querySelectorAll(el);
|
||||
nl = typeof el === 'object' ? el : document.querySelectorAll(el);
|
||||
} else {
|
||||
nl = typeof el === 'object' ? el
|
||||
: /^#/.test(el) ? document.getElementById(el.replace('#','')) : document.querySelector(el);
|
||||
|
|
Loading…
Reference in a new issue