File:Catalan number-path reflection.svg
Size of this PNG preview of this SVG file: 46 × 64 pixels. Other resolutions: 172 × 240 pixels | 345 × 480 pixels | 431 × 600 pixels | 552 × 768 pixels | 736 × 1,024 pixels.
Original file (SVG file, nominally 46 × 64 pixels, file size: 1 KB)
| This is a file from the Wikimedia Commons. The description on its description page there is shown below.
|
Summary
| DescriptionCatalan number-path reflection.svg |
English: Reflection-based proof of Catalan numbers Catalan number#Second proof |
| Date | |
| Source | Own work |
| Author | Javalenok |
Source code
<html>
<svg width="46" height="64" xmlns="http://www.w3.org/2000/svg">
<defs>
<pattern id="grid" width="8" height="8" patternUnits="userSpaceOnUse">
<path d="M 0 0 V 8 H 8" fill="none" stroke="lightgray" stroke-width="0.5"></path>
</pattern>
<g id="canvas">
<rect width="46" height="53" fill="url(#grid)" />
<path d="M 0,0 L 64,64" stroke="black" stroke-width="0.3"></path>
<path d="M 0,8 L 80, 88" stroke="red" stroke-width="0.3"></path>
<path id="path0" d="M 0,0 h8 v16" stroke="black" stroke-width=".9" fill="none">
</path>
<g stroke="black" stroke-width=".9" fill="none">
<path id="path1" d="M 8,16 ">
<animate id="first" attributeType="CSS" attributeName="stroke"
begin="0s;second.end+1s" from="black" to="rgba(230,230,230,1)" dur="200ms" fill = "freeze" />
<animate id="second" attributeType="CSS" attributeName="stroke"
begin="first.end+1s" from="rgba(230,230,230,1)" to="black" dur="200ms" fill = "freeze" />
</path></g>
<path id="path2" d="M 8,16" stroke="black" stroke-width=".9" fill="none">
<animate attributeType="CSS" attributeName="stroke"
begin="first.begin" from="rgba(230,230,230,1)" to="black" dur="200ms" fill = "freeze" />
<animate id="second" attributeType="CSS" attributeName="stroke"
begin="second.begin" from="black" to="rgba(230,230,230,1)" dur="200ms" fill = "freeze" />
</path>
</g>
</defs>
<use x=00 y=00 xlink:href="#canvas" transform="translate(002, 53) scale(1,-1)"/>
</svg>
<textarea id="area1" rows=15 cols=50></textarea>
<script language="javascript">
var svgNS = "http://www.w3.org/2000/svg";
var canvas = document.querySelector("svg")
function svg(name, props) {
var element = document.createElementNS(svgNS, name); //to create a circle, for rectangle use rectangle
for (key in props)
if(key=="xlink:href"){
element.setAttributeNS('http://www.w3.org/1999/xlink', 'href', props[key]);
}else{
element.setAttribute(key, props[key]);
}
//alert(element.outerHTML)
return canvas.appendChild(element);
}
function arrow(x, y, angle) {
var transform = "rotate(" + angle + ", "+ x + ", "+ y + ")"
svg("use", {x:x, y:y, "xlink:href":"#myarrow", transform:transform})
//alert(canvas.outerHTML)
}
var grid = document.querySelector("#grid").width.baseVal.value
var path = "hhvvvhh"
function pave(pathid) {
if (pathid == 2) path = path.replace(/h/g,1).replace(/v/g, 'h').replace(/1/g, 'v')
var svgpath = document.querySelector("#path" + pathid)
var d = svgpath.getAttribute("d")
for (var i = 0; i != path.length ;i++) {
d += " " + path[i] + grid
}
//arrowhead
if (path[path.length-1] == 'v')
d += " l -1.5,-1.5,3,0,-1.5,1.5"
else
d += " l -1.5,1.5,0,-3,1.5,1.5"
svgpath.setAttribute("d", d)
}
pave(1)
pave(2)
document.querySelector("#area1").value = canvas.outerHTML
</script>
</body></html>
Javascript updates SVG canvas on page load and exposes resulting file in textarea. In the second edition I actually highlighted the path flipping with animation but it seems does not play in Wikipedia.
Licensing
I, the copyright holder of this work, hereby publish it under the following license:
This file is licensed under the Creative Commons Attribution-Share Alike 4.0 International license.
- You are free:
- to share – to copy, distribute and transmit the work
- to remix – to adapt the work
- Under the following conditions:
- attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
- share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.
Captions
Add a one-line explanation of what this file represents
Items portrayed in this file
depicts
some value
7 January 2015
image/svg+xml
b0ef49346f6f1909de3cb74524a672f2e8220735
1,036 byte
64 pixel
46 pixel
File history
Click on a date/time to view the file as it appeared at that time.
| Date/Time | Dimensions | User | Comment | |
|---|---|---|---|---|
| current | 02:52, 18 January 2015 | 46 × 64 (1 KB) | Javalenok | Highlight flipped sections without animation |
File usage
The following page uses this file:
Metadata
This file contains additional information, probably added from the digital camera or scanner used to create or digitize it.
If the file has been modified from its original state, some details may not fully reflect the modified file.
| Width | 46 |
|---|---|
| Height | 64 |