{"id":5201,"date":"2021-05-10T12:00:59","date_gmt":"2021-05-10T03:00:59","guid":{"rendered":"https:\/\/www.sria.co.jp\/blog\/?p=5201"},"modified":"2021-05-11T10:32:14","modified_gmt":"2021-05-11T01:32:14","slug":"5201","status":"publish","type":"post","link":"https:\/\/www.sria.co.jp\/blog\/2021\/05\/5201\/","title":{"rendered":"JS\u596e\u95d8\u8a18\u3010JavaScript\u3068canvas\u3068\u7dda\u5f62\u5909\u63db \u305d\u306e5 ~\u5143\u306b\u623b\u3059\u51e6\u7406\u7de8~\u3011"},"content":{"rendered":"<p>\u3053\u3093\u306b\u3061\u306f\u3002\u30a8\u30f3\u30b8\u30cb\u30a2\u306e\u8fbb\u3067\u3059\u3002<br \/>\n\u524d\u56de\u306f\u3001\u7dda\u5f62\u5909\u63db\u306e\u30dd\u30a4\u30f3\u30c8\u3068\u884c\u5217\u7a4d\u306e\u7279\u5fb4\u3092\u898b\u3066\u304d\u307e\u3057\u305f\u3002<\/p>\n<p>\u4eca\u56de\u306f\u3001\u884c\u5217\u7a4d\u306e\u5fdc\u7528\u3063\u307d\u3044\u3053\u3068\u3092\u3084\u3063\u3066\u307f\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u3069\u3093\u306a\u4e8b\u3092\u3084\u308b\u304b\u3068\u3044\u3046\u3068\u300c<strong>canvas \u4e0a\u3067\u8907\u6570\u306e\u7dda\u5f62\u5909\u63db\u3092\u884c\u3063\u305f\u8981\u7d20\u3092\u4efb\u610f\u306e\u6642\u70b9\u307e\u3067\u623b\u3059<\/strong>\u300d\u6a5f\u80fd\u3092\u3064\u304f\u3063\u3066\u3044\u304d\u307e\u3059\u3002<br \/>\n\u3044\u308f\u3086\u308b\u300c<strong>\u5143\u306b\u623b\u3059<\/strong>\u300d\u6a5f\u80fd\u306e\u5b9f\u88c5\u3067\u3059\u3002<\/p>\n<p>\u300c\u5143\u306b\u623b\u3059\u300d\u6a5f\u80fd\u3063\u3066\u3001\u69d8\u3005\u306a\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306b\u5b9f\u88c5\u3055\u308c\u3066\u3044\u307e\u3059\u3088\u306d\u3002<br \/>\n\u8a00\u308f\u305a\u3082\u304c\u306a\u3001\u76f4\u524d\u306e\u52d5\u4f5c\u3092\u6253\u3061\u6d88\u3057\u3066\u3001\u30ef\u30f3\u30b9\u30c6\u30c3\u30d7\u524d\u306e\u72b6\u614b\u306b\u623b\u3059\u6a5f\u80fd\u3067\u3059\u3002<br \/>\nwindows \u306a\u3089 Ctrl + Z \u30ad\u30fc\u3067\u3002 Mac \u306a\u3089 Cmd + Z \u30ad\u30fc\u3067\u5b9f\u884c\u3067\u304d\u307e\u3059\u3002<br \/>\n\u79c1\u3082\u5927\u5909\u304a\u4e16\u8a71\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u203b\u524d\u56de\u306b\u6271\u3063\u305f\u884c\u5217\u7a4d\u306e\u7279\u5fb4\u300c<strong>\u884c\u5217\u7a4d\u306f\u8a08\u7b97\u3059\u308b\u9806\u756a\u306b\u3088\u3063\u3066\u7d50\u679c\u304c\u7570\u306a\u308b = \u8a08\u7b97\u9806\u5e8f\u304c\u91cd\u8981<\/strong>\u300d\u304c\u809d\u306b\u306a\u308a\u307e\u3059\u3002<br \/>\n\u3082\u3057\u524d\u56de\u306e\u8a18\u4e8b\u3092\u898b\u3066\u3044\u306a\u3044\u65b9\u306f\u3001<a href=\"https:\/\/www.sria.co.jp\/blog\/2021\/02\/5005\/\">JS\u596e\u95d8\u8a18\u3010JavaScript\u3068canvas\u3068\u7dda\u5f62\u5909\u63db \u305d\u306e4 ~\u7dda\u5f62\u5909\u63db\u306e\u30dd\u30a4\u30f3\u30c8\u3068\u884c\u5217\u7a4d\u306e\u7279\u5fb4\u7de8~\u3011<\/a>\u3092\u3054\u89a7\u304f\u3060\u3055\u3044\u3002<\/p>\n<h2>\u4eca\u56de\u306e\u6210\u679c\u7269<\/h2>\n<p>\u307e\u305a\u306f\u3058\u3081\u306b\u4eca\u56de\u306e\u6210\u679c\u7269\u3067\u3059\u3002<br \/>\n\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u306f\u4ee5\u4e0b\u304b\u3089\u78ba\u8a8d\u3067\u304d\u307e\u3059\u3002<\/p>\n<ol>\n<li><a href=\"https:\/\/github.com\/sriaTsuji\/public\/tree\/main\/canvas05\" target=\"_blank\" rel=\"noopener\">\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u4e00\u5f0f<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/sriaTsuji\/public\/blob\/main\/canvas05\/index.html\" target=\"_blank\" rel=\"noopener\">index.html<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/sriaTsuji\/public\/blob\/main\/canvas05\/main.js\" target=\"_blank\" rel=\"noopener\">main.js<\/a><\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<div><img loading=\"lazy\" class=\"aligncenter wp-image-5203\" src=\"https:\/\/www.sria.co.jp\/blog\/wp-content\/uploads\/2021\/05\/image01.png\" alt=\"\u623b\u3059\u51e6\u7406\u306e\u5b9f\u88c5\u753b\u9762\" width=\"1000\" height=\"400\" srcset=\"https:\/\/www.sria.co.jp\/blog\/wp-content\/uploads\/2021\/05\/image01.png 1000w, https:\/\/www.sria.co.jp\/blog\/wp-content\/uploads\/2021\/05\/image01-300x120.png 300w, https:\/\/www.sria.co.jp\/blog\/wp-content\/uploads\/2021\/05\/image01-768x307.png 768w\" sizes=\"(max-width: 1000px) 100vw, 1000px\" \/><\/div>\n<p>&nbsp;<\/p>\n<p>\u753b\u9762\u306e\u69cb\u6210\u81ea\u4f53\u306f\u524d\u56de\u3068\u307b\u307c\u540c\u69d8\u3067\u3059\u3002<br \/>\n1 \u3064\u3060\u3051\u7570\u306a\u308b\u306e\u306f\u3001\u753b\u9762\u5de6\u4e0b\u306b\u300c\u623b\u308b\u300d\u30dc\u30bf\u30f3\u3092\u5b9f\u88c5\u3057\u3066\u3044\u308b\u70b9\u3067\u3059\u3002<br \/>\n\u3053\u306e\u300c\u623b\u308b\u300d\u30dc\u30bf\u30f3\u3092\u62bc\u4e0b\u3057\u3066\u3044\u304f\u3068\u3001\u8907\u6570\u56de\u306e\u7dda\u5f62\u5909\u63db\u3092\u884c\u3063\u3066\u5ea7\u6a19\u3092\u5909\u3048\u3066\u3044\u3063\u305f\u8981\u7d20\uff08\u70b9 P&#8221;&#8221;\uff09\u3092\u30ef\u30f3\u30b9\u30c6\u30c3\u30d7\u305a\u3064\u5909\u63db\u524d\u306e\u5ea7\u6a19\u3078\u623b\u3057\u3066\u3044\u304f\u4e8b\u304c\u3067\u304d\u307e\u3059\u3002<br \/>\n\uff08\u5909\u63db\u524d\u306e\u5ea7\u6a19\u3078\u623b\u3057\u305f\u6642\u306b\u3001\u305d\u306e\u5ea7\u6a19\u3078\u8d64\u30dc\u30c3\u30af\u30b9\u304c\u63cf\u753b\u3055\u308c\u3066\u3044\u304d\u307e\u3059\u3002\uff09<\/p>\n<p>&nbsp;<\/p>\n<div><img loading=\"lazy\" class=\"aligncenter wp-image-5204\" src=\"https:\/\/www.sria.co.jp\/blog\/wp-content\/uploads\/2021\/05\/image02.png\" alt=\"\u623b\u3059\" width=\"1000\" height=\"400\" srcset=\"https:\/\/www.sria.co.jp\/blog\/wp-content\/uploads\/2021\/05\/image02.png 1000w, https:\/\/www.sria.co.jp\/blog\/wp-content\/uploads\/2021\/05\/image02-300x120.png 300w, https:\/\/www.sria.co.jp\/blog\/wp-content\/uploads\/2021\/05\/image02-768x307.png 768w\" sizes=\"(max-width: 1000px) 100vw, 1000px\" \/><\/div>\n<p>&nbsp;<\/p>\n<p>\u70b9 P \u306b\u306f\u4ee5\u4e0b\u306e\u9806\u3067\u3001\u7dda\u5f62\u5909\u63db\u3092\u884c\u3063\u3066\u3044\u307e\u3059\u3002<br \/>\n\u307e\u305a\u306f\u3058\u3081\u306b (75, 75)\u306b\u70b9 P \u3092\u63cf\u753b\u3057\u307e\u3059\u3002\u3053\u308c\u304c\u521d\u671f\u4f4d\u7f6e\u3067\u3059\u3002<\/p>\n<p>\u305d\u306e\u5f8c\u306f\u2026<\/p>\n<ol>\n<li>x \u8ef8\u306b\u5bfe\u3057\u3066\u53cd\u8ee2\u3059\u308b\uff08\u70b9 P&#8217;\uff09<\/li>\n<li>x \u8ef8\u65b9\u5411\u3078\u8ddd\u96e2\u3092 2 \u500d\u3059\u308b\uff08\u70b9 P&#8221;\uff09<\/li>\n<li>y \u8ef8\u65b9\u5411\u3078\u8ddd\u96e2\u3092 3 \u500d\u306b\u3059\u308b\uff08\u70b9 P&#8221;&#8217;\uff09<\/li>\n<li>y \u8ef8\u306b\u5bfe\u3057\u3066\u53cd\u8ee2\u3059\u308b\uff08\u70b9 P&#8221;&#8221;\uff09<\/li>\n<\/ol>\n<p>\u2026\u3068\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u300c\u623b\u308b\u300d\u30dc\u30bf\u30f3\u3092 1 \u56de\u62bc\u305b\u3070\u30013. \u306e\u6642\u70b9\u306b\u623b\u308a\u30012 \u56de\u62bc\u305b\u3070\u30012.\u306e\u6642\u70b9\u3078\u623b\u308a\u307e\u3059\u3002<br \/>\n\u305d\u3057\u3066\u30014 \u56de\u62bc\u305b\u3070\u3001\u4e00\u756a\u306f\u3058\u3081\u306e\u5ea7\u6a19 \u70b9P\uff0875,75\uff09\u307e\u3067\u623b\u308a\u307e\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n<div><img loading=\"lazy\" class=\"aligncenter wp-image-5205\" src=\"https:\/\/www.sria.co.jp\/blog\/wp-content\/uploads\/2021\/05\/image03.png\" alt=\"\u70b9P'\u301c\u70b9P''''\" width=\"1000\" height=\"400\" srcset=\"https:\/\/www.sria.co.jp\/blog\/wp-content\/uploads\/2021\/05\/image03.png 1000w, https:\/\/www.sria.co.jp\/blog\/wp-content\/uploads\/2021\/05\/image03-300x120.png 300w, https:\/\/www.sria.co.jp\/blog\/wp-content\/uploads\/2021\/05\/image03-768x307.png 768w\" sizes=\"(max-width: 1000px) 100vw, 1000px\" \/><\/div>\n<h2>\u300c\u5143\u306b\u623b\u3059\u300d\u6a5f\u80fd\u306e 2 \u30d1\u30bf\u30fc\u30f3\u306e\u5b9f\u88c5\u65b9\u6cd5<\/h2>\n<p>\u3055\u3066\u3001\u3055\u3063\u305d\u304f\u300c\u5143\u306b\u623b\u3059\u300d\u6a5f\u80fd\u306e\u4e2d\u8eab\u3092\u898b\u3066\u3044\u304d\u305f\u3044\u306e\u3067\u3059\u304c\u2026\u3001<br \/>\n\u305d\u306e\u524d\u306b\u3001\u3053\u306e\u6a5f\u80fd\u306e\u5b9f\u88c5\u65b9\u6cd5\u3092 2 \u30d1\u30bf\u30fc\u30f3\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n<p>\u300c\u5143\u306b\u623b\u3059\u300d\u6a5f\u80fd\u306b\u306f\u3001\u69d8\u3005\u306a\u5b9f\u88c5\u65b9\u6cd5\u304c\u3042\u308b\u304b\u3068\u601d\u3044\u307e\u3059\u304c\u3001\u3060\u3044\u305f\u3044\u306e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306f\u4ee5\u4e0b\u306e 2 \u30d1\u30bf\u30fc\u30f3\u306e\u3044\u305a\u308c\u304b\u3067\u3001\u5b9f\u88c5\u3055\u308c\u3066\u3044\u308b\u306e\u3067\u306f\u306a\u3044\u3067\u3057\u3087\u3046\u304b\u3002<\/p>\n<ul>\n<li>\u305d\u306e 1. \u5404\u6642\u70b9\u306e\u72b6\u614b\u3092\u5c65\u6b74\u3067\u7ba1\u7406\u3059\u308b<\/li>\n<li>\u305d\u306e 2. \u4f5c\u696d\u5bfe\u8c61\u3068\u4f5c\u696d\u5185\u5bb9\u306e\u307f\u3067\u5c65\u6b74\u3092\u7ba1\u7406\u3059\u308b<\/li>\n<\/ul>\n<h3>\u305d\u306e 1. \u5404\u6642\u70b9\u306e\u72b6\u614b\u3092\u5c65\u6b74\u3067\u7ba1\u7406\u3059\u308b<\/h3>\n<p>\u300c\u5143\u306b\u623b\u3059\u300d\u6a5f\u80fd\u306e\u6700\u3082\u30b7\u30f3\u30d7\u30eb\u306a\u5b9f\u88c5\u65b9\u6cd5\u3067\u3059\u3002<br \/>\n\u305f\u3060\u5358\u7d14\u306b\u3001<strong>\u305d\u306e\u6642\u70b9\u306b\u304a\u3051\u308b\u72b6\u614b\u3059\u3079\u3066\u3092\u5c65\u6b74\u306b\u5165\u308c\u3066\u7ba1\u7406<\/strong>\u3057\u307e\u3059\u3002<\/p>\n<p>\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u5c65\u6b74\u3092\u7ba1\u7406\u3059\u308b\u914d\u5217\uff08history\uff09\u3092\u7528\u610f\u3057\u307e\u3059\u3002<br \/>\nhistory \u306e\u4e00\u756a\u306f\u3058\u3081\u306b\u306f\u3001\u521d\u671f\u72b6\u614b\u3092\u683c\u7d0d\u3057\u307e\u3059\u3002<br \/>\n\u30e6\u30fc\u30b6\u30fc\u304c\u4f55\u304b\u3057\u3089\u306e\u4f5c\u696d\u3092\u884c\u3063\u305f\u5834\u5408\u3001\u305d\u306e\u4f5c\u696d\u7d50\u679c\u306e\u72b6\u614b\u3092 history \u306b\u8ffd\u52a0\u3057\u3066\u3044\u304d\u307e\u3059\u3002<br \/>\n\u3053\u3046\u3057\u3066\u5404\u6642\u70b9\u3067\u306e\u72b6\u614b\u304c history \u306b\u683c\u7d0d\u3055\u308c\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<pre>\n\/\/ \u5c65\u6b74\u3092\u7ba1\u7406\u3059\u308b\u914d\u5217\nhistory = [\n  \/\/ \u521d\u671f\u72b6\u614b\n  [\n    {\n      id: A,\n      point: [0, 1]\n    },\n    {\n      id: B,\n      point: [0, 2]\n    },\n    \u2026\n  ],\n  \/\/ 1\u56de\u76ee\u306e\u4f5c\u696d\u5f8c\u306e\u72b6\u614b\n  [\n    {\n      id: A,\n      point: [3, 4]\n    },\n    {\n      id: B,\n      point: [3, 8]\n    },\n    \u2026\n  ],\n  \/\/ 2\u56de\u76ee\u306e\u4f5c\u696d\u5f8c\u306e\u72b6\u614b\n  [\n    {\n      id: A,\n      point: [3, 5]\n    },\n    {\n      id: B,\n      point: [12, 6]\n    },\n    \u2026\n  ],\n  \u2026,\n  \/\/ n\u56de\u76ee\u306e\u4f5c\u696d\u5f8c\u306e\u72b6\u614b\n  [\u2026]\n]\n<\/pre>\n<p>\u3042\u308b\u6642\u70b9\u307e\u3067\u5143\u306b\u623b\u3059\u5834\u5408\u306f\u3001history \u306e\u4e2d\u8eab\u3092\u898b\u3066\u3044\u304d\u3001\u3042\u308b\u6642\u70b9\u306e index \u756a\u76ee + 1\u306e\u72b6\u614b\u3092\u53d6\u308a\u51fa\u3057\u3066\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u72b6\u614b\u306b\u53cd\u6620\u3057\u307e\u3059\u3002<br \/>\n\uff08 + 1 \u3059\u308b\u306e\u306f\u3001\u914d\u5217\u306e\u6570\u3048\u9806\u304c 0 \u304b\u3089\u59cb\u307e\u308b\u305f\u3081\u3067\u3059\u3002\uff09<\/p>\n<p>\u8981\u306f<strong>\u5404\u6642\u70b9\u306e\u72b6\u614b\u3059\u3079\u3066\u3092\u914d\u5217\u306b\u3076\u3061\u8fbc\u3093\u3067\u7ba1\u7406\u3059\u308b<\/strong>\u3068\u3044\u3046\u529b\u6280\u3067\u3059\u3002<br \/>\n\u30b7\u30f3\u30d7\u30eb\u306a\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3067\u3042\u308c\u3070\u3001\u4e0a\u8a18\u306e\u65b9\u6cd5\u3067\u4e8b\u8db3\u308a\u308b\u304b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p><strong>\u3057\u304b\u3057\u3001\u5c65\u6b74\u3068\u3057\u3066\u7ba1\u7406\u3057\u305f\u3044\u8981\u7d20\u306e\u6570\u304c\u591a\u304f\u306a\u3063\u305f\u5834\u5408\u3001\u5927\u5909\u306a\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002<\/strong><\/p>\n<p>\u4f8b\u3048\u3070\u3001\u8981\u7d20\u304c 100 \u30b3\u3042\u308b\u914d\u5217\u306e\u72b6\u614b\u3092\u7ba1\u7406\u3057\u305f\u3044\u3068\u3057\u307e\u3057\u3087\u3046\u3002<br \/>\n\u3059\u308b\u3068\u3001history \u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u3063\u3066\u3057\u307e\u3044\u307e\u3059\u3002<\/p>\n<pre>\nhistory = [\n  [\u2026], \/\/ 100 \u4ef6\u306e Array\u3002\u521d\u671f\u72b6\u614b\u3002\n  [\u2026], \/\/ 100 \u4ef6\u306e Array\u30021\u56de\u76ee\u306e\u4f5c\u696d\u5f8c\u306e\u72b6\u614b\u3002\n  [\u2026], \/\/ 100 \u4ef6\u306e Array\u30022\u56de\u76ee\u306e\u4f5c\u696d\u5f8c\u306e\u72b6\u614b\u3002\n  \u2026,\n  [\u2026], \/\/ 100 \u4ef6\u306e Array\u3002n\u56de\u76ee\u306e\u4f5c\u696d\u5f8c\u306e\u72b6\u614b\u3002\n]\n<\/pre>\n<p>\u3053\u308c\u3067\u306f\u3001\u5c65\u6b74\u306e\u7ba1\u7406\u3060\u3051\u3067\u30ea\u30bd\u30fc\u30b9\u3092\u98df\u3044\u3064\u3076\u3057\u304b\u306d\u307e\u305b\u3093\u3002<br \/>\n\u8981\u7d20\u6570\u306e\u591a\u3044\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u5c65\u6b74\u3092\u7ba1\u7406\u3057\u305f\u3044\u5834\u5408\u306f\u3001\u6b21\u306e\u3088\u3046\u306a<strong>\u4f5c\u696d\u5bfe\u8c61\u3068\u4f5c\u696d\u5185\u5bb9\u306e\u307f\u3067\u5c65\u6b74\u3092\u7ba1\u7406\u3059\u308b\u65b9\u6cd5<\/strong>\u3092\u30aa\u30b9\u30b9\u30e1\u3057\u307e\u3059\u3002<\/p>\n<h3>\u305d\u306e 2. \u4f5c\u696d\u5bfe\u8c61\u3068\u4f5c\u696d\u5185\u5bb9\u306e\u307f\u3067\u5c65\u6b74\u3092\u7ba1\u7406\u3059\u308b<\/h3>\n<p>\u5b9f\u306f\u300c\u4f5c\u696d\u5bfe\u8c61\u300d\u3068\u300c\u4f5c\u696d\u5185\u5bb9 = \u4f55\u306e\u51e6\u7406\u3092\u3057\u305f\u304b\u300d\u304c\u5206\u304b\u308c\u3070\u3001\u5c65\u6b74\u3092\u7c21\u5358\u306b\u7ba1\u7406\u3059\u308b\u4e8b\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u307e\u305a\u5c65\u6b74\u3092\u7ba1\u7406\u3059\u308b\u914d\u5217\u3092\u7528\u610f\u3057\u307e\u3059\u3002<br \/>\n\u305d\u3057\u3066\u3001\u30e6\u30fc\u30b6\u30fc\u304c\u306a\u306b\u304b\u3057\u3089\u306e\u4f5c\u696d\u3092\u884c\u3063\u305f\u6642\u306b\u3001\u5c65\u6b74\u3078<strong>\u300c\u4f5c\u696d\u5bfe\u8c61\u300d\u3068\u300c\u4f5c\u696d\u5185\u5bb9 = \u4f55\u306e\u51e6\u7406\u3092\u3057\u305f\u304b\u300d<\/strong>\u3092\u683c\u7d0d\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<p>\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30a4\u30e1\u30fc\u30b8\u3067\u3059\u3002<\/p>\n<pre>\n\/\/ \u521d\u671f\u72b6\u614b\nstatus = {\n  objectA = {\n    \u2026\n  },\n  objectB = {\n    \u2026\n  },\n}\n\n\n\/\/ \u5c65\u6b74\u3092\u7ba1\u7406\u3059\u308b\u914d\u5217\nhistory = [\n   \/\/ 1\u56de\u76ee\u306e\u4f5c\u696d\n  {\n    target: status.objectA, \/\/ \u4f5c\u696d\u5bfe\u8c61\n    func: hoge \/\/ \u4f5c\u696d\u5185\u5bb9 = \u4f55\u306e\u51e6\u7406\u3092\u3057\u305f\u304b\n  },\n  \/\/ 2\u56de\u76ee\u306e\u4f5c\u696d\n  {\n    target: status.objectB,\n    func: fuga\n  },\n  \u2026,\n  \/\/ n\u56de\u76ee\u306e\u4f5c\u696d\n  {\n    target: status.objectA,\n    func: piyo\n  },\n]\n<\/pre>\n<p>\u3042\u308b\u6642\u70b9\u307e\u3067\u5143\u306b\u623b\u3059\u51e6\u7406\u306e\u6d41\u308c\u306f\u3001\u4ee5\u4e0b\u306e\u901a\u308a\u3067\u3059\u3002<\/p>\n<p>\u307e\u305a history \u306e\u4e2d\u8eab\u3092\u898b\u3066\u3044\u304d\u307e\u3059\u3002<br \/>\n\u305d\u3057\u3066\u3001&#8221;\u3042\u308b\u6642\u70b9\u306e index \u756a\u76ee + 1 &#8220;\u307e\u3067\u306e\u300c\u4f5c\u696d\u5bfe\u8c61\u300d\u3068\u300c\u4f5c\u696d\u5185\u5bb9 = \u4f55\u306e\u51e6\u7406\u3092\u3057\u305f\u304b\u300d\u3092\u53d6\u308a\u51fa\u3057\u307e\u3059\u3002<br \/>\n\u3053\u306e\u300c\u4f5c\u696d\u5bfe\u8c61\u300d\u3068\u300c\u4f5c\u696d\u5185\u5bb9\u300d\u3092\u5143\u306b\u3001<strong>\u4f5c\u696d\u5bfe\u8c61\u3078\u3001\u4f5c\u696d\u5185\u5bb9\u3092\u6253\u3061\u6d88\u3059\u51e6\u7406\u3092\u9806\u756a\u306b\u5b9f\u884c\u3057\u307e\u3059<\/strong>\u3002<br \/>\n\u3053\u306e\u3088\u3046\u306b\u3057\u3066\u3001\u5c65\u6b74\u306e\u300c\u4f5c\u696d\u5bfe\u8c61\u300d\u3068\u300c\u4f5c\u696d\u5185\u5bb9\u300d\u306b\u6cbf\u3063\u3066\u3001\u72b6\u614b\u3092 1 \u3064\u305a\u3064\u5143\u306b\u623b\u3057\u3066\u3044\u304f\u4e8b\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>2.\u306e\u65b9\u6cd5\u306f\u3001\u7dda\u5f62\u5909\u63db\u306e\u7279\u5fb4\u300c<strong>\u884c\u5217\u7a4d\u306f\u8a08\u7b97\u3059\u308b\u9806\u756a\u306b\u3088\u3063\u3066\u7d50\u679c\u304c\u7570\u306a\u308b = \u8a08\u7b97\u9806\u5e8f\u304c\u91cd\u8981<\/strong>\u300d\u3068\u3001\u3046\u307e\u304f\u30de\u30c3\u30c1\u3057\u3066\u3044\u308b\u305f\u3081\u3001\u63cf\u753b\u51e6\u7406\u306e\u5c65\u6b74\u7ba1\u7406\u306b\u9069\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u307e\u305f\u30011.\u306e\u65b9\u6cd5\u306b\u6bd4\u3079\u3066\u3001<strong>\u300c\u4f5c\u696d\u5bfe\u8c61\u300d\u3068\u300c\u4f5c\u696d\u5185\u5bb9\u300d\u306e\u307f\u3067\u5c65\u6b74\u3092\u7ba1\u7406\u3067\u304d\u308b<\/strong>\u305f\u3081\u3001\u30ea\u30bd\u30fc\u30b9\u3092\u6291\u3048\u3089\u308c\u308b\u30e1\u30ea\u30c3\u30c8\u3082\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>2.\u306e\u65b9\u6cd5\u3067\u3001\u8981\u7d20\u6570 100 \u30b3\u306e\u914d\u5217\u306e\u5909\u66f4\u5c65\u6b74\u3092\u7ba1\u7406\u3059\u308b\u5834\u5408\u3092\u8003\u3048\u3066\u307f\u307e\u3057\u3087\u3046\u3002<br \/>\n\u2026\u3068\u8a00\u3063\u3066\u3082\u3001\u7279\u5225\u306b\u4f55\u304b\u306e\u624b\u3092\u52a0\u3048\u308b\u5fc5\u8981\u306f\u3042\u308a\u307e\u305b\u3093\u3002<\/p>\n<p>\u8981\u7d20\u6570\u304c\u5897\u3048\u3088\u3046\u304c\u3001\u300c\u4f5c\u696d\u5bfe\u8c61\u300d\u3068\u300c\u4f5c\u696d\u5185\u5bb9\u300d\u306e\u307f\u304c\u5206\u304b\u308c\u3070\u826f\u3044\u306e\u3067\u3001\u30e6\u30fc\u30b6\u30fc\u304c\u4f5c\u696d\u3092\u884c\u3046\u305f\u3073\u306b\u3001\u5c65\u6b74\u306b\u300c\u4f5c\u696d\u5bfe\u8c61\u300d\u3068\u300c\u4f5c\u696d\u5185\u5bb9\u300d\u3092\u8ffd\u52a0\u3057\u3066\u3044\u3051\u3070 OK \u3067\u3059\u3002<br \/>\n\u4efb\u610f\u306e\u6642\u70b9\u307e\u3067\u72b6\u614b\u3092\u623b\u3059\u5834\u5408\u306f\u3001\u300c\u4f5c\u696d\u5bfe\u8c61\u300d\u3068\u300c\u4f5c\u696d\u5185\u5bb9\u300d\u3092 1 \u3064 1 \u3064\u53d6\u308a\u51fa\u3057\u3066\u3001\u6253\u3061\u6d88\u3057\u51e6\u7406\u3092\u9806\u756a\u306b\u5b9f\u884c\u3057\u3066\u3044\u3051\u3070\u3001\u5b8c\u4e86\u3067\u3059\u3002<br \/>\n1.\u306e\u3088\u3046\u306b 100 \u30b3\u306e\u72b6\u614b\u3059\u3079\u3066 x n \u56de\u5206\u3092\u7ba1\u7406\u3059\u308b\u5fc5\u8981\u304c\u306a\u3044\u306e\u3067\u3001\u975e\u5e38\u306b\u52b9\u7387\u7684\u3067\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>\u4eca\u56de\u306e\u6210\u679c\u7269\u306f\u30012.\u306e\u65b9\u6cd5\u3067\u300c\u5143\u306b\u623b\u3059\u300d\u6a5f\u80fd\u3092\u5b9f\u88c5\u3057\u3066\u3044\u307e\u3059\u3002<br \/>\n\u3067\u306f\u3001\u6210\u679c\u7269\u306e\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u3092\u898b\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<h2>\u300c\u5143\u306b\u623b\u3059\u300d\u6a5f\u80fd\u306e\u4e2d\u8eab<\/h2>\n<p>\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u306f\u4ee5\u4e0b\u304b\u3089\u78ba\u8a8d\u3067\u304d\u307e\u3059\u3002<\/p>\n<ol>\n<li><a href=\"https:\/\/github.com\/sriaTsuji\/public\/tree\/main\/canvas05\" target=\"_blank\" rel=\"noopener\">\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u4e00\u5f0f<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/sriaTsuji\/public\/blob\/main\/canvas05\/index.html\" target=\"_blank\" rel=\"noopener\">index.html<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/sriaTsuji\/public\/blob\/main\/canvas05\/main.js\" target=\"_blank\" rel=\"noopener\">main.js<\/a><\/li>\n<\/ol>\n<p>\u753b\u9762\u306e\u521d\u671f\u63cf\u753b\u306f\u524d\u56de\u307e\u3067\u3068\u540c\u69d8\u3067\u3059\u3002<br \/>\n\u4eca\u56de\u306f\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u3092\u8ffd\u8a18\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u25bcmain.js<\/p>\n<pre>\n\/\/ \u5909\u63db\u306e\u5c65\u6b74\nconst history = []\n\n\/\/ \u4e2d\u7565\n\n\/\/ \u5143\u306b\u623b\u3059\u51e6\u7406\nconst undo = () => {\n  \/\/ \u5909\u63db\u306e\u5c65\u6b74\u304c\u306a\u3044\u5834\u5408\n  if (history.length === 0) return\n\n  switch (history[history.length - 1].func) {\n    case 'inversionX':\n      \/\/ x\u8ef8\u306b\u5bfe\u3057\u3066\u53cd\u8ee2\u51e6\u7406\u3092\u623b\u3059\n      history[history.length - 1].target.x = inversionXTransformation(history[history.length - 1].target).x\n      history[history.length - 1].target.y = inversionXTransformation(history[history.length - 1].target).y\n      break\n    case 'inversionY':\n      \/\/ y\u8ef8\u306b\u5bfe\u3057\u3066\u53cd\u8ee2\u51e6\u7406\u3092\u623b\u3059\n      history[history.length - 1].target.x = inversionYTransformation(history[history.length - 1].target).x\n      history[history.length - 1].target.y = inversionYTransformation(history[history.length - 1].target).y\n      break\n    case 'multipe':\n      \/\/ n\u500d\u3092\u623b\u3059\n      const nx = history[history.length - 1].args.nx\n      const ny = history[history.length - 1].args.ny\n      history[history.length - 1].target.x = multipeTransformation(history[history.length - 1].target, 1 \/ nx, 1 \/ ny).x\n      history[history.length - 1].target.y = multipeTransformation(history[history.length - 1].target, 1 \/ nx, 1 \/ ny).y\n      break\n    default:\n      break\n  }\n\n  \/\/ \u5c65\u6b74\u306e\u672b\u5c3e\u3092\u6d88\u53bb\n  history.pop()\n}\n\nwindow.onload = function () {\n  returnButton = document.getElementById('returnButton')\n  \/\/ \u521d\u671f\u5316\u51e6\u7406\n  init()\n  \/\/ \u539f\u70b9\u3092\u63cf\u753b\n  drawCircle(0, 0, 4, '#000000')\n  \/\/ y\u8ef8\u3092\u63cf\u753b\n  drawLine(0, -(height \/ 2), 0, height \/ 2)\n  \/\/ x\u8ef8\u3092\u63cf\u753b\n  drawLine(-(width \/ 2), 0, width \/ 2, 0)\n\n  \/\/ \u7dda\u5f62\u5909\u63db\u524d\u306e\u70b9\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\n  const rect01 = {\n    x: 75,\n    y: 75\n  }\n  \/\/ \u30dc\u30c3\u30af\u30b9\u306e\u5927\u304d\u3055\n  const boxSize = 20\n  \/\/ \u521d\u671f\u914d\u7f6e\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u63cf\u753b\n  drawRect(rect01.x - boxSize \/ 2, rect01.y - boxSize \/ 2, boxSize, boxSize, 'orange')\n\n  \/\/ 1. x \u8ef8\u306b\u5bfe\u3057\u3066\u53cd\u8ee2\u3059\u308b\n  rect01.x = inversionXTransformation(rect01).x\n  rect01.y = inversionXTransformation(rect01).y\n  \/\/ 1. \u3092\u5c65\u6b74\u306b\u8ffd\u52a0\n  history.push({\n    target: rect01,\n    func: 'inversionX'\n  })\n  \/\/ 1. \u306e\u7d50\u679c\u3092\u63cf\u753b\n  drawRect(rect01.x - boxSize \/ 2, rect01.y - boxSize \/ 2, boxSize, boxSize, 'green')\n\n  \/\/ 2. x \u8ef8\u65b9\u5411\u3078\u8ddd\u96e2\u3092 2 \u500d\u3059\u308b\n  rect01.x = multipeTransformation(rect01, 2, 1).x\n  rect01.y = multipeTransformation(rect01, 2, 1).y\n  \/\/ 2. \u3092\u5c65\u6b74\u306b\u8ffd\u52a0\n  history.push({\n    target: rect01,\n    func: 'multipe',\n    args: {\n      nx: 2,\n      ny: 1\n    }\n  })\n  \/\/ 2. \u306e\u7d50\u679c\u3092\u63cf\u753b\n  drawRect(rect01.x - boxSize \/ 2, rect01.y - boxSize \/ 2, boxSize, boxSize, 'green')\n\n  \/\/ 3. y \u8ef8\u65b9\u5411\u3078\u8ddd\u96e2\u3092 3 \u500d\u3059\u308b\n  rect01.x = multipeTransformation(rect01, 1, 3).x\n  rect01.y = multipeTransformation(rect01, 1, 3).y\n  \/\/ 3. \u3092\u5c65\u6b74\u306b\u8ffd\u52a0\n  history.push({\n    target: rect01,\n    func: 'multipe',\n    args: {\n      nx: 1,\n      ny: 3\n    }\n  })\n  \/\/ 3. \u306e\u7d50\u679c\u3092\u63cf\u753b\n  drawRect(rect01.x - boxSize \/ 2, rect01.y - boxSize \/ 2, boxSize, boxSize, 'green')\n\n  \/\/ 4. y \u8ef8\u306b\u5bfe\u3057\u3066\u53cd\u8ee2\u3059\u308b\n  rect01.x = inversionYTransformation(rect01).x\n  rect01.y = inversionYTransformation(rect01).y\n  \/\/ 4. \u3092\u5c65\u6b74\u306b\u8ffd\u52a0\n  history.push({\n    target: rect01,\n    func: 'inversionY'\n  })\n  \/\/ 4. \u306e\u7d50\u679c\u3092\u63cf\u753b\n  drawRect(rect01.x - boxSize \/ 2, rect01.y - boxSize \/ 2, boxSize, boxSize, 'green')\n\n  \/\/ \u623b\u308b\u30dc\u30bf\u30f3\u306b\u30a4\u30d9\u30f3\u30c8\u3092\u30bb\u30c3\u30c8\n  returnButton.addEventListener(\n    'click',\n    () => {\n      undo()\n      drawRect(rect01.x - boxSize \/ 2, rect01.y - boxSize \/ 2, boxSize, boxSize, 'red')\n    },\n    false\n  )\n}\n<\/pre>\n<p>\u5168\u4f53\u306e\u6d41\u308c\u306f\u4ee5\u4e0b\u306e\u901a\u308a\u3067\u3059\u3002<br \/>\n\u307e\u305a\u3001\u753b\u9762\u306e\u521d\u671f\u63cf\u753b\u304c\u7d42\u308f\u3063\u305f\u5f8c\u306b\u3001\u70b9 P (x: 75, y: 75)\u3092\u63cf\u753b\u3057\u307e\u3059\u3002\u3053\u308c\u304c\u521d\u671f\u4f4d\u7f6e\u3067\u3059\u3002<\/p>\n<p>\u305d\u306e\u6b21\u306b\u3001\u4ee5\u4e0b\u306e\u51e6\u7406\u3092\u5b9f\u884c\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<ol>\n<li>\u70b9 P \u3092\u3001x \u8ef8\u306b\u5bfe\u3057\u3066\u53cd\u8ee2\u3059\u308b\u3002\n<ol>\n<li>\u70b9 P \u3092 canvas \u306b\u63cf\u753b\u3059\u308b\u3002<\/li>\n<li>\u5c65\u6b74\u3092\u7ba1\u7406\u3059\u308b history \u306b\u300c\u4f5c\u696d\u5bfe\u8c61\u300d\u3068\u300c\u4f5c\u696d\u5185\u5bb9\u300d\u3092\u683c\u7d0d\u3059\u308b\u3002<br \/>\u300c\u4f5c\u696d\u5bfe\u8c61\u300d\u306f rect01 \uff08\u70b9P\uff09\u3002\u300c\u4f5c\u696d\u5185\u5bb9\u300d\u306f\u6587\u5b57\u5217\u3067\u95a2\u6570\u540d\u3092\u5165\u308c\u307e\u3059\u3002<\/li>\n<\/ol>\n<\/li>\n<li>\u70b9 P \u3092\u3001x \u8ef8\u65b9\u5411\u3078\u8ddd\u96e2\u3092 2 \u500d\u3057\u3066\u3001\u63cf\u753b\u3002<br \/>\u4ee5\u964d\u30011.\u306e 1. 2.\u3068\u540c\u69d8\u3002<\/li>\n<li>\u70b9 P \u3092\u3001y \u8ef8\u65b9\u5411\u3078\u8ddd\u96e2\u3092 3 \u500d\u3057\u3066\u3001\u63cf\u753b\u3002<br \/>\u4ee5\u964d\u30011.\u306e 1. 2.\u3068\u540c\u69d8\u3002<\/li>\n<li>\u70b9 P \u3092\u3001y \u8ef8\u306b\u5bfe\u3057\u3066\u53cd\u8ee2\u3057\u3066\u3001\u63cf\u753b\u3002<br \/>\u4ee5\u964d\u30011.\u306e 1. 2.\u3068\u540c\u69d8\u3002<\/li>\n<\/ol>\n<p>\u3053\u3046\u3059\u308b\u3068 history \u306e\u4e2d\u8eab\u306f\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre>\nconst history = [\n  {\n    target: rect01\uff08\u70b9P\uff09, \/\/ \u4f5c\u696d\u5bfe\u8c61\n    func: 'inversionX', \/\/ \u4f5c\u696d\u5185\u5bb9\n    args: {} \/\/ \u4f5c\u696d\u5185\u5bb9\u306e\u4e88\u5099\u60c5\u5831\n  },\n  {\n    target: rect01,\n    func: 'multipe',\n    args: {\n      x: 2,\n      y: 1\n    }\n  },\n  {\n    target: rect01,\n    func: 'multipe',\n    args: {\n      x: 1,\n      y: 3\n    }\n  },\n  {\n    target: rect01,\n    func: 'inversionY',\n    args: {}\n  }\n]\n<\/pre>\n<p>\u6700\u7d42\u7684\u306b\u70b9 P \u306f\u3001\u7b2c\u4e09\u8c61\u9650\u306b\u63cf\u753b\u3055\u308c\u307e\u3059\u3002<\/p>\n<p>\u3067\u306f\u3001\u300c\u623b\u308b\u300d\u30dc\u30bf\u30f3\u3092\u62bc\u4e0b\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<br \/>\n\u300c\u623b\u308b\u300d\u30dc\u30bf\u30f3\u3092\u62bc\u4e0b\u3059\u308b\u3068\u3001undo \u95a2\u6570\u304c\u5b9f\u884c\u3055\u308c\u3001\u70b9 P \u304c\u30ef\u30f3\u30b9\u30c6\u30c3\u30d7\u524d\u306e\u4f4d\u7f6e\u306b\u63cf\u753b\u3055\u308c\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<p>\u3053\u306e undo \u95a2\u6570\u3053\u305d\u304c\u300c\u623b\u308b\u300d\u6a5f\u80fd\u306e\u4e2d\u8eab\u306b\u306a\u308a\u307e\u3059\u3002<br \/>\n\u8a73\u3057\u304f\u4e2d\u8eab\u3092\u898b\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u25bcmain.js<\/p>\n<pre>\n\/\/ \u5143\u306b\u623b\u3059\u51e6\u7406\nconst undo = () => {\n  \/\/ \u5909\u63db\u306e\u5c65\u6b74\u304c\u306a\u3044\u5834\u5408\n  if (history.length === 0) return\n\n  switch (history[history.length - 1].func) {\n    case 'inversionX':\n      \/\/ x\u8ef8\u306b\u5bfe\u3057\u3066\u53cd\u8ee2\u51e6\u7406\u3092\u623b\u3059\n      history[history.length - 1].target.x = inversionXTransformation(history[history.length - 1].target).x\n      history[history.length - 1].target.y = inversionXTransformation(history[history.length - 1].target).y\n      break\n    case 'inversionY':\n      \/\/ y\u8ef8\u306b\u5bfe\u3057\u3066\u53cd\u8ee2\u51e6\u7406\u3092\u623b\u3059\n      history[history.length - 1].target.x = inversionYTransformation(history[history.length - 1].target).x\n      history[history.length - 1].target.y = inversionYTransformation(history[history.length - 1].target).y\n      break\n    case 'multipe':\n      \/\/ n\u500d\u3092\u623b\u3059\n      const nx = history[history.length - 1].args.nx\n      const ny = history[history.length - 1].args.ny\n      history[history.length - 1].target.x = multipeTransformation(history[history.length - 1].target, 1 \/ nx, 1 \/ ny).x\n      history[history.length - 1].target.y = multipeTransformation(history[history.length - 1].target, 1 \/ nx, 1 \/ ny).y\n      break\n    default:\n      break\n  }\n\n  \/\/ \u5c65\u6b74\u306e\u672b\u5c3e\u3092\u6d88\u53bb\n  history.pop()\n}\n<\/pre>\n<p>\u9577\u3005\u3068\u66f8\u3044\u3066\u3044\u307e\u3059\u304c\u3001undo \u95a2\u6570\u306e\u4e2d\u8eab\u306f\u30b7\u30f3\u30d7\u30eb\u3067\u3059\u3002<\/p>\n<p>\u307e\u305a undo \u95a2\u6570\u304c\u767a\u706b\u3057\u305f\u6642\u306b\u3001history \u3092\u672b\u5c3e\u8981\u7d20\u3092\u898b\u306b\u3044\u304d\u307e\u3059\u3002<br \/>\n\u6b21\u306b\u3001\u672b\u5c3e\u8981\u7d20\u306e func \u306e\u6587\u5b57\u5217\u3092\u307f\u3066\u3001\u3069\u3093\u306a\u51e6\u7406\u304c\u5b9f\u884c\u3055\u308c\u305f\u304b\uff08\u4f5c\u696d\u5185\u5bb9\uff09\u3092\u5224\u65ad\u3057\u3066\u3044\u307e\u3059\u3002<br \/>\n\u3042\u3068\u306f\u4f5c\u696d\u5bfe\u8c61\uff08target\uff09\u306b\u5bfe\u3057\u3066\u3001\u4f5c\u696d\u5185\u5bb9\u3092\u6253\u3061\u6d88\u3059\u51e6\u7406\u3092\u5b9f\u884c\u3059\u308c\u3070 OK \u3067\u3059\u3002<\/p>\n<p>\u4f8b\u3048\u3070 func \u304c inversionX \u3067\u3042\u308c\u3070\u3001\u76f4\u524d\u306e\u4f5c\u696d\u5185\u5bb9\u306f\u300cx \u8ef8\u306b\u5bfe\u3057\u3066\u53cd\u8ee2\u300d\u3067\u3042\u308b\u3068\u5224\u65ad\u3067\u304d\u307e\u3059\u3002<br \/>\n\u305d\u3046\u3068\u5206\u304b\u308c\u3070\u3001\u4f5c\u696d\u5bfe\u8c61\u306b x \u8ef8\u306b\u5bfe\u3057\u3066\u53cd\u8ee2\u3059\u308c\u3070\u3001\u5143\u306b\u623b\u308a\u307e\u3059\u306d\u3002<\/p>\n<p>\u4e0a\u8a18\u3068\u540c\u69d8\u306b\u2026<\/p>\n<ul>\n<li>func \u304c inversionY \u3067\u3042\u308c\u3070\u3001\u76f4\u524d\u306e\u4f5c\u696d\u5185\u5bb9\u306f\u300cy \u8ef8\u306b\u5bfe\u3057\u3066\u53cd\u8ee2\u300d\u306a\u306e\u3067\u3001target \u306b\u5bfe\u3057\u3066 y \u8ef8\u306b\u53cd\u8ee2\u3057\u3066\u3001\u5143\u306b\u623b\u3059\u3002<\/li>\n<li>func \u304c multipe \u3067\u3042\u308c\u3070\u3001\u76f4\u524d\u306e\u4f5c\u696d\u5185\u5bb9\u306f\u300c\u9577\u3055\u3092 n \u500d\u306b\u3059\u308b\u300d\u306a\u306e\u3067\u3001target \u306b\u5bfe\u3057\u3066 1 \/ n \u500d\u3057\u3066\u3001\u5143\u306b\u623b\u3059\u3002\uff08\u203bn \u500d\u3092\u5143\u306b\u623b\u3059\u306b\u306f\u3001n \u306e\u5024\u3082\u5fc5\u8981\u306a\u306e\u3067\u3001histroy \u306b args \u3068\u3057\u3066\u683c\u7d0d\u3057\u3066\u3044\u307e\u3059\u3002\uff09<\/li>\n<\/ul>\n<p>\u2026\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u3053\u306e\u3088\u3046\u306b\u3057\u3066\u3001target\uff08\u4f5c\u696d\u5bfe\u8c61\uff09\u3068 func \uff08\u4f5c\u696d\u5185\u5bb9\uff09\u304c\u5206\u304b\u308c\u3070\u3001\u72b6\u614b\u3092\u5143\u306b\u623b\u305b\u308b\u308f\u3051\u3067\u3059\u3002<br \/>\n\u6700\u5f8c\u306f\u3001\u5143\u306b\u623b\u3059\u51e6\u7406\u3092\u5b9f\u884c\u3057\u305f\u5f8c\u306b <code>pop()<\/code>\u3092\u4f7f\u3063\u3066\u3001\u6700\u65b0\u306e\u5c65\u6b74\u3092\u524a\u9664\u3057\u307e\u3059\u3002<\/p>\n<p>undo \u95a2\u6570\u304c\u5b8c\u4e86\u3059\u308c\u3070\u3001\u4f5c\u696d\u5bfe\u8c61\uff08target\uff09\u306e\u60c5\u5831\u306f\u30ef\u30f3\u30b9\u30c6\u30c3\u30d7\u524d\u306e\u72b6\u614b\u306b\u623b\u3063\u3066\u3044\u308b\u306f\u305a\u306a\u306e\u3067\u3001\u5f8c\u306f\u753b\u9762\u4e0a\u306b\u63cf\u753b\u3059\u308b\u3060\u3051\u3067\u3059\u306d\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>history \u914d\u5217\u3068 undo \u95a2\u6570\u306b\u3088\u308b\u300c\u5143\u306b\u623b\u3059\u300d\u51e6\u7406\u306e\u69d8\u5b50\u306f\u3001\u884c\u5217\u7a4d\u3068\u540c\u3058\u3067\u3059\u3002<br \/>\n\u884c\u5217\u7a4d\u306f\u8a08\u7b97\u306e\u9806\u756a\u304c\u91cd\u8981\u3067\u3059\u304c\u3001\u5c65\u6b74\u306e\u9806\u756a\u306f history \u914d\u5217\u306b\u3088\u3063\u3066\u4fdd\u8a3c\u3055\u308c\u308b\u306e\u3067\u3001\u3061\u3083\u3093\u3068\u5143\u306e\u5024\u304c\u5fa9\u5143\u3067\u304d\u308b\u308f\u3051\u3067\u3059\u306d\u3002<\/p>\n<h2>\u307e\u3068\u3081<\/h2>\n<p>\u4eca\u56de\u306f\u300c\u5143\u306b\u623b\u3059\u300d\u6a5f\u80fd\u306e\u5b9f\u88c5\u65b9\u6cd5\u3092\u898b\u3066\u304d\u307e\u3057\u305f\u3002<\/p>\n<p><strong>\u5c65\u6b74\u3092\u300c\u4f5c\u696d\u5bfe\u8c61\u300d\u3068\u300c\u4f5c\u696d\u5185\u5bb9 = \u4f55\u306e\u4f5c\u696d\u3092\u3057\u305f\u304b\u300d\u3067\u7ba1\u7406\u3059\u308b<\/strong>\u624b\u6cd5\u306f\u3001canvas \u306e\u4ed6\u306b\u3082\u3001\u69d8\u3005\u306a\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3084\u6a5f\u80fd\u306b\u5fdc\u7528\u3067\u304d\u307e\u3059\u3002<br \/>\n\u300c\u5143\u306b\u623b\u3059\u300d\u6a5f\u80fd\u3092\u5b9f\u88c5\u3059\u308b\u6642\u306f\u3001\u305c\u3072\u3053\u306e\u65b9\u6cd5\u3092\u4e00\u8003\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>\u3067\u306f\u3001\u307e\u305f\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3053\u3093\u306b\u3061\u306f\u3002\u30a8\u30f3\u30b8\u30cb\u30a2\u306e\u8fbb\u3067\u3059\u3002 \u524d\u56de\u306f\u3001\u7dda\u5f62\u5909\u63db\u306e\u30dd\u30a4\u30f3\u30c8\u3068\u884c\u5217\u7a4d\u306e\u7279\u5fb4\u3092\u898b\u3066\u304d\u307e\u3057\u305f\u3002 \u4eca\u56de\u306f\u3001\u884c\u5217\u7a4d\u306e\u5fdc\u7528\u3063\u307d\u3044\u3053\u3068\u3092\u3084\u3063\u3066\u307f\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002 \u3069\u3093\u306a\u4e8b\u3092\u3084\u308b\u304b\u3068\u3044\u3046\u3068\u300ccanvas \u4e0a\u3067\u8907\u6570\u306e\u7dda\u5f62\u5909\u63db\u3092\u884c\u3063\u305f\u8981\u7d20&#8230;<\/p>\n","protected":false},"author":5,"featured_media":4892,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[14],"tags":[49],"_links":{"self":[{"href":"https:\/\/www.sria.co.jp\/blog\/wp-json\/wp\/v2\/posts\/5201"}],"collection":[{"href":"https:\/\/www.sria.co.jp\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sria.co.jp\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sria.co.jp\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sria.co.jp\/blog\/wp-json\/wp\/v2\/comments?post=5201"}],"version-history":[{"count":52,"href":"https:\/\/www.sria.co.jp\/blog\/wp-json\/wp\/v2\/posts\/5201\/revisions"}],"predecessor-version":[{"id":5304,"href":"https:\/\/www.sria.co.jp\/blog\/wp-json\/wp\/v2\/posts\/5201\/revisions\/5304"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.sria.co.jp\/blog\/wp-json\/wp\/v2\/media\/4892"}],"wp:attachment":[{"href":"https:\/\/www.sria.co.jp\/blog\/wp-json\/wp\/v2\/media?parent=5201"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sria.co.jp\/blog\/wp-json\/wp\/v2\/categories?post=5201"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sria.co.jp\/blog\/wp-json\/wp\/v2\/tags?post=5201"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}