master
Dmitry Baranovskiy 2014-03-07 17:16:58 +11:00
parent db451db0e2
commit 8ba748d905
5 changed files with 181 additions and 85 deletions

File diff suppressed because one or more lines are too long

70
dist/snap.svg.js vendored
View File

@ -476,6 +476,7 @@ var mina = (function (eve) {
stopit = function () {
var a = this;
delete animations[a.id];
a.update();
eve("mina.stop." + a.id, a);
},
pause = function () {
@ -484,6 +485,7 @@ var mina = (function (eve) {
return;
}
delete animations[a.id];
a.update();
a.pdif = a.get() - a.b;
},
resume = function () {
@ -495,6 +497,20 @@ var mina = (function (eve) {
delete a.pdif;
animations[a.id] = a;
},
update = function () {
var a = this,
res;
if (isArray(a.start)) {
res = [];
for (var j = 0, jj = a.start.length; j < jj; j++) {
res[j] = +a.start[j] +
(a.end[j] - a.start[j]) * a.easing(a.s);
}
} else {
res = +a.start + (a.end - a.start) * a.easing(a.s);
}
a.set(res);
},
frame = function () {
var len = 0;
for (var i in animations) if (animations.hasOwnProperty(i)) {
@ -513,20 +529,10 @@ var mina = (function (eve) {
});
}(a));
}
if (isArray(a.start)) {
res = [];
for (var j = 0, jj = a.start.length; j < jj; j++) {
res[j] = +a.start[j] +
(a.end[j] - a.start[j]) * a.easing(a.s);
}
} else {
res = +a.start + (a.end - a.start) * a.easing(a.s);
}
a.set(res);
a.update();
}
len && requestAnimFrame(frame);
},
// SIERRA Unfamiliar with the word _slave_ in this context. Also, I don't know what _gereal_ means. Do you mean _general_?
/*\
* mina
[ method ]
@ -556,6 +562,9 @@ var mina = (function (eve) {
o speed (function) speed getter/setter,
o duration (function) duration getter/setter,
o stop (function) animation stopper
o pause (function) pauses the animation
o resume (function) resumes the animation
o update (function) calles setter with the right value of the animation
o }
\*/
mina = function (a, A, b, B, get, set, easing) {
@ -575,7 +584,8 @@ var mina = (function (eve) {
duration: duration,
stop: stopit,
pause: pause,
resume: resume
resume: resume,
update: update
};
animations[anim.id] = anim;
var len = 0, i;
@ -2737,6 +2747,29 @@ function arrayFirstValue(arr) {
}
}
}
var rgNotSpace = /\S+/g,
rgBadSpace = /[\t\r\n\f]/g;
elproto.addClass = function (value) {
var classes = (value || "").match(rgNotSpace) || [],
elem = this.node,
cur = elem.className ? (" " + elem.className + " ").replace(rgBadSpace, " ") : " ",
j,
clazz,
finalValue;
if (cur) {
j = 0;
while ((clazz = classes[j++])) {
if (cur.indexOf(" " + clazz + " ") < 0) {
cur += clazz + " ";
}
}
finalValue = cur.replace(/(^\s+|\s+$)/g, "");
if (elem.className != finalValue) {
elem.className = finalValue;
}
}
};
elproto.clone = function () {
var clone = wrap(this.node.cloneNode(true));
if ($(clone.node, "id")) {
@ -2753,7 +2786,7 @@ function arrayFirstValue(arr) {
**
* Moves element to the shared `<defs>` area
**
= (Element) the clone
= (Element) the element
\*/
elproto.toDefs = function () {
var defs = getSomeDefs(this);
@ -2872,7 +2905,6 @@ function arrayFirstValue(arr) {
easing && (this.easing = easing);
callback && (this.callback = callback);
};
// SIERRA All object methods should feature sample code. This is just one instance.
/*\
* Snap.animation
[ method ]
@ -4335,9 +4367,13 @@ eve.on("snap.util.getattr.#text", function () {
})(-1);
eve.on("snap.util.getattr.viewBox", function () {
eve.stop();
var vb = $(this.node, "viewBox").split(separator);
return Snap._.box(+vb[0], +vb[1], +vb[2], +vb[3]);
// TODO: investigate why I need to z-index it
var vb = $(this.node, "viewBox");
if (vb) {
vb = vb.split(separator);
return Snap._.box(+vb[0], +vb[1], +vb[2], +vb[3]);
} else {
return;
}
})(-1);
eve.on("snap.util.getattr.points", function () {
var p = $(this.node, "points");

View File

@ -4852,7 +4852,7 @@ console.log(el.attr("fill")); // #fc0</code></pre></section>
<article id="Element.toDefs">
<header>
<h3 class="dr-method">Element.toDefs()<a href="#Element.toDefs" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2010 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2010">&#x27ad;</a></h3>
<h3 class="dr-method">Element.toDefs()<a href="#Element.toDefs" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2033 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2033">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.toDefs-extra"></div>
@ -4882,7 +4882,7 @@ console.log(el.attr("fill")); // #fc0</code></pre></section>
<em class="dr-type-Element">Element</em>
<span class="dr-description">the clone</span>
<span class="dr-description">the element</span>
</p>
@ -4894,7 +4894,7 @@ console.log(el.attr("fill")); // #fc0</code></pre></section>
<article id="Element.pattern">
<header>
<h3 class="dr-method">Element.pattern(x, y, width, height)<a href="#Element.pattern" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2040 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2040">&#x27ad;</a></h3>
<h3 class="dr-method">Element.pattern(x, y, width, height)<a href="#Element.pattern" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2063 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2063">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.pattern-extra"></div>
@ -4994,7 +4994,7 @@ c.attr({
<article id="Element.marker">
<header>
<h3 class="dr-method">Element.marker(x, y, width, height, refX, refY)<a href="#Element.marker" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2081 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2081">&#x27ad;</a></h3>
<h3 class="dr-method">Element.marker(x, y, width, height, refX, refY)<a href="#Element.marker" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2104 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2104">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.marker-extra"></div>
@ -5081,7 +5081,7 @@ To create a marker you have to specify the bounding rect and reference point:
<article id="Snap.animation">
<header>
<h3 class="dr-method">Snap.animation(attr, duration, [easing], [callback])<a href="#Snap.animation" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2140 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2140">&#x27ad;</a></h3>
<h3 class="dr-method">Snap.animation(attr, duration, [easing], [callback])<a href="#Snap.animation" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2162 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2162">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Snap.animation-extra"></div>
@ -5150,7 +5150,7 @@ To create a marker you have to specify the bounding rect and reference point:
<article id="Element.inAnim">
<header>
<h3 class="dr-method">Element.inAnim()<a href="#Element.inAnim" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2157 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2157">&#x27ad;</a></h3>
<h3 class="dr-method">Element.inAnim()<a href="#Element.inAnim" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2179 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2179">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.inAnim-extra"></div>
@ -5244,7 +5244,7 @@ To create a marker you have to specify the bounding rect and reference point:
<article id="Snap.animate">
<header>
<h3 class="dr-method">Snap.animate(from, to, setter, duration, [easing], [callback])<a href="#Snap.animate" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2206 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2206">&#x27ad;</a></h3>
<h3 class="dr-method">Snap.animate(from, to, setter, duration, [easing], [callback])<a href="#Snap.animate" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2228 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2228">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Snap.animate-extra"></div>
@ -5405,7 +5405,7 @@ rect.animate({x: 10}, 1000);</code></pre></section>
<article id="Element.stop">
<header>
<h3 class="dr-method">Element.stop()<a href="#Element.stop" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2224 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2224">&#x27ad;</a></h3>
<h3 class="dr-method">Element.stop()<a href="#Element.stop" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2246 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2246">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.stop-extra"></div>
@ -5447,7 +5447,7 @@ rect.animate({x: 10}, 1000);</code></pre></section>
<article id="Element.animate">
<header>
<h3 class="dr-method">Element.animate(attrs, duration, [easing], [callback])<a href="#Element.animate" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2245 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2245">&#x27ad;</a></h3>
<h3 class="dr-method">Element.animate(attrs, duration, [easing], [callback])<a href="#Element.animate" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2267 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2267">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.animate-extra"></div>
@ -5516,7 +5516,7 @@ rect.animate({x: 10}, 1000);</code></pre></section>
<article id="Element.data">
<header>
<h3 class="dr-method">Element.data(key, [value])<a href="#Element.data" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2317 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2317">&#x27ad;</a></h3>
<h3 class="dr-method">Element.data(key, [value])<a href="#Element.data" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2339 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2339">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.data-extra"></div>
@ -5638,7 +5638,7 @@ with <code>data-</code> attributes)
<article id="Element.removeData">
<header>
<h3 class="dr-method">Element.removeData([key])<a href="#Element.removeData" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2346 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2346">&#x27ad;</a></h3>
<h3 class="dr-method">Element.removeData([key])<a href="#Element.removeData" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2368 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2368">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.removeData-extra"></div>
@ -5699,7 +5699,7 @@ If key is not provided, removes all the data of the element.
<article id="Element.outerSVG">
<header>
<h3 class="dr-method">Element.outerSVG()<a href="#Element.outerSVG" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2363 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2363">&#x27ad;</a></h3>
<h3 class="dr-method">Element.outerSVG()<a href="#Element.outerSVG" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2385 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2385">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.outerSVG-extra"></div>
@ -5742,7 +5742,7 @@ If key is not provided, removes all the data of the element.
<article id="undefined">
<header>
<h3 class="dr-method">undefined<a href="#undefined" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2369 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2369">&#x27ad;</a></h3>
<h3 class="dr-method">undefined<a href="#undefined" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2391 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2391">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="undefined-extra"></div>
@ -5767,7 +5767,7 @@ If key is not provided, removes all the data of the element.
<article id="Element.innerSVG">
<header>
<h3 class="dr-method">Element.innerSVG()<a href="#Element.innerSVG" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2377 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2377">&#x27ad;</a></h3>
<h3 class="dr-method">Element.innerSVG()<a href="#Element.innerSVG" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2399 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2399">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.innerSVG-extra"></div>
@ -5809,7 +5809,7 @@ If key is not provided, removes all the data of the element.
<article id="Snap.parse">
<header>
<h3 class="dr-method">Snap.parse(svg)<a href="#Snap.parse" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2416 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2416">&#x27ad;</a></h3>
<h3 class="dr-method">Snap.parse(svg)<a href="#Snap.parse" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2438 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2438">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Snap.parse-extra"></div>
@ -5869,7 +5869,7 @@ If key is not provided, removes all the data of the element.
<article id="Fragment.select">
<header>
<h3 class="dr-method">Fragment.select()<a href="#Fragment.select" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2448 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2448">&#x27ad;</a></h3>
<h3 class="dr-method">Fragment.select()<a href="#Fragment.select" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2470 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2470">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Fragment.select-extra"></div>
@ -5894,7 +5894,7 @@ If key is not provided, removes all the data of the element.
<article id="Fragment.selectAll">
<header>
<h3 class="dr-method">Fragment.selectAll()<a href="#Fragment.selectAll" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2455 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2455">&#x27ad;</a></h3>
<h3 class="dr-method">Fragment.selectAll()<a href="#Fragment.selectAll" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2477 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2477">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Fragment.selectAll-extra"></div>
@ -5919,7 +5919,7 @@ If key is not provided, removes all the data of the element.
<article id="Snap.fragment">
<header>
<h3 class="dr-method">Snap.fragment(varargs)<a href="#Snap.fragment" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2466 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2466">&#x27ad;</a></h3>
<h3 class="dr-method">Snap.fragment(varargs)<a href="#Snap.fragment" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2488 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2488">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Snap.fragment-extra"></div>
@ -5979,7 +5979,7 @@ If key is not provided, removes all the data of the element.
<article id="Paper.el">
<header>
<h3 class="dr-method">Paper.el(name, attr)<a href="#Paper.el" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2673 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2673">&#x27ad;</a></h3>
<h3 class="dr-method">Paper.el(name, attr)<a href="#Paper.el" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2695 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2695">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Paper.el-extra"></div>
@ -6075,7 +6075,7 @@ var c = paper.el("circle", {
<article id="Paper.rect">
<header>
<h3 class="dr-method">Paper.rect(x, y, width, height, [rx], [ry])<a href="#Paper.rect" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2696 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2696">&#x27ad;</a></h3>
<h3 class="dr-method">Paper.rect(x, y, width, height, [rx], [ry])<a href="#Paper.rect" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2718 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2718">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Paper.rect-extra"></div>
@ -6175,7 +6175,7 @@ var c = paper.rect(40, 40, 50, 50, 10);</code></pre></section>
<article id="Paper.circle">
<header>
<h3 class="dr-method">Paper.circle(x, y, r)<a href="#Paper.circle" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2731 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2731">&#x27ad;</a></h3>
<h3 class="dr-method">Paper.circle(x, y, r)<a href="#Paper.circle" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2753 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2753">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Paper.circle-extra"></div>
@ -6263,7 +6263,7 @@ var c = paper.rect(40, 40, 50, 50, 10);</code></pre></section>
<article id="Paper.image">
<header>
<h3 class="dr-method">Paper.image(src, x, y, width, height)<a href="#Paper.image" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2763 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2763">&#x27ad;</a></h3>
<h3 class="dr-method">Paper.image(src, x, y, width, height)<a href="#Paper.image" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2785 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2785">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Paper.image-extra"></div>
@ -6385,7 +6385,7 @@ var c = paper.rect(40, 40, 50, 50, 10);</code></pre></section>
<article id="Paper.ellipse">
<header>
<h3 class="dr-method">Paper.ellipse(x, y, rx, ry)<a href="#Paper.ellipse" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2806 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2806">&#x27ad;</a></h3>
<h3 class="dr-method">Paper.ellipse(x, y, rx, ry)<a href="#Paper.ellipse" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2828 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2828">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Paper.ellipse-extra"></div>
@ -6476,7 +6476,7 @@ var c = paper.rect(40, 40, 50, 50, 10);</code></pre></section>
<article id="Paper.path">
<header>
<h3 class="dr-method">Paper.path([pathString])<a href="#Paper.path" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2851 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2851">&#x27ad;</a></h3>
<h3 class="dr-method">Paper.path([pathString])<a href="#Paper.path" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2873 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2873">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Paper.path-extra"></div>
@ -6744,7 +6744,7 @@ Note: there is a special case when a path consists of only three commands: <code
<article id="Paper.g">
<header>
<h3 class="dr-method">Paper.g([varargs])<a href="#Paper.g" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2882 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2882">&#x27ad;</a></h3>
<h3 class="dr-method">Paper.g([varargs])<a href="#Paper.g" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2904 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2904">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Paper.g-extra"></div>
@ -6853,7 +6853,7 @@ g.add(c2, c1);</code></pre></section>
<article id="Paper.group">
<header>
<h3 class="dr-method">Paper.group()<a href="#Paper.group" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2888 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2888">&#x27ad;</a></h3>
<h3 class="dr-method">Paper.group()<a href="#Paper.group" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2910 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2910">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Paper.group-extra"></div>
@ -6878,7 +6878,7 @@ g.add(c2, c1);</code></pre></section>
<article id="Paper.text">
<header>
<h3 class="dr-method">Paper.text(x, y, text)<a href="#Paper.text" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2921 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2921">&#x27ad;</a></h3>
<h3 class="dr-method">Paper.text(x, y, text)<a href="#Paper.text" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2943 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2943">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Paper.text-extra"></div>
@ -6972,7 +6972,7 @@ t1.attr({textpath: pth});</code></pre></section>
<article id="Paper.line">
<header>
<h3 class="dr-method">Paper.line(x1, y1, x2, y2)<a href="#Paper.line" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2949 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2949">&#x27ad;</a></h3>
<h3 class="dr-method">Paper.line(x1, y1, x2, y2)<a href="#Paper.line" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2971 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2971">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Paper.line-extra"></div>
@ -7063,7 +7063,7 @@ t1.attr({textpath: pth});</code></pre></section>
<article id="Paper.polyline">
<header>
<h3 class="dr-method">Paper.polyline(…)<a href="#Paper.polyline" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2978 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2978">&#x27ad;</a></h3>
<h3 class="dr-method">Paper.polyline(…)<a href="#Paper.polyline" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 3000 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#3000">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Paper.polyline-extra"></div>
@ -7175,7 +7175,7 @@ var p2 = paper.polyline(10, 10, 100, 100);</code></pre></section>
<article id="Paper.polygon">
<header>
<h3 class="dr-method">Paper.polygon()<a href="#Paper.polygon" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2998 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2998">&#x27ad;</a></h3>
<h3 class="dr-method">Paper.polygon()<a href="#Paper.polygon" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 3020 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#3020">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Paper.polygon-extra"></div>
@ -7200,7 +7200,7 @@ var p2 = paper.polyline(10, 10, 100, 100);</code></pre></section>
<article id="Paper.gradient">
<header>
<h3 class="dr-method">Paper.gradient(gradient)<a href="#Paper.gradient" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 3051 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#3051">&#x27ad;</a></h3>
<h3 class="dr-method">Paper.gradient(gradient)<a href="#Paper.gradient" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 3073 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#3073">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Paper.gradient-extra"></div>
@ -7398,7 +7398,7 @@ half the width, from black to white:
<article id="Paper.toString">
<header>
<h3 class="dr-method">Paper.toString()<a href="#Paper.toString" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 3067 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#3067">&#x27ad;</a></h3>
<h3 class="dr-method">Paper.toString()<a href="#Paper.toString" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 3089 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#3089">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Paper.toString-extra"></div>
@ -7440,7 +7440,7 @@ half the width, from black to white:
<article id="Paper.clear">
<header>
<h3 class="dr-method">Paper.clear()<a href="#Paper.clear" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 3085 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#3085">&#x27ad;</a></h3>
<h3 class="dr-method">Paper.clear()<a href="#Paper.clear" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 3107 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#3107">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Paper.clear-extra"></div>
@ -7465,7 +7465,7 @@ half the width, from black to white:
<article id="Snap.ajax">
<header>
<h3 class="dr-method">Snap.ajax(…)<a href="#Snap.ajax" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 3116 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#3116">&#x27ad;</a></h3>
<h3 class="dr-method">Snap.ajax(…)<a href="#Snap.ajax" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 3138 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#3138">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Snap.ajax-extra"></div>
@ -7569,7 +7569,7 @@ half the width, from black to white:
<article id="Snap.load">
<header>
<h3 class="dr-method">Snap.load(url, callback, [scope])<a href="#Snap.load" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 3162 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#3162">&#x27ad;</a></h3>
<h3 class="dr-method">Snap.load(url, callback, [scope])<a href="#Snap.load" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 3184 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#3184">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Snap.load-extra"></div>
@ -7618,7 +7618,7 @@ half the width, from black to white:
<article id="Snap.getElementByPoint">
<header>
<h3 class="dr-method">Snap.getElementByPoint(x, y)<a href="#Snap.getElementByPoint" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 3648 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#3648">&#x27ad;</a></h3>
<h3 class="dr-method">Snap.getElementByPoint(x, y)<a href="#Snap.getElementByPoint" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 3674 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#3674">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Snap.getElementByPoint-extra"></div>
@ -7703,7 +7703,7 @@ half the width, from black to white:
<article id="Snap.plugin">
<header>
<h3 class="dr-method">Snap.plugin(f)<a href="#Snap.plugin" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 3683 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#3683">&#x27ad;</a></h3>
<h3 class="dr-method">Snap.plugin(f)<a href="#Snap.plugin" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 3709 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#3709">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Snap.plugin-extra"></div>
@ -7773,7 +7773,7 @@ prototypes). This allow you to extend anything you want.
<article id="mina">
<header>
<h3 class="dr-method">mina(a, A, b, B, get, set, [easing])<a href="#mina" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 159 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#159">&#x27ad;</a></h3>
<h3 class="dr-method">mina(a, A, b, B, get, set, [easing])<a href="#mina" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 168 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#168">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="mina-extra"></div>
@ -7971,6 +7971,30 @@ prototypes). This allow you to extend anything you want.
<li>
<span class="dr-json-key">pause</span>
<span class="dr-type"><em class="dr-type-function">function</em> </span>
<span class="dr-json-description">pauses the animation</span>
</li>
<li>
<span class="dr-json-key">resume</span>
<span class="dr-type"><em class="dr-type-function">function</em> </span>
<span class="dr-json-description">resumes the animation</span>
</li>
<li>
<span class="dr-json-key">update</span>
<span class="dr-type"><em class="dr-type-function">function</em> </span>
<span class="dr-json-description">calles setter with the right value of the animation</span>
</li>
</ol></li><li>}</li>
@ -7983,7 +8007,7 @@ prototypes). This allow you to extend anything you want.
<article id="mina.time">
<header>
<h3 class="dr-method">mina.time()<a href="#mina.time" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 198 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#198">&#x27ad;</a></h3>
<h3 class="dr-method">mina.time()<a href="#mina.time" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 208 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#208">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="mina.time-extra"></div>
@ -8021,7 +8045,7 @@ prototypes). This allow you to extend anything you want.
<article id="mina.getById">
<header>
<h3 class="dr-method">mina.getById(id)<a href="#mina.getById" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 207 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#207">&#x27ad;</a></h3>
<h3 class="dr-method">mina.getById(id)<a href="#mina.getById" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 217 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#217">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="mina.getById-extra"></div>
@ -8081,7 +8105,7 @@ prototypes). This allow you to extend anything you want.
<article id="mina.linear">
<header>
<h3 class="dr-method">mina.linear(n)<a href="#mina.linear" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 219 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#219">&#x27ad;</a></h3>
<h3 class="dr-method">mina.linear(n)<a href="#mina.linear" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 229 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#229">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="mina.linear-extra"></div>
@ -8141,7 +8165,7 @@ prototypes). This allow you to extend anything you want.
<article id="mina.easeout">
<header>
<h3 class="dr-method">mina.easeout(n)<a href="#mina.easeout" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 230 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#230">&#x27ad;</a></h3>
<h3 class="dr-method">mina.easeout(n)<a href="#mina.easeout" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 240 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#240">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="mina.easeout-extra"></div>
@ -8201,7 +8225,7 @@ prototypes). This allow you to extend anything you want.
<article id="mina.easein">
<header>
<h3 class="dr-method">mina.easein(n)<a href="#mina.easein" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 241 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#241">&#x27ad;</a></h3>
<h3 class="dr-method">mina.easein(n)<a href="#mina.easein" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 251 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#251">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="mina.easein-extra"></div>
@ -8261,7 +8285,7 @@ prototypes). This allow you to extend anything you want.
<article id="mina.easeinout">
<header>
<h3 class="dr-method">mina.easeinout(n)<a href="#mina.easeinout" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 252 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#252">&#x27ad;</a></h3>
<h3 class="dr-method">mina.easeinout(n)<a href="#mina.easeinout" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 262 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#262">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="mina.easeinout-extra"></div>
@ -8321,7 +8345,7 @@ prototypes). This allow you to extend anything you want.
<article id="mina.backin">
<header>
<h3 class="dr-method">mina.backin(n)<a href="#mina.backin" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 276 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#276">&#x27ad;</a></h3>
<h3 class="dr-method">mina.backin(n)<a href="#mina.backin" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 286 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#286">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="mina.backin-extra"></div>
@ -8381,7 +8405,7 @@ prototypes). This allow you to extend anything you want.
<article id="mina.backout">
<header>
<h3 class="dr-method">mina.backout(n)<a href="#mina.backout" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 291 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#291">&#x27ad;</a></h3>
<h3 class="dr-method">mina.backout(n)<a href="#mina.backout" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 301 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#301">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="mina.backout-extra"></div>
@ -8441,7 +8465,7 @@ prototypes). This allow you to extend anything you want.
<article id="mina.elastic">
<header>
<h3 class="dr-method">mina.elastic(n)<a href="#mina.elastic" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 307 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#307">&#x27ad;</a></h3>
<h3 class="dr-method">mina.elastic(n)<a href="#mina.elastic" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 317 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#317">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="mina.elastic-extra"></div>
@ -8501,7 +8525,7 @@ prototypes). This allow you to extend anything you want.
<article id="mina.bounce">
<header>
<h3 class="dr-method">mina.bounce(n)<a href="#mina.bounce" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 322 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#322">&#x27ad;</a></h3>
<h3 class="dr-method">mina.bounce(n)<a href="#mina.bounce" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 332 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#332">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="mina.bounce-extra"></div>

View File

@ -74,6 +74,7 @@ var mina = (function (eve) {
stopit = function () {
var a = this;
delete animations[a.id];
a.update();
eve("mina.stop." + a.id, a);
},
pause = function () {
@ -82,6 +83,7 @@ var mina = (function (eve) {
return;
}
delete animations[a.id];
a.update();
a.pdif = a.get() - a.b;
},
resume = function () {
@ -93,6 +95,20 @@ var mina = (function (eve) {
delete a.pdif;
animations[a.id] = a;
},
update = function () {
var a = this,
res;
if (isArray(a.start)) {
res = [];
for (var j = 0, jj = a.start.length; j < jj; j++) {
res[j] = +a.start[j] +
(a.end[j] - a.start[j]) * a.easing(a.s);
}
} else {
res = +a.start + (a.end - a.start) * a.easing(a.s);
}
a.set(res);
},
frame = function () {
var len = 0;
for (var i in animations) if (animations.hasOwnProperty(i)) {
@ -111,20 +127,10 @@ var mina = (function (eve) {
});
}(a));
}
if (isArray(a.start)) {
res = [];
for (var j = 0, jj = a.start.length; j < jj; j++) {
res[j] = +a.start[j] +
(a.end[j] - a.start[j]) * a.easing(a.s);
}
} else {
res = +a.start + (a.end - a.start) * a.easing(a.s);
}
a.set(res);
a.update();
}
len && requestAnimFrame(frame);
},
// SIERRA Unfamiliar with the word _slave_ in this context. Also, I don't know what _gereal_ means. Do you mean _general_?
/*\
* mina
[ method ]
@ -154,6 +160,9 @@ var mina = (function (eve) {
o speed (function) speed getter/setter,
o duration (function) duration getter/setter,
o stop (function) animation stopper
o pause (function) pauses the animation
o resume (function) resumes the animation
o update (function) calles setter with the right value of the animation
o }
\*/
mina = function (a, A, b, B, get, set, easing) {
@ -173,7 +182,8 @@ var mina = (function (eve) {
duration: duration,
stop: stopit,
pause: pause,
resume: resume
resume: resume,
update: update
};
animations[anim.id] = anim;
var len = 0, i;

View File

@ -1989,6 +1989,29 @@ function arrayFirstValue(arr) {
}
}
}
var rgNotSpace = /\S+/g,
rgBadSpace = /[\t\r\n\f]/g;
elproto.addClass = function (value) {
var classes = (value || "").match(rgNotSpace) || [],
elem = this.node,
cur = elem.className ? (" " + elem.className + " ").replace(rgBadSpace, " ") : " ",
j,
clazz,
finalValue;
if (cur) {
j = 0;
while ((clazz = classes[j++])) {
if (cur.indexOf(" " + clazz + " ") < 0) {
cur += clazz + " ";
}
}
finalValue = cur.replace(/(^\s+|\s+$)/g, "");
if (elem.className != finalValue) {
elem.className = finalValue;
}
}
};
elproto.clone = function () {
var clone = wrap(this.node.cloneNode(true));
if ($(clone.node, "id")) {
@ -2005,7 +2028,7 @@ function arrayFirstValue(arr) {
**
* Moves element to the shared `<defs>` area
**
= (Element) the clone
= (Element) the element
\*/
elproto.toDefs = function () {
var defs = getSomeDefs(this);
@ -2124,7 +2147,6 @@ function arrayFirstValue(arr) {
easing && (this.easing = easing);
callback && (this.callback = callback);
};
// SIERRA All object methods should feature sample code. This is just one instance.
/*\
* Snap.animation
[ method ]
@ -3587,9 +3609,13 @@ eve.on("snap.util.getattr.#text", function () {
})(-1);
eve.on("snap.util.getattr.viewBox", function () {
eve.stop();
var vb = $(this.node, "viewBox").split(separator);
return Snap._.box(+vb[0], +vb[1], +vb[2], +vb[3]);
// TODO: investigate why I need to z-index it
var vb = $(this.node, "viewBox");
if (vb) {
vb = vb.split(separator);
return Snap._.box(+vb[0], +vb[1], +vb[2], +vb[3]);
} else {
return;
}
})(-1);
eve.on("snap.util.getattr.points", function () {
var p = $(this.node, "points");