{"id":374,"date":"2015-10-23T15:00:42","date_gmt":"2015-10-23T06:00:42","guid":{"rendered":"http:\/\/www.takaya-com.jp\/archives\/?p=374"},"modified":"2015-10-23T14:48:57","modified_gmt":"2015-10-23T05:48:57","slug":"svg_css3_transform_sp3","status":"publish","type":"post","link":"https:\/\/takaya-com.jp\/archives\/2015\/10\/svg_css3_transform_sp3\/","title":{"rendered":"SVG\u306epolygon\u3067\u751f\u6210\u3057\u305f\u6b63\u4e09\u89d2\u5f62\u306e\u56de\u8ee2\u306e\u4e2d\u5fc3\u3092\u6bd4\u8f03"},"content":{"rendered":"<p>SVG\u306epolygon\u3067\u6b63\u4e09\u89d2\u5f62\u3092\u751f\u6210\u3057\u3001\u305d\u306e\u4e09\u89d2\u5f62\u306e\u4e2d\u5fc3\u3092\u56de\u8ee2\u306e\u4e2d\u5fc3\u3068\u91cd\u306d\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u4e09\u89d2\u5f62\u306e\u4e2d\u5fc3\u70b9\u306e\u5ea7\u6a19(x,y)\u306f(x1+x2+x3)\/3 , (y1+y2+y3)\/3\u3000\u3067\u5f97\u3089\u308c\u308b\u306e\u3067\u3001polygon\u3092\u751f\u6210\u3059\u308b\u969b\u306epoints\u306e\u5024\u3092\u305d\u306e\u307e\u307e\u5229\u7528\u3067\u304d\u307e\u3059\uff08\u4eca\u56de\u306f\u30d7\u30ed\u30b0\u30e9\u30e0\u51e6\u7406\u3067\u306f\u306a\u304f\u8a08\u7b97\u3055\u308c\u305f\u5024\u3092\u624b\u5165\u529b\u3057\u3066\u3042\u308a\u307e\u3059\uff09\u3002<\/p>\n<p>  <!--more--><\/p>\n<p>CSS\u306e\u7acb\u4f53\u5316\u3067\u6b63\u4e09\u89d2\u5f62\u3092\u7d44\u307f\u7acb\u3066\u3066\u3001\u6b63\u56db\u9762\u4f53\u3084\u6b63\u4e8c\u5341\u9762\u4f53\u306a\u3069\u3059\u308b\u969b\u306b\u306f\u3001\u307e\u305a\u4e2d\u5fc3\u3068\u5408\u308f\u305b\u3066\u3084\u308b\u3068\u3042\u3068\u306e\u4f5c\u696d\u304c\u6357\u308a\u307e\u3059\u3002<\/p>\n<p>\u2193\u4ee5\u4e0b\u304c\u5b9f\u969b\u306e\u30bd\u30fc\u30b9\u30b5\u30f3\u30d7\u30eb\u3067\u3059\u3002<\/p>\n<p>\u25bcJavaScript<\/p>\n<pre class=\"lang:js decode:true \" title=\"JavaScript\" >\r\n<script>\r\nvar degZ = 0;\r\nsetInterval(\"draw()\",66);\r\n\r\nfunction draw(){\r\n\tdegZ=(degZ+1+360)%360;\r\n\tz=\"rotateZ(\"+degZ+\"deg) translateZ(100px)\";\r\n\tvar container = document.getElementById(\"container\");\r\n\tcontainer.style.webkitTransform = z;\r\n}\r\n<\/script>\r\n<\/pre>\n<p>\u25bcCSS<\/p>\n<pre class=\"lang:css decode:true \" title=\"CSS\" >\r\n<style>\r\n#container{\r\n\ttransform-style: preserve-3d;\r\n\twidth:400px;\r\n\theight:400px;\r\n\tposition:relative;\r\n\ttransform-origin:200px 200px;\r\n}\r\nsvg{\r\n\ttransform-style: preserve-3d;\r\n\tposition:absolute;\r\n\twidth:400px;\r\n\theight:400px;\r\n}\r\nline{\r\n\tstroke:black;\r\n\tstroke-width:3;\r\n}\r\n#line_2{\r\n\ttransform:rotateZ(120deg);\r\n}\r\n#line_3{\r\n\ttransform:rotateZ(60deg);\r\n}\r\n\r\npolygon{\r\n\topacity:0.7;\r\n}\r\n#pg_1{\r\n\tfill:#00f;\r\n}\r\n#pg_2{\r\n\tfill:#f00;\r\n}\r\n<\/style>\r\n<\/pre>\n<p>\u25bcHTML<\/p>\n<pre class=\"lang:xhtml decode:true \" title=\"XHTML\" >\r\n<div id=\"container\">\r\n\t<svg id=\"line_1\" viewBox=\"-200 -200 600 600\">\r\n   \t\t<line x1=\"-100\" y1=\"100\" x2=\"300\" y2=\"100\" \/>\r\n\t<\/svg>\r\n\t<svg id=\"line_2\" viewBox=\"-200 -200 600 600\">\r\n   \t\t<line x1=\"-100\" y1=\"100\" x2=\"300\" y2=\"100\" \/> \r\n\t<\/svg>\r\n\t<svg id=\"line_3\" viewBox=\"-200 -200 600 600\">\r\n   \t\t<line x1=\"-100\" y1=\"100\" x2=\"300\" y2=\"100\" \/> \r\n\t<\/svg>\r\n\r\n   \t<svg class=\"panel\" id=\"group_1\" viewBox=\"-200 -200 600 600\">\r\n\t\t<polygon id=\"pg_1\" points=\"42,0 42,200 215,100\" \/>\r\n\t\t<polygon id=\"pg_2\" points=\"0,0 0,200 173,100\" \/>\r\n\t<\/svg>\r\n<\/div>\r\n<\/pre>\n<p><a href=\"http:\/\/www.takaya-com.jp\/archives\/demo\/svg_css3_transform_sp3\/\" target=\"_blank\">\u30c7\u30e2\u30da\u30fc\u30b8\u306f\u3001\u3053\u3061\u3089<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>SVG\u306epolygon\u3067\u6b63\u4e09\u89d2\u5f62\u3092\u751f\u6210\u3057\u3001\u305d\u306e\u4e09\u89d2\u5f62\u306e\u4e2d\u5fc3\u3092\u56de\u8ee2\u306e\u4e2d\u5fc3\u3068\u91cd\u306d\u3066\u3044\u307e\u3059\u3002 \u4e09\u89d2\u5f62\u306e\u4e2d\u5fc3\u70b9\u306e\u5ea7\u6a19(x,y)\u306f(x1+x2+x3)\/3 , (y1+y2+y3)\/3\u3000\u3067\u5f97\u3089\u308c\u308b\u306e\u3067\u3001polygon\u3092\u751f\u6210\u3059\u308b\u969b\u306e [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1,3],"tags":[],"_links":{"self":[{"href":"https:\/\/takaya-com.jp\/archives\/wp-json\/wp\/v2\/posts\/374"}],"collection":[{"href":"https:\/\/takaya-com.jp\/archives\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/takaya-com.jp\/archives\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/takaya-com.jp\/archives\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/takaya-com.jp\/archives\/wp-json\/wp\/v2\/comments?post=374"}],"version-history":[{"count":2,"href":"https:\/\/takaya-com.jp\/archives\/wp-json\/wp\/v2\/posts\/374\/revisions"}],"predecessor-version":[{"id":377,"href":"https:\/\/takaya-com.jp\/archives\/wp-json\/wp\/v2\/posts\/374\/revisions\/377"}],"wp:attachment":[{"href":"https:\/\/takaya-com.jp\/archives\/wp-json\/wp\/v2\/media?parent=374"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/takaya-com.jp\/archives\/wp-json\/wp\/v2\/categories?post=374"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/takaya-com.jp\/archives\/wp-json\/wp\/v2\/tags?post=374"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}