File: transform-rotate-origin-test.html

package info (click to toggle)
d3 3.5.17-4
  • links: PTS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 11,464 kB
  • sloc: javascript: 43,334; makefile: 8; xml: 4
file content (40 lines) | stat: -rw-r--r-- 876 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<!DOCTYPE html>
<meta charset="utf-8">
<body>
<script src="../../d3.js"></script>
<script>

var width = 960,
    height = 500;

var cross = d3.svg.symbol()
    .type("cross")
    .size(10000);

var svg = d3.select("body").append("svg")
    .attr("width", width)
    .attr("height", height)
  .append("g")
    .attr("transform", "translate(" + (width / 2) + "," + (height / 2) + ")");

svg.append("path")
    .style("fill", "steelblue")
    .attr("d", cross);

svg.append("path")
    .style("fill", "darkgreen")
    .attr("d", cross)
    .attr("transform", "rotate(45 200,200)");

svg.append("path")
    .style("fill", "white")
    .style("fill-opacity", 0.2)
    .style("stroke", "steelblue")
    .style("stroke-width", "4px")
    .attr("d", cross)
  .transition()
    .duration(1000)
    .style("stroke", "darkgreen")
    .attr("transform", "rotate(45 200,200)");

</script>