{"id":326,"date":"2025-03-19T17:05:16","date_gmt":"2025-03-19T08:05:16","guid":{"rendered":"https:\/\/cg-method.com\/photoshop\/?p=326"},"modified":"2025-03-19T17:05:16","modified_gmt":"2025-03-19T08:05:16","slug":"pixel-move","status":"publish","type":"post","link":"https:\/\/cg-method.com\/photoshop\/pixel-move\/","title":{"rendered":"Photoshop\u30b9\u30af\u30ea\u30d7\u30c8\uff08jsx\uff09\u2502\u6570\u5024\u5165\u529b\u3067\u56f3\u5f62\u3092\u79fb\u52d5\u3055\u305b\u308b\u65b9\u6cd5"},"content":{"rendered":"\n<p>UI\u30c7\u30b6\u30a4\u30f3\u3084\u30ec\u30a4\u30a2\u30a6\u30c8\u4f5c\u696d\u3067\u306f\u3001\u30d1\u30fc\u30c4\u3084\u4f59\u767d\u306e\u30b5\u30a4\u30ba\u306b\u30eb\u30fc\u30eb\u3092\u8a2d\u3051\u308b\u3053\u3068\u304c\u591a\u304f\u3001\u6b63\u78ba\u306a\u4f4d\u7f6e\u8abf\u6574\u304c\u5fc5\u8981\u306b\u306a\u308a\u307e\u3059\u3002<br>Photoshop\u3067\u306f\u3001\u6570\u5024\u5165\u529b\u306b\u3088\u308b\u4f4d\u7f6e\u8abf\u6574\u304c\u53ef\u80fd\u3067\u3059\u3002\u672c\u8a18\u4e8b\u3067\u306f\u3001\u305d\u306e\u65b9\u6cd5\u3092 <strong>2\u3064<\/strong> \u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u81ea\u7531\u5909\u5f62\u6642\u306e\u6570\u5024\u5165\u529b\u3067\u56f3\u5f62\u3092\u79fb\u52d5\u3055\u305b\u308b\u65b9\u6cd5<\/h2>\n\n\n\n<p>\u6700\u3082\u624b\u8efd\u306a\u65b9\u6cd5\u3067\u3059\u3002<br>\u4ee5\u4e0b\u306e\u624b\u9806\u3067\u3001\u6570\u5024\u5165\u529b\u306b\u3088\u308b\u79fb\u52d5\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u79fb\u52d5\u3055\u305b\u305f\u3044\u30ec\u30a4\u30e4\u30fc\u3092\u9078\u629e<\/li>\n\n\n\n<li><code>Ctrl + T<\/code>\uff08Mac\u306e\u5834\u5408\u306f <code>Cmd + T<\/code>\uff09\u3067 <strong>\u81ea\u7531\u5909\u5f62\u30e2\u30fc\u30c9<\/strong> \u306b\u3059\u308b<\/li>\n\n\n\n<li>\u753b\u9762\u4e0a\u90e8\u306e\u30aa\u30d7\u30b7\u30e7\u30f3\u30d0\u30fc\u306b\u3042\u308b\u5ea7\u6a19\u5165\u529b\u30dc\u30c3\u30af\u30b9\u306b <strong>X, Y\u5ea7\u6a19<\/strong> \u3092\u5165\u529b<\/li>\n\n\n\n<li><code>Enter<\/code> \u30ad\u30fc\u3067\u78ba\u5b9a<\/li>\n<\/ol>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"467\" height=\"538\" src=\"https:\/\/cg-method.com\/photoshop\/wp-content\/uploads\/2025\/03\/20170403233500.jpg\" alt=\"\" class=\"wp-image-327\" srcset=\"https:\/\/cg-method.com\/photoshop\/wp-content\/uploads\/2025\/03\/20170403233500.jpg 467w, https:\/\/cg-method.com\/photoshop\/wp-content\/uploads\/2025\/03\/20170403233500-260x300.jpg 260w\" sizes=\"auto, (max-width: 467px) 100vw, 467px\" \/><\/figure>\n\n\n\n<p>\u3053\u306e\u65b9\u6cd5\u306f\u76f4\u611f\u7684\u3067\u3059\u304c\u3001<strong>\u76f8\u5bfe\u7684\u306a\u79fb\u52d5<\/strong> \u306f\u3067\u304d\u307e\u305b\u3093\u3002\uff08\u4f8b\uff1a\u73fe\u5728\u306e\u4f4d\u7f6e\u304b\u3089\u300c10px\u53f3\u306b\u79fb\u52d5\u300d\u306a\u3069\uff09<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u30b9\u30af\u30ea\u30d7\u30c8\u306b\u3066\u6570\u5024\u5165\u529b\u3067\u56f3\u5f62\u3092\u79fb\u52d5\u3055\u305b\u308b\u65b9\u6cd5<\/h2>\n\n\n\n<p>\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u4f7f\u3046\u3053\u3068\u3067\u3001\u73fe\u5728\u306e\u4f4d\u7f6e\u3092\u57fa\u6e96\u306b <strong>\u76f8\u5bfe\u7684\u306a\u79fb\u52d5<\/strong> \u3092\u884c\u3046\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>\u624b\u9806<\/strong><\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u4e0b\u8a18\u306e\u30b9\u30af\u30ea\u30d7\u30c8\uff08Pixel Move.jsx\uff09\u3092\u4f5c\u6210<\/li>\n\n\n\n<li>Photoshop\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u5b9f\u884c\u30e1\u30cb\u30e5\u30fc\u304b\u3089\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u5b9f\u884c<\/li>\n\n\n\n<li><strong>\u30c0\u30a4\u30a2\u30ed\u30b0\u304c\u8868\u793a\u3055\u308c\u308b\u306e\u3067\u3001\u79fb\u52d5\u8ddd\u96e2\u3092\u5165\u529b<\/strong><\/li>\n\n\n\n<li><code>OK<\/code> \u3092\u62bc\u3059\u3068\u6307\u5b9a\u3057\u305f\u30d4\u30af\u30bb\u30eb\u5206\u3060\u3051\u79fb\u52d5<\/li>\n<\/ol>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"185\" height=\"203\" src=\"https:\/\/cg-method.com\/photoshop\/wp-content\/uploads\/2025\/03\/2025-03-19_17h02_27.png\" alt=\"\" class=\"wp-image-328\"\/><\/figure>\n\n\n\n<p><strong>pixelMove.jsx<\/strong><\/p>\n\n\n\n<p>\u3053\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u3067\u306f\u3001\u30c0\u30a4\u30a2\u30ed\u30b0\u30dc\u30c3\u30af\u30b9\u3092\u8868\u793a\u3057\u3001X\u30fbY\u65b9\u5411\u306e\u79fb\u52d5\u8ddd\u96e2\u3092\u5165\u529b\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<p>OK\u3092\u62bc\u305b\u3070\u3001\u305d\u306e\u6570\u5024\u5206\u3060\u3051\u73fe\u5728\u306e\u30ec\u30a4\u30e4\u30fc\u304c\u79fb\u52d5\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p><strong>\u30b0\u30eb\u30fc\u30d7\u306b\u3082\u5bfe\u5fdc<\/strong> \u3057\u3066\u3044\u308b\u306e\u3067\u3001\u8907\u6570\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u79fb\u52d5\u306b\u3082\u4fbf\u5229\u3067\u3059\u3002<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-js\" data-lang=\"JavaScript\"><code>preferences.rulerUnits = Units.PIXELS;\n\n\/\/ \u30c0\u30a4\u30a2\u30ed\u30b0\u3092\u4f5c\u6210\u3057\u3001\u30e6\u30fc\u30b6\u30fc\u5165\u529b\u3092\u53d6\u5f97\u3059\u308b\u95a2\u6570\nfunction getUserInput() {\n    var dialog = new Window(&#39;dialog&#39;, &#39;\u79fb\u52d5\u8ddd\u96e2\u3092\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044&#39;);\n    dialog.orientation = &quot;column&quot;;\n    dialog.alignChildren = &quot;left&quot;;\n    \n    var groupX = dialog.add(&quot;group&quot;);\n    groupX.orientation = &quot;row&quot;;\n    groupX.add(&quot;statictext&quot;, undefined, &quot;\u5e45\u3000\uff1a&quot;);\n    var offsetX = groupX.add(&quot;edittext&quot;, [0, 0, 50, 25], &quot;283&quot;);\n    groupX.add(&quot;statictext&quot;, undefined, &quot; px&quot;);\n    \n    var groupY = dialog.add(&quot;group&quot;);\n    groupY.orientation = &quot;row&quot;;\n    groupY.add(&quot;statictext&quot;, undefined, &quot;\u9ad8\u3055\uff1a&quot;);\n    var offsetY = groupY.add(&quot;edittext&quot;, [0, 0, 50, 25], &quot;195&quot;);\n    groupY.add(&quot;statictext&quot;, undefined, &quot; px&quot;);\n    \n    var centerGroup = dialog.add(&quot;group&quot;);\n    var centerCheck = centerGroup.add(&quot;checkbox&quot;, undefined, &quot;\u4e2d\u5fc3\u304b\u3089&quot;);\n    \n    var buttonGroup = dialog.add(&quot;group&quot;);\n    buttonGroup.orientation = &quot;row&quot;;\n    var okBtn = buttonGroup.add(&quot;button&quot;, undefined, &quot;OK&quot;, { name: &quot;ok&quot; });\n    var cancelBtn = buttonGroup.add(&quot;button&quot;, undefined, &quot;\u30ad\u30e3\u30f3\u30bb\u30eb&quot;, { name: &quot;cancel&quot; });\n    \n    dialog.center();\n    offsetX.active = true;\n    \n    var result = null;\n    \n    cancelBtn.onClick = function () {\n        dialog.close();\n    };\n    \n    okBtn.onClick = function () {\n        result = {\n            x: parseFloat(offsetX.text) || 0,\n            y: parseFloat(offsetY.text) || 0,\n            center: centerCheck.value\n        };\n        dialog.close();\n    };\n    \n    dialog.show();\n    return result;\n}\n\n\/\/ \u30ec\u30a4\u30e4\u30fc\u3092\u79fb\u52d5\u3055\u305b\u308b\u95a2\u6570\nfunction moveActiveLayer(offset) {\n    if (offset) {\n        if (offset.center) {\n            activeDocument.activeLayer.translate(offset.x \/ 2, offset.y \/ 2);\n        } else {\n            activeDocument.activeLayer.translate(offset.x, offset.y);\n        }\n    }\n}\n\n\/\/ \u30e1\u30a4\u30f3\u51e6\u7406\nvar userOffset = getUserInput();\nif (userOffset) {\n    moveActiveLayer(userOffset);\n}\n<\/code><\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>\u307e\u3068\u3081<\/strong><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u7c21\u5358\u306a\u79fb\u52d5<\/strong> \u2192 <code>Ctrl + T<\/code> \u3067\u81ea\u7531\u5909\u5f62\u30e2\u30fc\u30c9\u306b\u3057\u3066\u6570\u5024\u5165\u529b<\/li>\n\n\n\n<li><strong>\u76f8\u5bfe\u7684\u306a\u79fb\u52d5<\/strong> \u2192 \u30b9\u30af\u30ea\u30d7\u30c8\u3092\u4f7f\u3046\u3068\u4fbf\u5229<\/li>\n<\/ul>\n\n\n\n<p>\u7279\u306b\u3001UI\u30c7\u30b6\u30a4\u30f3\u3084\u30ac\u30a4\u30c9\u30e9\u30a4\u30f3\u306b\u6cbf\u3063\u305f\u30c7\u30b6\u30a4\u30f3\u5236\u4f5c\u3067\u306f <strong>\u6b63\u78ba\u306a\u914d\u7f6e<\/strong> \u304c\u6c42\u3081\u3089\u308c\u308b\u306e\u3067\u3001\u7528\u9014\u306b\u5fdc\u3058\u3066\u9069\u5207\u306a\u65b9\u6cd5\u3092\u9078\u3073\u307e\u3057\u3087\u3046\uff01<\/p>\n\n\n\n\n","protected":false},"excerpt":{"rendered":"<p>UI\u30c7\u30b6\u30a4\u30f3\u3084\u30ec\u30a4\u30a2\u30a6\u30c8\u4f5c\u696d\u3067\u306f\u3001\u30d1\u30fc\u30c4\u3084\u4f59\u767d\u306e\u30b5\u30a4\u30ba\u306b\u30eb\u30fc\u30eb\u3092\u8a2d\u3051\u308b\u3053\u3068\u304c\u591a\u304f\u3001\u6b63\u78ba\u306a\u4f4d\u7f6e\u8abf\u6574\u304c\u5fc5\u8981\u306b\u306a\u308a\u307e\u3059\u3002Photoshop\u3067\u306f\u3001\u6570\u5024\u5165\u529b\u306b\u3088\u308b\u4f4d\u7f6e\u8abf\u6574\u304c\u53ef\u80fd\u3067\u3059\u3002\u672c\u8a18\u4e8b\u3067\u306f\u3001\u305d\u306e\u65b9\u6cd5\u3092 2\u3064 \u7d39\u4ecb\u3057\u307e\u3059\u3002 \u81ea\u7531 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":329,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"swell_btn_cv_data":"","footnotes":""},"categories":[11],"tags":[9],"class_list":["post-326","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-layer-shape-creation","tag-free"],"_links":{"self":[{"href":"https:\/\/cg-method.com\/photoshop\/wp-json\/wp\/v2\/posts\/326","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cg-method.com\/photoshop\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cg-method.com\/photoshop\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cg-method.com\/photoshop\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cg-method.com\/photoshop\/wp-json\/wp\/v2\/comments?post=326"}],"version-history":[{"count":1,"href":"https:\/\/cg-method.com\/photoshop\/wp-json\/wp\/v2\/posts\/326\/revisions"}],"predecessor-version":[{"id":330,"href":"https:\/\/cg-method.com\/photoshop\/wp-json\/wp\/v2\/posts\/326\/revisions\/330"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/cg-method.com\/photoshop\/wp-json\/wp\/v2\/media\/329"}],"wp:attachment":[{"href":"https:\/\/cg-method.com\/photoshop\/wp-json\/wp\/v2\/media?parent=326"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cg-method.com\/photoshop\/wp-json\/wp\/v2\/categories?post=326"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cg-method.com\/photoshop\/wp-json\/wp\/v2\/tags?post=326"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}