Upgrade to Pro — share decks privately, control downloads, hide ads and more …

SVG MANIAX

SVG MANIAX

Naoki Matsuda

January 23, 2016
Tweet

More Decks by Naoki Matsuda

Other Decks in Technology

Transcript

  1. width="100px" height="100px" viewBox="0 0 200 200" <circle cx="100" cy="100" r="100"/>

    QY QY ⰼך湫䖇כ 䏟垥 47(ך䏟垥 ـٓؐؠךQY = WJFX#PYך⦼הXJEUI IFJHIUך⦼כⴽ暟ד֮׷ QY =    
  2. WJFX#PYך䭷㹀ָזְ㜥さ QY QY ⰼך湫䖇כ 䏟垥 ⴱ劍䏟垥禸 QY = = 47(ך䏟垥

    鋵銲稆ך؟؎ؤ width="100px" height="100px" viewBox="0 0 200 200" <circle cx="100" cy="100" r="100"/>
  3. iOS width="200px" height="160px" viewBox="0 0 200 160" ˖ $44ד䭷㹀ׅ׸לծ㾩䚍ך⦼״׶׮⮚⯓ׁ׸׷ ˖

    *&דכչIFJHIUBVUPպָ⸬ַזְ ˖ "OESPJEתדչQSFTFSWF"TQFDU3BUJPպ䭁簭嫰桦ךغָؚ֮׷ ˖ זךדծٖأهٝءـ'MVJEחׅ׷חכծJGSBNFךٖأهٝءـַהずׄ䩛岀׾ WJFX#PY䭷㹀֮׶կX IכչQYպ䭷㹀ׅ׷ָし
  4. Dynamic Interactive Mode Animated Mode Secure Animated Mode Static Mode

    Secure Static Mode SVGͷ͢΂ͯͷػೳΛ දࣔ ɾ ॲཧϞʔυ Ξχϝʔγϣϯ ॲཧϞʔυ Ξχϝʔγϣϯ ॲཧϞʔυ ੩ࢭըදࣔϞʔυ * ࡟আ͞ΕΔ༧ఆ ੩ࢭըදࣔϞʔυ ֎෦Ϧιʔεࢀর εΫϦϓτͷ࣮ߦ ΠϯλϥΫγϣϯॲཧ ʢΠϕϯτ ɾ ϦϯΫʣ SMILΞχϝʔγϣϯ HTML <img> HTML <object> <embed> <iframe> HTML5 inline SVG CSS background content HTML <img> CSS background content
  5. SPMFהBSJBMBCFMMFECZ׾鷄鎸ׅ׸ל أؙٔ٦ٝٔ٦ت٦㼎䘔׮דֹ׷ <svg viewBox="0 0 100 100" role="img" aria-labelledby="title desc">

    <title id="title">ϋϯόʔΨʔ</title> <desc id="desc">ϋϯόʔΨʔͷϑϥοτͳ ΠϥετΞΠίϯ</desc> … </svg>
  6. ͜Μͳάϥϑ΋"ݸʑͷཁૉ͝ͱ"ʹ ΞΫηγϒϧʹ͢Δ͜ͱ͕Ͱ͖Δ 0 30 60 90 120 150 ౉ล ాத

    ߴڮ ླ໦ ࠤ౻ ⡟谏 挿 ꈿ加 挿 넝堀 挿 歊⚥ 挿 床鴟 挿
  7. 銲稆ךⱄⵃ欽 <symbol id="s"> <path d="..."/> </symbol> <use xlink:href="#s" x="20" y="10"

    fill="#fc0"/> TZNCPM銲稆荈⡤כ㹋⡤ךזְ㔳䕎 VTF銲稆דⱄⵃ欽׃גⴱ׭ג邌爙דֹ׷ 1PJOU TZNCPMך㜥さծ鋵47(銲稆הכⴽך杝甧׃׋WJFX#PY׾ 䭯ג׷ךדծⱄⵃ欽׃׋ꥷך؟؎ؤ㢌刿׮〳腉
  8. <symbol id="tw"> <path d="M64,6.2c-1.1,0.6-4.3,1.8-7.3,2.1c1.9-1,4.8-4 .5,5.5-7.2c-1.9,1.2-6.1,2.9-8.2,2.9v0C51.5,1.6, 48.2,0,44.4,0 c-7.3,0-13.2,5.9-13.2,13.2c0,1,0.1,2,0.3,2.9h0c -9.9-0.3-20.7-5.2-27.2-13.7c-4,6.9-0.5,14.6,4,1 7.4c-1.6,0.1-4.4-0.2-5.8-1.5 C2.5,23,4.7,29.1,12.7,31.3c-1.6,0.8-4.3,0.6-5.5

    ,0.4c0.4,3.9,5.9,9,11.8,9c-2.1,2.5-10.1,6.9-19, 5.5C6.1,49.9,13.2,52,20.7,52 c21.3,0,37.8-17.3,37-38.6c0,0,0,0,0-0.1c0-0.1,0 -0.1,0-0.2c0-0.1,0-0.1,0-0.2C59.5,11.7,62.1,9.3 ,64,6.2z"/> </symbol> <use xlink:href="#tw" x="20" y="0" fill="#319aec"/> <use xlink:href="#tw" x="40" y="0" fill="#319aec"/> <use xlink:href="#tw" x="60" y="0" fill="#319aec"/> <use xlink:href="#tw" x="80" y="0" fill="#319aec"/> ؝٦سꆀ׮眍秈דֹ׷
  9. $44،صً٦ءّٝ את׶ծ$44ד䭷㹀דֹזְ㾩䚍⦼כ،صً♶〳腉 <circle cx="120" cy="120" r=“100" />   

      㔳䕎ך㣐ֹׁծ⡘縧ծػأ䕎朐זו׾䭷㹀ׅ׷ 㾩䚍כծ$44דכ䭷㹀דֹזְ
  10. 47(%0.،صً٦ءّٝ var rect = document.createElementNS("http://www.w3.org/2000/svg", "rect"); rect.setAttribute("x", "50"); rect.setAttribute("y", "50");

    rect.setAttribute("width", "100"); rect.setAttribute("height", "100"); rect.setAttribute("fill", "red"); var rot = 0; setInterval(function(){ rect.setAttribute("transform", "rotate(" + rot + " 100 100)"); rot = rot + 1; }, 10); document.querySelector("svg").appendChild(rect);
  11. 47(%0.،صً٦ءّٝ 47(欽ך،صً٦ءّٝٓ؎ـٓٔ׾⢪ֲֶ IUUQTHSFFOTPDLDPN IUUQKVMJBODPNSFTFBSDIWFMPDJUZ IUUQTOBQTWHJP 넝堣腉ז窟さ،صً٦ءّٝٓ ؎ـٓٔկ 47(ך،صً٦ءّٝ欽鷿׀ה חفؚٓ؎ٝ׾㼪Ⰵ׃ג⢪欽ׅ ׷կ׍׳׏הꨇ׃ְկ

    K2VFSZךBOJNBUF✼䳔הז׏ג ְ׷،صً٦ءّٝٓ؎ـٓٔկ 〳腉זꣲ׶$44׾⢪׏גֻ׸׷ ךד،صً٦ءّٝך넝鸞⻉ָ 㔳׸׷կ 㸣Ⰻח47(㼔欽ךٓ؎ـٓٔկ
 47(ך欰䧭װծ㢩鿇ך47(ؿ؋ ؎ٕ׾《׶鴥׿דⰻ鿇׾乼⡲ׅ ׷ֿה׮〳腉կ
 K2VFSZٓ؎ؙח剅ֽ׷կ 넝堣腉 ֶׅׅ׭
  12. 47(ךٖأهٝءـ⻉כ 鋵銲稆ךQBEEJOHUPQד TWHXSBQ TWH .svg-wrap > svg { display: block;

    position: absolute; max-width: 100%; width: 100%; height: 100%; } .svg-wrap { position: relative; height:0; padding-top: 60%; } ֿך㜥さכծTWH銲稆ךXJEUI  IFJHIUכ䭷㹀׃זְֿה 1PJOU