htdebeer / svg-cards Goto Github PK
View Code? Open in Web Editor NEWA set of playing cards in SVG (now also with a rendering in PNG)
License: GNU Lesser General Public License v2.1
A set of playing cards in SVG (now also with a rendering in PNG)
License: GNU Lesser General Public License v2.1
When I spawn a card with #club_jack etc it comes out red, anyway to make them appropriately colored? Did not see in the docs.
Thanks for this excellent repo ๐
<!DOCTYPE html>
<html>
<head>
<title>The main card image is clipped by the 'Suit/Rank' section</title>
</head>
<body>
<div data-suit="heart" data-rank="12" style="width: 170px;">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 170 245">
<use href="./node_modules/svg-cards/svg-cards.svg#heart_queen"></use>
</svg>
</div>
<a href="https://github.com/htdebeer/SVG-cards" target="_blank">Huub de Beer</a>
</body>
</html>```
What program was used to create these files? They don't display in text editor also so they look binary. They show empty in Inkscape although when I did a save-as there, it saved it as a text file I could read with text editor. Loading that file into Inkscape it still displays blank.
Hello,
This is awesome! I can't get anything to render though.
I ran npm install --save svg-cards
and then added this example code to the html:
`<svg
width="600"
height="400"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
>
<!-- The cards have a natural width of 169.075 and a height of 244.640. It
center is located at (+98.0375, +122.320). -->
<!-- The original back color was #0062ff. The color of the back card can
be changed by setting the fill on the USE-element. -->
<use xlink:href="svg-cards-indented.svg#back" x="150" y="10" fill="red"/>
<use xlink:href="svg-cards-indented.svg#heart_1" x="0" y="0"/>
<use xlink:href="svg-cards-indented.svg#joker_black" x="100" y="100"/>
<use xlink:href="svg-cards-indented.svg#spade_10" x="200" y="200" transform="rotate(45,198.0375,122.320)scale(0.5)"/>
<use xlink:href="svg-cards-indented.svg#club_jack" x="300" y="100" transform="rotate(75,198.0375,122.320)scale(0.75)"/>
</svg>`
Am I missing something?
I also tried extracting the jack of diamonds from the file (only need jacks right now), and opening in illustrator, but it didn't look right (I wrapped it in an svg tag before saving):
<svg xmlns="http://www.w3.org/2000/svg" width="200" height="100" version="1.1"> <g id="diamond_jack" transform="translate(-1674.5,-6.616994)"> <use xlink:href="#base" x="1675.75" y="243.13699" width="100%" height="100%"/> <g style="fill:none;stroke:#000000;stroke-width:1"> <path d="m 1683.75,68.02 0,177.387"/> <path d="m 1683.75,245.407 132.28,0"/> <path d="m 1835.33,189.107 0,-177.637"/> <path d="m 1835.33,11.47 -132.28,0"/> </g> <g> <use xlink:href="#diamond" x="713.26398" y="16.049999" transform="matrix(-2.4,0,0,-2.4,3423.6672,77.04)" width="100%" height="100%"/> <rect x="1693.33" y="19.535999" width="9.6925697" height="37.967999" style="fill:#ffffff"/> </g> <g> <use xlink:href="#diamond" x="753.01703" y="91.032799" transform="scale(2.4,2.4)" width="100%" height="100%"/> <rect x="1816.49" y="199.495" width="9.6925697" height="37.967999" style="fill:#ffffff"/> </g> <g transform="matrix(0.99950656,-0.03141076,0.03141076,0.99950656,-3.1661397,55.331864)"> <line x1="1722.98" y1="181.48399" x2="1796.1" y2="75.393303" style="stroke:#000000;stroke-width:7.25"/> <circle cx="1725.4" cy="178.42599" r="2.2" style="fill:#ffffff"/> <circle cx="1725.4" cy="178.42599" r="0.69999999" style="fill:#000000"/> <circle cx="1728.8199" cy="173.452" r="2.2" style="fill:#ffffff"/> <circle cx="1728.8199" cy="173.452" r="0.69999999" style="fill:#000000"/> <circle cx="1732.25" cy="168.479" r="2.2" style="fill:#ffffff"/> <circle cx="1732.25" cy="168.479" r="0.69999999" style="fill:#000000"/> <circle cx="1735.6801" cy="163.505" r="2.2" style="fill:#ffffff"/> <circle cx="1735.6801" cy="163.505" r="0.69999999" style="fill:#000000"/> <circle cx="1739.11" cy="158.532" r="2.2" style="fill:#ffffff"/> <circle cx="1739.11" cy="158.532" r="0.69999999" style="fill:#000000"/> <circle cx="1742.54" cy="153.558" r="2.2" style="fill:#ffffff"/> <circle cx="1742.54" cy="153.558" r="0.69999999" style="fill:#000000"/> <circle cx="1745.96" cy="148.58501" r="2.2" style="fill:#ffffff"/> <circle cx="1745.96" cy="148.58501" r="0.69999999" style="fill:#000000"/> <circle cx="1749.39" cy="143.61099" r="2.2" style="fill:#ffffff"/> <circle cx="1749.39" cy="143.61099" r="0.69999999" style="fill:#000000"/> <circle cx="1752.8199" cy="138.638" r="2.2" style="fill:#ffffff"/> <circle cx="1752.8199" cy="138.638" r="0.69999999" style="fill:#000000"/> <circle cx="1756.25" cy="133.664" r="2.2" style="fill:#ffffff"/> <circle cx="1756.25" cy="133.664" r="0.69999999" style="fill:#000000"/> <circle cx="1759.67" cy="128.69" r="2.2" style="fill:#ffffff"/> <circle cx="1759.67" cy="128.69" r="0.69999999" style="fill:#000000"/> <circle cx="1763.1" cy="123.717" r="2.2" style="fill:#ffffff"/> <circle cx="1763.1" cy="123.717" r="0.69999999" style="fill:#000000"/> <circle cx="1766.53" cy="118.743" r="2.2" style="fill:#ffffff"/> <circle cx="1766.53" cy="118.743" r="0.69999999" style="fill:#000000"/> <circle cx="1769.96" cy="113.77" r="2.2" style="fill:#ffffff"/> <circle cx="1769.96" cy="113.77" r="0.69999999" style="fill:#000000"/> <circle cx="1773.39" cy="108.796" r="2.2" style="fill:#ffffff"/> <circle cx="1773.39" cy="108.796" r="0.69999999" style="fill:#000000"/> <circle cx="1776.8101" cy="103.823" r="2.2" style="fill:#ffffff"/> <circle cx="1776.8101" cy="103.823" r="0.69999999" style="fill:#000000"/> <circle cx="1780.24" cy="98.849297" r="2.2" style="fill:#ffffff"/> <circle cx="1780.24" cy="98.849297" r="0.69999999" style="fill:#000000"/> <circle cx="1783.67" cy="93.875702" r="2.2" style="fill:#ffffff"/> <circle cx="1783.67" cy="93.875702" r="0.69999999" style="fill:#000000"/> <circle cx="1787.1" cy="88.902199" r="2.2" style="fill:#ffffff"/> <circle cx="1787.1" cy="88.902199" r="0.69999999" style="fill:#000000"/> <circle cx="1790.53" cy="83.928703" r="2.2" style="fill:#ffffff"/> <circle cx="1790.53" cy="83.928703" r="0.69999999" style="fill:#000000"/> <circle cx="1793.95" cy="78.955101" r="2.2" style="fill:#ffffff"/> <circle cx="1793.95" cy="78.955101" r="0.69999999" style="fill:#000000"/> </g> <use xlink:href="#jack" x="1684.78" y="39.790001" style="fill:#e6180a" width="100%" height="100%"/> <use xlink:href="#jack" x="1834.3" y="217.08701" transform="matrix(-1,0,0,-1,3668.6,434.174)" style="fill:#e6180a" width="100%" height="100%"/> <use xlink:href="#diamond" x="1689.4" y="58.02" transform="matrix(-1,0,0,-1,3378.8,116.04)" width="100%" height="100%"/> <use xlink:href="#diamond" x="1829.67" y="198.85699" width="100%" height="100%"/> <use xlink:href="#jack_1" transform="matrix(-0.989999,-0.00159189,0.00159189,-0.989999,1828.046,183.0043)" x="0" y="0" width="2178.4751" height="1215.6875"/> <use xlink:href="#jack_1" transform="matrix(0.989996,0.00285726,-0.00285726,0.989996,1691.285,73.6636)" x="0" y="0" width="2178.4751" height="1215.6875"/> </g> </svg>
Thanks for your help with this!
Marshall
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.