119 lines
3.5 KiB
HTML
119 lines
3.5 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="copyright" content="Copyright © 2013 Adobe Systems Incorporated. All rights reserved.
|
|
|
|
Licensed under the Apache License, Version 2.0 (the “License”);
|
|
you may not use this file except in compliance with the License.
|
|
You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
distributed under the License is distributed on an “AS IS” BASIS,
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
See the License for the specific language governing permissions and
|
|
limitations under the License.">
|
|
<title>Savage</title>
|
|
<style media="screen">
|
|
body {
|
|
background: #030 url("bg.png");
|
|
}
|
|
</style>
|
|
<script src="dist/savage-min.js"></script>
|
|
<script>
|
|
window.onload = function () {
|
|
1;
|
|
var s = Savage("100%", 600);
|
|
|
|
2;
|
|
var c = s.circle(100, 100, 50);
|
|
|
|
3;
|
|
c.attr({
|
|
fill: "#bada55",
|
|
stroke: "#000",
|
|
"stroke-width": 5
|
|
});
|
|
|
|
4;
|
|
var c2 = s.circle(70, 100, 40);
|
|
var g = s.group(c2, s.circle(130, 100, 40));
|
|
g.attr({
|
|
fill: "#fff"
|
|
});
|
|
|
|
5;
|
|
c.attr({
|
|
mask: g
|
|
});
|
|
|
|
6;
|
|
c2.animate({r: 25}, 1000);
|
|
|
|
7;
|
|
g.select("circle:nth-child(2)").animate({r: 25}, 1000);
|
|
|
|
8;
|
|
var p = s.path("M10-5-10,15M15,0,0,15M0-5-20,15").attr({
|
|
fill: "none",
|
|
stroke: "#bada55",
|
|
strokeWidth: 5
|
|
}).pattern(0, 0, 10, 10);
|
|
c.attr({
|
|
fill: p
|
|
});
|
|
|
|
9;
|
|
g.attr({
|
|
fill: Savage(document.getElementById("pattern"))
|
|
});
|
|
|
|
10;
|
|
g.attr({fill: "r()#fff-#000"});
|
|
|
|
11;
|
|
g.attr({fill: "R(100, 100, 50)#fff-#000"});
|
|
|
|
12;
|
|
p.select("path").animate({stroke: "#f00"}, 1000);
|
|
|
|
13;
|
|
Savage.load("demo-card.svg", function (f) {
|
|
f.select("path[fill='#D40000']").attr({fill: "#bada55"});
|
|
g = s.group(f.selectAll("path"));
|
|
s.append(g);
|
|
|
|
14;
|
|
g.attr({
|
|
transform: "r45t100,0s.5"
|
|
});
|
|
|
|
15;
|
|
console.log(g.attr("transform"));
|
|
|
|
16;
|
|
g.drag();
|
|
});
|
|
|
|
17;
|
|
s.text(200, 100, "SAVAGE");
|
|
|
|
18;
|
|
var t = s.text(200, 120, ["S","A","V","A","G","E"]);
|
|
t.selectAll("tspan tspan:nth-child(odd)").attr({
|
|
fill: "#900",
|
|
"font-size": "20px"
|
|
});
|
|
};
|
|
</script>
|
|
</head>
|
|
<body>
|
|
<svg width="0" height="0">
|
|
<pattern id="pattern" patternUnits="userSpaceOnUse" x="0" y="0" width="10" height="10" viewBox="0 0 10 10">
|
|
<path d="M-5,0,10,15M0-5,15,10" stroke="white" stroke-width="5"/>
|
|
</pattern>
|
|
</svg>
|
|
</body>
|
|
</html> |