{"id":14981,"date":"2019-09-02T09:00:02","date_gmt":"2019-09-02T00:00:02","guid":{"rendered":"https:\/\/www.agent-grow.com\/self20percent\/?p=14981"},"modified":"2019-08-30T08:50:44","modified_gmt":"2019-08-29T23:50:44","slug":"javascript-physics-animation-4","status":"publish","type":"post","link":"https:\/\/www.agent-grow.com\/self20percent\/2019\/09\/02\/javascript-physics-animation-4\/","title":{"rendered":"Web \u3067\u7269\u7406\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u30fb\u305d\u306e4 \u300c\u30dc\u30fc\u30eb\u3092\u30d0\u30a6\u30f3\u30c9\u3055\u305b\u3088\u3046\u300d"},"content":{"rendered":"<h1>\u524d\u56de\u306e\u56de\u7b54<\/h1>\n<p>\u524d\u56de\u306e\u5bbf\u984c\u306e\u56de\u7b54\u304b\u3089<\/p>\n<ul>\n<li>\u30dc\u30fc\u30eb\u3092\u6c34\u306b\u6295\u3052\u8fbc\u3093\u3060\u3068\u304d\u306e\u3088\u3046\u306a\u69d8\u5b50\u3092\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u306b\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/li>\n<\/ul>\n<p>\u554f\u984c\u306f\u3053\u3046\u3067\u3057\u305f\u306d\u3002<\/p>\n<p>\u3053\u308c\u306f\u3001\u305d\u3093\u306a\u306b\u96e3\u3057\u304f\u306a\u304f\u89e3\u3051\u305f\u306e\u3067\u306f\u306a\u3044\u3067\u3057\u3087\u3046\u304b\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nconst main = () =\uff1e {\n  const canvas = document.getElementById(\u2019canvas\u2019);\n  const ctx = canvas.getContext(\u20192d\u2019);\n\n\n  \/\/ -------------- \u8a08\u7b97\u7528\u5b9a\u6570\u5b9a\u7fa9 -------------- \/\/\n  \/\/ \u958b\u59cb\u6642\u70b9\u306e\u6642\u9593\u3092\u53d6\u5f97\u3057\u3066\u304a\u304f\n  const init_time = new Date();\n\n  \/\/ \u30dc\u30fc\u30eb\u306e\u534a\u5f84\n  const r = 10;\n\n  \/\/ \u30dc\u30fc\u30eb\u306e\u521d\u671f\u5ea7\u6a19(\u753b\u9762\u5916\u4e0a\u5074\u304b\u3089\u30b9\u30bf\u30fc\u30c8)\n  const x = 200;\n  const y = -10;\n\n  \/\/ \u30dc\u30fc\u30eb\u306e\u521d\u901f\u5ea6\n  const v0x = 0;\n  const v0y = 80;\n\n  \/\/ \u52a0\u901f\u5ea6(\u30de\u30a4\u30ca\u30b9\u306b\u3059\u308b)\n  const a = -10;\n\n   \/\/ -------------- \u63cf\u753b\u51e6\u7406 -------------- \/\/\n  const draw = () =\uff1e {\n    ctx.fillStyle = \u2019rgb(179, 229, 252)\u2019;\n    ctx.fillRect(0, 0, 640, 480);\n    \/\/ \u73fe\u5728\u6642\u523b\u3092\u53d6\u5f97\n    const now = new Date();\n    \/\/ \u958b\u59cb\u6642\u70b9\u304b\u3089\u73fe\u5728\u307e\u3067\u306e\u7d4c\u904e\u6642\u9593\n    const diffSecond = (now.getTime() - init_time.getTime()) * 0.01;\n\n    \/\/ \u73fe\u5728\u306e x \u8ef8\u65b9\u5411\u306e\u4f4d\u7f6e\n    const px = x + (v0x * diffSecond);\n\n    \/\/ \u73fe\u5728\u306e y \u8ef8\u65b9\u5411\u306e\u4f4d\u7f6e\n    const py = y + ((v0y * diffSecond) + (0.5 * a * diffSecond * diffSecond));\n\n    ctx.fillStyle = \u2019rgb(63, 81, 181)\u2019;\n    ctx.beginPath();\n    ctx.arc(px, py, r, 0, Math.PI*2, false)\n    ctx.fill();\n\n    \/\/ \u6b21\u56de\u753b\u9762\u66f4\u65b0\u6642\u306b draw \u3092\u5b9f\u884c\u3059\u308b\u3088\u3046\u306b\u6307\u5b9a\n    requestAnimationFrame(draw);\n  };\n\n  \/\/ \u4e00\u56de\u76ee\u63cf\u753b\u5b9f\u884c\n  draw();\n};\n\ndocument.addEventListener(\u2019DOMContentLoaded\u2019, main);\n<\/pre>\n<p>\u6700\u521d\u306e\u5b9a\u6570\u3092\u3001<\/p>\n<ul>\n<li>\u30b9\u30bf\u30fc\u30c8\u5730\u70b9\u304c\u753b\u9762\u306e\u4e0a\u5074\u304b\u3089\u3068\u306a\u308b\u3088\u3046\u306b\u3001 y \u306b\u30de\u30a4\u30ca\u30b9\u306e\u5024\u3092\u4ed8\u4e0e<\/li>\n<li>\u6700\u521d\u306f\u4e0b\u5411\u304d\u306b\u52d5\u304f\u3088\u3046\u306b\u3001y \u65b9\u5411\u306e\u521d\u901f\u5ea6\u306f\u30d6\u30e9\u30b9\u306e\u5024\u306b\u3059\u308b<\/li>\n<li>\u91cd\u529b\u3068\u9006\u65b9\u5411\u306b\u52a0\u901f\u5ea6\u304c\u304b\u304b\u308b\u306e\u3067\u3001\u52a0\u901f\u5ea6\u3082\u30de\u30a4\u30ca\u30b9\u306b\u5909\u66f4<\/li>\n<\/ul>\n<p>\u3053\u308c\u3067\u3001\u305d\u308c\u3063\u307d\u3044\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u304c\u3067\u304d\u307e\u3059\u306d\u3002<\/p>\n<p>\u80cc\u666f\u306f clearRect \u3092 fillRect \u306b\u5909\u3048\u3066\u3001<br \/>\n\u753b\u9762\u5168\u4f53\u3092\u6c34\u8272\u3067\u5857\u308a\u3064\u3076\u3057\u3066\u3057\u307e\u3048\u3070 OK \u3067\u3059\u3088\u306d\uff01<\/p>\n<p>\u3044\u304b\u304c\u3067\u3057\u305f\u3067\u3057\u3087\u3046\u304b\u3002<\/p>\n<h1>\u30dc\u30fc\u30eb\u306e\u30d0\u30a6\u30f3\u30c9\u3092\u8868\u73fe\uff01\u2026\u306e\u524d\u306b\u3001\u8a08\u7b97\u306e\u4ed5\u65b9\u3092\u5c11\u3057\u5909\u66f4<\/h1>\n<p>\u3055\u3066\u3001\u524d\u56de\u306f\u6295\u3052\u3089\u308c\u305f\u30dc\u30fc\u30eb\u3092\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u3067\u8868\u73fe\u3057\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<p>\u4eca\u56de\u306f\u3001\u305d\u3053\u306b\u5c11\u3057\u3060\u3051\u624b\u3092\u52a0\u3048\u3066\u3001\u30dc\u30fc\u30eb\u304c\u753b\u9762\u5185\u3067\u30d0\u30a6\u30f3\u30c9\u3059\u308b\u3088\u3046\u306b\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u2026\u306a\u306e\u3067\u3059\u304c\u3001\u4eca\u56de\u4ee5\u964d\u306e\u5185\u5bb9\u3092\u5b9f\u65bd\u3059\u308b\u306b\u5f53\u305f\u3063\u3066\u3001<br \/>\n\u3059\u3053\u3057\u3070\u304b\u308a\u8a08\u7b97\u306e\u4ed5\u65b9\u3092\u5909\u66f4\u3057\u3088\u3046\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u3068\u3044\u3046\u306e\u3082\u3001\u524d\u56de\u306e\u8a08\u7b97\u306f<br \/>\n\u300c\u30dc\u30fc\u30eb\u304c\u6295\u3052\u3089\u308c\u305f\u5f8c\u3001\u4f55\u3082\u5468\u308a\u304b\u3089\u5f71\u97ff\u3092\u53d7\u3051\u306a\u3044\u5834\u5408\u300d\u306e\u8a08\u7b97\u306e\u4ed5\u65b9\u3060\u3063\u305f\u3093\u3067\u3059\u306d\u3002<\/p>\n<p>\u4eca\u56de\u306e\u3088\u3046\u306b\u3001\u6295\u3052\u3089\u308c\u305f\u5f8c\u306b\u4f55\u304b\u3057\u3089\u306e\u5f71\u97ff\u3092\u5916\u90e8\u304b\u3089\u53d7\u3051\u308b\u5834\u5408\u306b\u306f\u3001<br \/>\n\u524d\u56de\u306e\u8a08\u7b97\u65b9\u6cd5\u306f\u3061\u3087\u3063\u3068\u9069\u3057\u307e\u305b\u3093\u3002<\/p>\n<p>\u306a\u306b\u304c\u554f\u984c\u304b\u3068\u3044\u3044\u307e\u3059\u3068\u3001<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n    \/\/ \u73fe\u5728\u306e x \u8ef8\u65b9\u5411\u306e\u4f4d\u7f6e\n    const px = x + (v0x * diffSecond);\n<\/pre>\n<p>\u3053\u3046\u3044\u3063\u305f\u8a08\u7b97\u3002<br \/>\n\u3053\u306e\u3001 <code>v0x<\/code> \u306e\u6240\u3067\u3059\u3002<\/p>\n<p>\u3053\u306e\u8a08\u7b97\u3067\u306f\u6bce\u56de\u6295\u3052\u3089\u308c\u305f\u3068\u3053\u308d\u304b\u3089\u306e\u30dc\u30fc\u30eb\u306e\u6319\u52d5\u3092\u5168\u3066\u8a08\u7b97\u3057\u3066\u3044\u308b\u306e\u3067\u3059\u306d\u3002<\/p>\n<p>\u3053\u3046\u3059\u308b\u3068\u3001\u4f8b\u3048\u3070\u4eca\u56de\u306e\u3088\u3046\u306b\u58c1\u306b\u3076\u3064\u304b\u308b\u3053\u3068\u3092\u8003\u3048\u308b\u3068\u304d\u3001<br \/>\n\u3044\u3064\u3001\u3069\u3053\u3067\u58c1\u306b\u3076\u3064\u304b\u3063\u305f\u304b\u3092\u5168\u3066\u8a18\u9332\u3057\u3001\u6bce\u56de\u8a08\u7b97\u4e0a\u3067\u8003\u616e\u3057\u306a\u3051\u308c\u3070\u306a\u308a\u307e\u305b\u3093\u3002<\/p>\n<p>\u305d\u308c\u306f\u9762\u5012\u3067\u3059\u3088\u306d\uff1f<\/p>\n<p>\u3068\u3044\u3046\u3053\u3068\u3067\u3001\u3061\u3087\u3063\u3068\u8a08\u7b97\u306e\u8003\u3048\u65b9\u3092\u5909\u3048\u307e\u3059\u3002<\/p>\n<p>\u3053\u308c\u307e\u3067\u306f\u3001\u6295\u3052\u3089\u308c\u305f\u3068\u3053\u308d\u304b\u3089\u4f55\u79d2\u5f8c\u306b\u3069\u3053\u306b\u30dc\u30fc\u30eb\u304c\u3042\u308b\u304b\u3092\u8a08\u7b97\u3057\u3066\u63cf\u753b\u3057\u3066\u3044\u307e\u3057\u305f\u304c\u3001<br \/>\n\u4eca\u56de\u304b\u3089\u306f\u3001\u753b\u9762\u3092\u66f8\u304d\u76f4\u3059\u3054\u3068\u306b\u3001\u300c\u30dc\u30fc\u30eb\u3092\u6295\u3052\u76f4\u3059\u300d\u3068\u8003\u3048\u307e\u3057\u3087\u3046\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"14982\" data-permalink=\"https:\/\/www.agent-grow.com\/self20percent\/2019\/09\/02\/javascript-physics-animation-4\/%e3%82%a2%e3%83%bc%e3%83%88%e3%83%9c%e3%83%bc%e3%83%89-1-81\/\" data-orig-file=\"https:\/\/www.agent-grow.com\/self20percent\/wp-content\/uploads\/2019\/08\/850c7612116999490846136e772ab7fd-7.png\" data-orig-size=\"800,600\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"\u30a2\u30fc\u30c8\u30dc\u30fc\u30c9 1\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/www.agent-grow.com\/self20percent\/wp-content\/uploads\/2019\/08\/850c7612116999490846136e772ab7fd-7.png\" src=\"https:\/\/www.agent-grow.com\/self20percent\/wp-content\/uploads\/2019\/08\/850c7612116999490846136e772ab7fd-7-300x225.png\" alt=\"\" width=\"300\" height=\"225\" class=\"alignnone size-medium wp-image-14982\" srcset=\"https:\/\/www.agent-grow.com\/self20percent\/wp-content\/uploads\/2019\/08\/850c7612116999490846136e772ab7fd-7-300x225.png 300w, https:\/\/www.agent-grow.com\/self20percent\/wp-content\/uploads\/2019\/08\/850c7612116999490846136e772ab7fd-7-768x576.png 768w, https:\/\/www.agent-grow.com\/self20percent\/wp-content\/uploads\/2019\/08\/850c7612116999490846136e772ab7fd-7-280x210.png 280w, https:\/\/www.agent-grow.com\/self20percent\/wp-content\/uploads\/2019\/08\/850c7612116999490846136e772ab7fd-7-150x112.png 150w, https:\/\/www.agent-grow.com\/self20percent\/wp-content\/uploads\/2019\/08\/850c7612116999490846136e772ab7fd-7.png 800w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/p>\n<p>\u3053\u3046\u3059\u308b\u3053\u3068\u306b\u3088\u3063\u3066\u3001\u58c1\u306b\u885d\u7a81\u3057\u305f\u77ac\u9593\u306e\u307f\u3001\u885d\u7a81\u306b\u3064\u3044\u3066\u8003\u3048\u308c\u3070\u826f\u3044\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<br \/>\n\u305d\u306e\u307b\u304b\u306e\u30bf\u30a4\u30df\u30f3\u30b0\u3067\u306f\u3001\u524d\u56de\u63cf\u753b\u3057\u305f\u5730\u70b9\u304b\u3089\u306e\u9032\u307f\u3060\u3051\u3092\u8003\u3048\u308c\u3070\u826f\u3044\u306e\u3067\u3001<br \/>\n\u3068\u3066\u3082\u30e9\u30af\u3067\u3001\u30b7\u30f3\u30d7\u30eb\u306b\u306a\u308a\u307e\u3059\u306d\u3002<\/p>\n<p>\u5b9f\u969b\u306b\u30b7\u30df\u30e5\u30ec\u30fc\u30b7\u30e7\u30f3\u3092\u4f5c\u308b\u5834\u5408\u306f\u3001<br \/>\n\u524d\u56de\u306e\u65b9\u6cd5\u3067\u306f\u6642\u9593\u304c\u7d4c\u904e\u3057\u3066\u884c\u304f\u306b\u3064\u308c\u3066\u8a08\u7b97\u91cf\u304c\u81a8\u5927\u306b\u306a\u3063\u3066\u3057\u307e\u3046\u305f\u3081\u3001<br \/>\n\u3053\u306e\u3088\u3046\u306b\u524d\u56de\u304b\u3089\u306e\u5dee\u5206\u3092\u8a08\u7b97\u3059\u308b\u3088\u3046\u306a\u65b9\u6cd5\u3092\u3068\u308b\u3053\u3068\u304c\u3088\u304f\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>\u3068\u3044\u3046\u3053\u3068\u3067\u3001\u524d\u56de\u306e\u5185\u5bb9\u3092\u6295\u3052\u76f4\u3057\u3067\u8003\u3048\u305f\u3068\u304d\u306e\u30b3\u30fc\u30c9\u304c\u3053\u3061\u3089\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nconst main = () =\uff1e {\n  const canvas = document.getElementById(\u2019canvas\u2019);\n  const ctx = canvas.getContext(\u20192d\u2019);\n\n\n  \/\/ -------------- \u8a08\u7b97\u7528\u5b9a\u6570\u5b9a\u7fa9 -------------- \/\/\n  \/\/ \u958b\u59cb\u6642\u70b9\u306e\u6642\u9593\u3092\u53d6\u5f97\u3057\u3066\u304a\u304f\n  let prev_time = new Date();\n\n  \/\/ \u30dc\u30fc\u30eb\u306e\u534a\u5f84\n  const r = 10;\n\n  \/\/ \u30dc\u30fc\u30eb\u306e\u521d\u671f\u5ea7\u6a19\n  let x = 50;\n  let y = 440;\n\n  \/\/ \u30dc\u30fc\u30eb\u306e\u521d\u901f\u5ea6\n  let vx = 30;\n  let vy = -80;\n\n  \/\/ \u91cd\u529b\u52a0\u901f\u5ea6\n  const a = 10;\n\n   \/\/ -------------- \u63cf\u753b\u51e6\u7406 -------------- \/\/\n  const draw = () =\uff1e {\n    ctx.clearRect(0, 0, 640, 480);\n    \/\/ \u73fe\u5728\u6642\u523b\u3092\u53d6\u5f97\n    const now = new Date();\n    \/\/ \u958b\u59cb\u6642\u70b9\u304b\u3089\u73fe\u5728\u307e\u3067\u306e\u7d4c\u904e\u6642\u9593\n    const diffSecond = (now.getTime() - prev_time.getTime()) * 0.01;\n\n    \/\/ \u6b21\u306e\u8a08\u7b97\u306b\u5099\u3048\u3066\u3001 prev_time \u306b now \u3092\u4ee3\u5165\n    prev_time = now;\n\n    \/\/ \u73fe\u5728\u306e x \u8ef8\u65b9\u5411\u306e\u4f4d\u7f6e\n    x = x + (vx * diffSecond);\n\n    \/\/ \u73fe\u5728\u306e y \u8ef8\u65b9\u5411\u306e\u4f4d\u7f6e\n    y = y + ((vy * diffSecond) + (0.5 * a * diffSecond * diffSecond));\n    vy = vy + (a * diffSecond);\n\n    ctx.fillStyle = \u2019rgb(63, 81, 181)\u2019;\n    ctx.beginPath();\n    ctx.arc(x, y, r, 0, Math.PI*2, false)\n    ctx.fill();\n\n    \/\/ \u6b21\u56de\u753b\u9762\u66f4\u65b0\u6642\u306b draw \u3092\u5b9f\u884c\u3059\u308b\u3088\u3046\u306b\u6307\u5b9a\n    requestAnimationFrame(draw);\n  };\n\n  \/\/ \u4e00\u56de\u76ee\u63cf\u753b\u5b9f\u884c\n  draw();\n};\n\ndocument.addEventListener(\u2019DOMContentLoaded\u2019, main);\n<\/pre>\n<p>\u30b3\u30fc\u30c9\u3092\u5b9f\u884c\u3057\u3066\u3082\u3089\u3063\u305f\u3089\u3001\u524d\u56de\u3068\u540c\u69d8\u306e\u52d5\u304d\u3092\u3059\u308b\u3053\u3068\u304c\u5206\u304b\u308b\u304b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u30dd\u30a4\u30f3\u30c8\u306f\u3053\u3053<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n    \/\/ \u6b21\u306e\u8a08\u7b97\u306b\u5099\u3048\u3066\u3001 prev_time \u306b now \u3092\u4ee3\u5165\n    prev_time = now;\n<\/pre>\n<p>\u524d\u56de\u306f\u3001\u6bce\u56de\u306e\u8a08\u7b97\u3067\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u958b\u59cb\u6642\u70b9\u306e\u6642\u9593\u304b\u3089\u306e\u7d4c\u904e\u6642\u9593\u3092\u53d6\u5f97\u3057\u3066\u8a08\u7b97\u3057\u3066\u3044\u307e\u3057\u305f\u304c\u3001<br \/>\n\u4eca\u56de\u306f\u3001\u8a08\u7b97\u5f8c\u306b\u3001\u958b\u59cb\u6642\u9593\u3092\u66f4\u65b0\u3057\u3066\u3044\u304f\u3053\u3068\u3067\u3001\u30b9\u30bf\u30fc\u30c8\u306e\u6642\u9593\u304c\u66f4\u65b0\u3055\u308c\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<p>\u3082\u3046\u4e00\u70b9\u306f\u3053\u3053\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nvy = vy + (a * diffSecond);\n<\/pre>\n<p>\u8a08\u7b97\u306e\u305f\u3073\u306b\u3001\u73fe\u5728\u306e\u901f\u5ea6\u3092\u8a08\u7b97\u3057\u306a\u304a\u3057\u3066\u3001\u521d\u901f\u5ea6\u3092\u66f4\u65b0\u3057\u3066\u3044\u307e\u3059\u306d\u3002<\/p>\n<p>\u3061\u306a\u307f\u306b\u3001\u3053\u3053\u3067\u51fa\u3066\u304d\u305f\u5f0f\u306f<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"14984\" data-permalink=\"https:\/\/www.agent-grow.com\/self20percent\/2019\/09\/02\/javascript-physics-animation-4\/texclip20190826090101\/\" data-orig-file=\"https:\/\/www.agent-grow.com\/self20percent\/wp-content\/uploads\/2019\/08\/texclip20190826090101.png\" data-orig-size=\"209,33\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"texclip20190826090101\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/www.agent-grow.com\/self20percent\/wp-content\/uploads\/2019\/08\/texclip20190826090101.png\" src=\"https:\/\/www.agent-grow.com\/self20percent\/wp-content\/uploads\/2019\/08\/texclip20190826090101.png\" alt=\"\" width=\"209\" height=\"33\" class=\"alignnone size-full wp-image-14984\" \/><\/p>\n<p>\u73fe\u5728\u306e\u901f\u5ea6 <code>v<\/code> \u306f \u521d\u901f\u5ea6 <code>v0<\/code> \u306b <code>a \u00d7 t<\/code> (a \u306f\u52a0\u901f\u5ea6\u30fbt \u306f\u6642\u9593)\u3092\u8db3\u3057\u305f\u3082\u306e\u3068\u3044\u3046\u5f0f\u306b\u306a\u308a\u307e\u3059\u3002<br \/>\n\u524d\u56de\u3001\u4e00\u5b9a\u306e\u6642\u9593\u3067\u3069\u308c\u3060\u3051\u901f\u5ea6\u304c\u5909\u5316\u3059\u308b\u304b\u3068\u3044\u3046\u3082\u306e\u3092\u8868\u3057\u305f\u3082\u306e\u304c\u52a0\u901f\u5ea6\u3068\u304a\u8a71\u3092\u3057\u307e\u3057\u305f\u306e\u3067\u3001<br \/>\n\u9006\u306b\u3001\u52a0\u901f\u5ea6\u306b\u6642\u9593\u3092\u304b\u3051\u308c\u3070\u3001\u305d\u306e\u6642\u9593\u3067\u901f\u5ea6\u304c\u3069\u308c\u3060\u3051\u5909\u5316\u3057\u305f\u304b\u3068\u3044\u3046\u5024\u306b\u306a\u308a\u307e\u3059\u306d\u3002<\/p>\n<p>\u4ee5\u4e0a\u3067\u3001\u8a08\u7b97\u306e\u65b9\u6cd5\u3092\u5909\u66f4\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3057\u305f\uff01<\/p>\n<h1>\u30dc\u30fc\u30eb\u304c\u30d0\u30a6\u30f3\u30c9\u3059\u308b\u51e6\u7406\u3092\u8ffd\u52a0\u3059\u308b<\/h1>\n<p>\u3055\u3066\u3001\u672c\u984c\u306e\u30d0\u30a6\u30f3\u30c9\u306b\u5165\u3063\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u3068\u306f\u8a00\u3063\u3066\u3082\u3001\u8003\u3048\u308b\u3053\u3068\u306f\u3068\u3066\u3082\u7c21\u5358\u3067\u3059\u3002<br \/>\n\u30dc\u30fc\u30eb\u306e\u30d0\u30a6\u30f3\u30c9\u3067\u306f\u3001\u300c\u4f5c\u7528\u30fb\u53cd\u4f5c\u7528\u306e\u6cd5\u5247\u300d\u3092\u305d\u306e\u307e\u307e\u9069\u7528\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u4f5c\u7528\u30fb\u53cd\u4f5c\u7528\u306e\u6cd5\u5247\u3068\u306f\u3001\u7269\u4f53 A \u304c\u4ed6\u306e\u7269\u4f53 B \u306b\u529b\u3092\u52a0\u3048\u308b\u3068\u304d\u3001A \u304c B \u306b\u4e0e\u3048\u308b\u529b\u3068\u540c\u3058\u5927\u304d\u3055\u306e\u529b\u3092\u3001B \u304c A \u306b\u4e0e\u3048\u308b\u3068\u3044\u3046\u5185\u5bb9\u3067\u3059\u306d\u3002<\/p>\n<p>\u2026\u3068\u3001\u5b9a\u7fa9\u901a\u308a\u306e\u8a00\u8449\u3092\u66f8\u3044\u3066\u3082\u3044\u307e\u3044\u3061\u5206\u304b\u3089\u306a\u3044\u306e\u3067\u3001\u4eca\u56de\u306e\u5834\u5408\u3067\u8003\u3048\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u4eca\u56de\u306f\u3001\u30dc\u30fc\u30eb\u306e\u30d0\u30a6\u30f3\u30c9\u3001\u3059\u306a\u308f\u3061\u30dc\u30fc\u30eb\u304c\u304c\u58c1\u306b\u3076\u3064\u304b\u308b\u6642\u3092\u8003\u3048\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"14987\" data-permalink=\"https:\/\/www.agent-grow.com\/self20percent\/2019\/09\/02\/javascript-physics-animation-4\/%e3%82%a2%e3%83%bc%e3%83%88%e3%83%9c%e3%83%bc%e3%83%89-1-82\/\" data-orig-file=\"https:\/\/www.agent-grow.com\/self20percent\/wp-content\/uploads\/2019\/08\/850c7612116999490846136e772ab7fd-8.png\" data-orig-size=\"535,389\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"\u30a2\u30fc\u30c8\u30dc\u30fc\u30c9 1\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/www.agent-grow.com\/self20percent\/wp-content\/uploads\/2019\/08\/850c7612116999490846136e772ab7fd-8.png\" src=\"https:\/\/www.agent-grow.com\/self20percent\/wp-content\/uploads\/2019\/08\/850c7612116999490846136e772ab7fd-8-300x218.png\" alt=\"\" width=\"300\" height=\"218\" class=\"alignnone size-medium wp-image-14987\" srcset=\"https:\/\/www.agent-grow.com\/self20percent\/wp-content\/uploads\/2019\/08\/850c7612116999490846136e772ab7fd-8-300x218.png 300w, https:\/\/www.agent-grow.com\/self20percent\/wp-content\/uploads\/2019\/08\/850c7612116999490846136e772ab7fd-8.png 535w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/p>\n<p>\u98db\u3093\u3067\u304d\u305f\u30dc\u30fc\u30eb\u304c\u58c1\u306b\u3076\u3064\u304b\u308b\u524d\u5f8c\u304b\u3089\u56f3\u306b\u8868\u3057\u3066\u307f\u307e\u3057\u305f\u3002<br \/>\n\u3053\u306e\u56f3\u3092\u898b\u308b\u3068\u3001\uff08\u5f53\u7136\u3067\u3059\u304c\uff09\u30dc\u30fc\u30eb\u306f\u58c1\u306b\u3076\u3064\u304b\u3063\u305f\u77ac\u9593\u306b\u65b9\u5411\u8ee2\u63db\u3057\u3066\u3044\u307e\u3059\u306d\u3002<br \/>\n\u307e\u305f\u3001\u305d\u306e\u4ee5\u5916\u306e\u3001\u58c1\u306b\u3076\u3064\u304b\u3063\u3066\u3044\u306a\u3044\u6642\u306f\u3001\u3053\u308c\u307e\u3067\u901a\u308a\u6025\u306a\u65b9\u5411\u8ee2\u63db\u306a\u3069\u306f\u306a\u304f\u98db\u3093\u3067\u3044\u304d\u307e\u3059\u306d\u3002<\/p>\n<p>\u4ee5\u4e0a\u306e\u3053\u3068\u304b\u3089\u3001\u30dc\u30fc\u30eb\u306f<\/p>\n<ul>\n<li>\u58c1\u306b\u3076\u3064\u304b\u3063\u305f\u77ac\u9593\u306b\u3001\u30dc\u30fc\u30eb\u306f\u4f55\u304b\u3057\u3089\u306e\u529b\u3092\u53d7\u3051\u308b<\/li>\n<li>\u58c1\u306b\u3076\u3064\u304b\u3063\u3066\u3044\u306a\u3044\u6642\u306f\u30dc\u30fc\u30eb\u306b\u306f\u529b\u304c\u304b\u304b\u3063\u3066\u3044\u306a\u3044<\/li>\n<\/ul>\n<p>\u3068\u3044\u3046\u3053\u3068\u304c\u5206\u304b\u308a\u307e\u3059\u3002<br \/>\n\u3064\u307e\u308a\u3001\u30dc\u30fc\u30eb\u306e\u30d0\u30a6\u30f3\u30c9\u3092\u8003\u3048\u305f\u3044\u5834\u5408\u3001\u30dc\u30fc\u30eb\u304c\u58c1\u306b\u3076\u3064\u304b\u3063\u305f\u77ac\u9593\u3060\u3051\u6ce8\u610f\u3057\u3066\u3044\u308c\u3070\u3088\u3044\u3068\u3044\u3046\u3053\u3068\u3067\u3059\u306d\u3002<\/p>\n<p>\u3067\u306f\u3001\u3053\u306e\u58c1\u306b\u3076\u3064\u304b\u3063\u305f\u6642\u306b\u30dc\u30fc\u30eb\u306f\u3069\u3093\u306a\u529b\u3092\u53d7\u3051\u3066\u3044\u308b\u306e\u3067\u3057\u3087\u3046\u304b\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"14988\" data-permalink=\"https:\/\/www.agent-grow.com\/self20percent\/2019\/09\/02\/javascript-physics-animation-4\/%e3%82%a2%e3%83%bc%e3%83%88%e3%83%9c%e3%83%bc%e3%83%89-1-83\/\" data-orig-file=\"https:\/\/www.agent-grow.com\/self20percent\/wp-content\/uploads\/2019\/08\/850c7612116999490846136e772ab7fd-9.png\" data-orig-size=\"350,388\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"\u30a2\u30fc\u30c8\u30dc\u30fc\u30c9 1\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/www.agent-grow.com\/self20percent\/wp-content\/uploads\/2019\/08\/850c7612116999490846136e772ab7fd-9.png\" src=\"https:\/\/www.agent-grow.com\/self20percent\/wp-content\/uploads\/2019\/08\/850c7612116999490846136e772ab7fd-9-271x300.png\" alt=\"\" width=\"271\" height=\"300\" class=\"alignnone size-medium wp-image-14988\" srcset=\"https:\/\/www.agent-grow.com\/self20percent\/wp-content\/uploads\/2019\/08\/850c7612116999490846136e772ab7fd-9-271x300.png 271w, https:\/\/www.agent-grow.com\/self20percent\/wp-content\/uploads\/2019\/08\/850c7612116999490846136e772ab7fd-9.png 350w\" sizes=\"auto, (max-width: 271px) 100vw, 271px\" \/><\/p>\n<p>\u5b9f\u306f\u3053\u308c\u306f\u7c21\u5358\u3067\u3059\u3002<br \/>\n\u30dc\u30fc\u30eb\u304c\u58c1\u306b\u3076\u3064\u304b\u3063\u305f\u77ac\u9593\u3001\u30dc\u30fc\u30eb\u306f\u58c1\u3092\u62bc\u3057\u307e\u3059\u3002\uff08\u3053\u308c\u304c\u4f5c\u7528\u3067\u3059\uff09<br \/>\n\u3053\u308c\u3068\u540c\u3058\u5927\u304d\u3055\u306e\u529b\u3067\u3001\u58c1\u306f\u30dc\u30fc\u30eb\u3092\u62bc\u3057\u8fd4\u3059\u306e\u3067\u3059\u3002\uff08\u3053\u308c\u304c\u53cd\u4f5c\u7528\u3067\u3059\u306d\uff09<br \/>\n\u3053\u308c\u304c\u4f5c\u7528\u30fb\u53cd\u4f5c\u7528\u306e\u6cd5\u5247\u3067\u3059\u306d\u3002<br \/>\n\u5f8c\u306f\u8a73\u3057\u3044\u3053\u3068\u306f\u8abf\u3079\u3066\u3082\u3089\u3063\u305f\u3089\u8272\u3005\u4e01\u5be7\u306a\u89e3\u8aac\u304c\u3067\u307e\u3059\u306e\u3067\u305d\u3061\u3089\u3067\u2026<\/p>\n<p>\u3055\u3066\u3001\u4f5c\u7528\u30fb\u53cd\u4f5c\u7528\u306e\u6cd5\u5247\u304b\u3089\u3001\u30dc\u30fc\u30eb\u304c\u58c1\u306b\u3076\u3064\u304b\u3063\u305f\u6642\u3001\u58c1\u3092\u62bc\u3059\u529b\u3068\u540c\u3058\u529b\u3067\u30dc\u30fc\u30eb\u306f\u62bc\u3055\u308c\u8fd4\u3059\u3068\u3044\u3046\u3053\u3068\u304c\u5206\u304b\u308a\u307e\u3057\u305f\u3002<br \/>\n\u540c\u3058\u529b\u3067\u62bc\u3057\u8fd4\u3055\u308c\u308b\u3068\u3044\u3046\u3053\u3068\u306f\u3001\u52d5\u304d\u3082\u53cd\u8ee2\u3059\u308b\u3068\u3044\u3046\u3053\u3068\u306b\u306a\u308b\u307e\u3059\u306d\u3002<\/p>\n<p>\u3068\u3044\u3046\u3053\u3068\u3067\u3001\u30dc\u30fc\u30eb\u304c\u58c1\u306b\u3076\u3064\u304b\u3063\u305f\u77ac\u9593\u3001\u3076\u3064\u304b\u3063\u305f\u65b9\u5411\u306e\u901f\u5ea6\u3092\u53cd\u8ee2\u3057\u3066\u3042\u3052\u305f\u3089\u826f\u3044\u3067\u3059\u306d\u3002<\/p>\n<p>\u4ee5\u4e0a\u3092\u8e0f\u307e\u3048\u3066\u30b3\u30fc\u30c9\u3092\u66f8\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nconst main = () =\uff1e {\n  const canvas = document.getElementById(\u2019canvas\u2019);\n  const ctx = canvas.getContext(\u20192d\u2019);\n\n\n  \/\/ -------------- \u8a08\u7b97\u7528\u5b9a\u6570\u5b9a\u7fa9 -------------- \/\/\n  \/\/ \u958b\u59cb\u6642\u70b9\u306e\u6642\u9593\u3092\u53d6\u5f97\u3057\u3066\u304a\u304f\n  let prev_time = new Date();\n\n  \/\/ \u30dc\u30fc\u30eb\u306e\u534a\u5f84\n  const r = 10;\n\n  \/\/ \u30dc\u30fc\u30eb\u306e\u521d\u671f\u5ea7\u6a19\n  let x = 50;\n  let y = 440;\n\n  \/\/ \u30dc\u30fc\u30eb\u306e\u521d\u901f\u5ea6\n  let vx = 30;\n  let vy = -80;\n\n  \/\/ \u91cd\u529b\u52a0\u901f\u5ea6\n  const a = 10;\n\n   \/\/ -------------- \u63cf\u753b\u51e6\u7406 -------------- \/\/\n  const draw = () =\uff1e {\n    ctx.clearRect(0, 0, 640, 480);\n    \/\/ \u73fe\u5728\u6642\u523b\u3092\u53d6\u5f97\n    const now = new Date();\n    \/\/ \u958b\u59cb\u6642\u70b9\u304b\u3089\u73fe\u5728\u307e\u3067\u306e\u7d4c\u904e\u6642\u9593\n    const diffSecond = (now.getTime() - prev_time.getTime()) * 0.01;\n\n    \/\/ \u6b21\u306e\u8a08\u7b97\u306b\u5099\u3048\u3066\u3001 prev_time \u306b now \u3092\u4ee3\u5165\n    prev_time = now;\n\n    \/\/ \u73fe\u5728\u306e x \u8ef8\u65b9\u5411\u306e\u4f4d\u7f6e\n    x = x + (vx * diffSecond);\n\n    \/\/ \u6a2a\u65b9\u5411\u306b\u98db\u3073\u51fa\u3057\u3066\u3044\u305f\u3089\u3001\u58c1\u306b\u3076\u3064\u304b\u3063\u3066\u3044\u308b\u3068\u5224\u5b9a\n    if (x &amp;lt; 0) {\n      x = -x;  \/\/ \u58c1\u304b\u3089\u98db\u3073\u51fa\u3057\u305f\u5206\u3092\u623b\u3059\n      vx = -vx;  \/\/ \u52d5\u304d\u3092\u53cd\u8ee2\n    }\n    else if (x \uff1e 640) {\n      x = 640 - (x - 640);  \/\/ \u58c1\u304b\u3089\u98db\u3073\u51fa\u3057\u305f\u5206\u3092\u623b\u3059\n      vx = -vx;  \/\/ \u52d5\u304d\u3092\u53cd\u8ee2\n    }\n\n    \/\/ \u73fe\u5728\u306e y \u8ef8\u65b9\u5411\u306e\u4f4d\u7f6e\n    y = y + ((vy * diffSecond) + (0.5 * a * diffSecond * diffSecond));\n\n    \/\/ \u4e0b\u65b9\u5411\u306b\u98db\u3073\u51fa\u3057\u3066\u3044\u305f\u3089\u3001\u5e8a\u306b\u3076\u3064\u304b\u3063\u3066\u3044\u308b\u3068\u5224\u5b9a\n    if (y \uff1e 480) {\n      y = 480 - (y - 480); \/\/ \u5e8a\u304b\u3089\u98db\u3073\u51fa\u3057\u305f\u5206\u3092\u623b\u3059\n      vy = -vy;  \/\/ \u52d5\u304d\u3092\u53cd\u8ee2\n    }\n    else {\n      vy = vy + (a * diffSecond);  \/\/ \u5e8a\u306b\u3076\u3064\u304b\u3063\u3066\u3044\u306a\u3044\u6642\u306f\u901a\u5e38\u901a\u308a\u306e\u52d5\u304d\u3092\u3055\u305b\u308b\n    }\n\n    ctx.fillStyle = \u2019rgb(63, 81, 181)\u2019;\n    ctx.beginPath();\n    ctx.arc(x, y, r, 0, Math.PI*2, false)\n    ctx.fill();\n\n    \/\/ \u6b21\u56de\u753b\u9762\u66f4\u65b0\u6642\u306b draw \u3092\u5b9f\u884c\u3059\u308b\u3088\u3046\u306b\u6307\u5b9a\n    requestAnimationFrame(draw);\n  };\n\n  \/\/ \u4e00\u56de\u76ee\u63cf\u753b\u5b9f\u884c\n  draw();\n};\n\ndocument.addEventListener(\u2019DOMContentLoaded\u2019, main);\n<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"14989\" data-permalink=\"https:\/\/www.agent-grow.com\/self20percent\/2019\/09\/02\/javascript-physics-animation-4\/anim-20\/\" data-orig-file=\"https:\/\/www.agent-grow.com\/self20percent\/wp-content\/uploads\/2019\/08\/anim-8.gif\" data-orig-size=\"649,485\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"anim\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/www.agent-grow.com\/self20percent\/wp-content\/uploads\/2019\/08\/anim-8.gif\" src=\"https:\/\/www.agent-grow.com\/self20percent\/wp-content\/uploads\/2019\/08\/anim-8-300x224.gif\" alt=\"\" width=\"300\" height=\"224\" class=\"alignnone size-medium wp-image-14989\" srcset=\"https:\/\/www.agent-grow.com\/self20percent\/wp-content\/uploads\/2019\/08\/anim-8-300x224.gif 300w, https:\/\/www.agent-grow.com\/self20percent\/wp-content\/uploads\/2019\/08\/anim-8-280x210.gif 280w, https:\/\/www.agent-grow.com\/self20percent\/wp-content\/uploads\/2019\/08\/anim-8-150x112.gif 150w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/p>\n<p>\u30dc\u30fc\u30eb\u304c\u67a0\u5185\u3067\u30d0\u30a6\u30f3\u30c9\u3057\u3066\u623b\u3063\u3066\u304f\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u306d\uff01<\/p>\n<p>\u8ffd\u52a0\u3055\u308c\u305f\u306e\u306f\u3053\u3053\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n    \/\/ \u6a2a\u65b9\u5411\u306b\u98db\u3073\u51fa\u3057\u3066\u3044\u305f\u3089\u3001\u58c1\u306b\u3076\u3064\u304b\u3063\u3066\u3044\u308b\u3068\u5224\u5b9a\n    if (x &amp;lt; 0) {\n      x = -x;  \/\/ \u58c1\u304b\u3089\u98db\u3073\u51fa\u3057\u305f\u5206\u3092\u623b\u3059\n      vx = -vx;  \/\/ \u52d5\u304d\u3092\u53cd\u8ee2\n    }\n    else if (x \uff1e 640) {\n      x = 640 - (x - 640);  \/\/ \u58c1\u304b\u3089\u98db\u3073\u51fa\u3057\u305f\u5206\u3092\u623b\u3059\n      vx = -vx;  \/\/ \u52d5\u304d\u3092\u53cd\u8ee2\n    }\n<\/pre>\n<p>\u58c1\u306b\u3076\u3064\u304b\u3063\u305f\u77ac\u9593\u3060\u3051\u8003\u3048\u308c\u3070\u3088\u3044\u306e\u3067\u3001<br \/>\n\u8a08\u7b97\u3059\u308b\u77ac\u9593\u306b\u3001\u3053\u306e\u307e\u307e\u9032\u3093\u3067\u3044\u308b\u3068\u58c1\u3092\u7a81\u304d\u629c\u3051\u3066\u3044\u306a\u3044\u304b\u3092\u78ba\u8a8d\u3057\u307e\u3059\u3002<\/p>\n<p>\u7a81\u304d\u629c\u3051\u3066\u3044\u308b\u5834\u5408\u3001\u307e\u305a\u306f\u305d\u306e\u5206\u3060\u3051\u58c1\u306e\u624b\u524d\u5074\u306b\u623b\u3057\u3066\u3042\u3052\u307e\u3057\u3087\u3046\u3002<br \/>\n\u305d\u306e\u5f8c\u3001\u901f\u5ea6\u3092\u53cd\u8ee2\u3055\u305b\u307e\u3059\u3002<br \/>\n\u5148\u307b\u3069\u8003\u3048\u305f\u3088\u3046\u306b\u58c1\u306b\u3076\u3064\u304b\u3063\u305f\u30dc\u30fc\u30eb\u306f\u4f5c\u7528\u30fb\u53cd\u4f5c\u7528\u306e\u6cd5\u5247\u306b\u5f93\u3063\u3066<br \/>\n\u3076\u3064\u304b\u308b\u3068\u304d\u3068\u540c\u3058\u901f\u5ea6\u3067\u9006\u65b9\u5411\u306b\u52d5\u304d\u307e\u3059\u306e\u3067\u3001\u3053\u308c\u3060\u3051\u3067\u3044\u3044\u3067\u3059\u306d\u3002<\/p>\n<p>\u901f\u5ea6\u3092\u53cd\u8ee2\u3055\u305b\u308b\u3053\u3068\u3067\u3001\u4ee5\u5f8c\u306e\u8a08\u7b97\u3067\u306f\u9006\u5411\u304d\u306b\u30dc\u30fc\u30eb\u304c\u3046\u3054\u3044\u3066\u3044\u304f\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u5e8a\u65b9\u5411\u3082\u540c\u3058\u3067\u3059\u306d<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n    \/\/ \u4e0b\u65b9\u5411\u306b\u98db\u3073\u51fa\u3057\u3066\u3044\u305f\u3089\u3001\u5e8a\u306b\u3076\u3064\u304b\u3063\u3066\u3044\u308b\u3068\u5224\u5b9a\n    if (y \uff1e 480) {\n      y = 480 - (y - 480); \/\/ \u5e8a\u304b\u3089\u98db\u3073\u51fa\u3057\u305f\u5206\u3092\u623b\u3059\n      vy = -vy;  \/\/ \u52d5\u304d\u3092\u53cd\u8ee2\n    }\n    else {\n      vy = vy + (a * diffSecond);  \/\/ \u5e8a\u306b\u3076\u3064\u304b\u3063\u3066\u3044\u306a\u3044\u6642\u306f\u901a\u5e38\u901a\u308a\u306e\u52d5\u304d\u3092\u3055\u305b\u308b\n    }\n<\/pre>\n<p>\u5e38\u306b\u91cd\u529b\u306f\u304b\u304b\u3063\u3066\u3044\u308b\u306e\u3067\u3059\u304c\u3001\u4eca\u56de\u306f\u53cd\u8ee2\u3059\u308b\u77ac\u9593\u306f\u7d14\u7c8b\u306b\u4f5c\u7528\u30fb\u53cd\u4f5c\u7528\u306e\u6cd5\u5247\u306b\u5f93\u3063\u305f\u52d5\u304d\u306b\u3057\u305f\u304b\u3063\u305f\u305f\u3081\u3001<br \/>\n\u52d5\u304d\u3092\u53cd\u8ee2\u3055\u305b\u308b\u5834\u5408\u3068\u305d\u3046\u3067\u306a\u3044\u5834\u5408\u3067\u901f\u5ea6\u306e\u51e6\u7406\u3092\u5206\u3051\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u610f\u5916\u306b\u3068\u3063\u3066\u3082\u7c21\u5358\u306b\u5b9f\u88c5\u3067\u304d\u307e\u3057\u305f\u306d\uff01<\/p>\n<h1>\u5bbf\u984c<\/h1>\n<p>\u3055\u3066\u3001\u4eca\u56de\u306e\u5bbf\u984c\u306b\u5165\u308a\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u5148\u307b\u3069\u5b8c\u6210\u3057\u305f\u52d5\u753b\u3092\u898b\u3066\u3001\u4f55\u304b\u6c17\u306b\u306a\u308b\u70b9\u306f\u3042\u308a\u307e\u305b\u3093\u304b\uff1f<\/p>\n<p>\u305d\u3046\u3067\u3059\u306d\u3002\u4e00\u5ea6\u6295\u3052\u3089\u308c\u305f\u30dc\u30fc\u30eb\u304c\u3068\u3066\u3082\u9577\u3044\u9593\u30d0\u30a6\u30f3\u30c9\u3057\u7d9a\u3051\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u5b9f\u969b\u306b\u306f\u30b9\u30fc\u30d1\u30fc\u30dc\u30fc\u30eb\u3067\u3042\u3063\u3066\u3082\u3053\u3093\u306a\u306b\u9577\u3044\u9593\u30d0\u30a6\u30f3\u30c9\u3057\u7d9a\u3051\u308b\u3053\u3068\u306f\u306a\u3044\u3067\u3059\u3088\u306d\uff1f<\/p>\n<p>\u3068\u3044\u3046\u3053\u3068\u3067\u3001\u3082\u3046\u3061\u3087\u3063\u3068\u30ea\u30a2\u30eb\u611f\u3092\u51fa\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"14991\" data-permalink=\"https:\/\/www.agent-grow.com\/self20percent\/2019\/09\/02\/javascript-physics-animation-4\/anim-21\/\" data-orig-file=\"https:\/\/www.agent-grow.com\/self20percent\/wp-content\/uploads\/2019\/08\/anim-9.gif\" data-orig-size=\"649,485\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"anim\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/www.agent-grow.com\/self20percent\/wp-content\/uploads\/2019\/08\/anim-9.gif\" src=\"https:\/\/www.agent-grow.com\/self20percent\/wp-content\/uploads\/2019\/08\/anim-9-300x224.gif\" alt=\"\" width=\"300\" height=\"224\" class=\"alignnone size-medium wp-image-14991\" srcset=\"https:\/\/www.agent-grow.com\/self20percent\/wp-content\/uploads\/2019\/08\/anim-9-300x224.gif 300w, https:\/\/www.agent-grow.com\/self20percent\/wp-content\/uploads\/2019\/08\/anim-9-280x210.gif 280w, https:\/\/www.agent-grow.com\/self20percent\/wp-content\/uploads\/2019\/08\/anim-9-150x112.gif 150w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/p>\n<p>\u30d0\u30a6\u30f3\u30c9\u304c\u5c0f\u3055\u304f\u306a\u308a\u307e\u3057\u305f\u306d\u3002<\/p>\n<p>\u7269\u8cea\u304c\u8df3\u306d\u8fd4\u308b\u3068\u304d\u3001\u7406\u60f3\u7684\u306b\u306f\u5148\u307b\u3069\u306e\u3088\u3046\u306b\u4f5c\u7528\u30fb\u53cd\u4f5c\u7528\u306e\u6cd5\u5247\u306b\u3057\u305f\u304c\u3044\u3001<br \/>\n\u58c1\u306b\u4e0e\u3048\u305f\u5206\u3060\u3051\u306e\u529b\u3092\u30dc\u30fc\u30eb\u304c\u53d7\u3051\u3001\u30dc\u30fc\u30eb\u306f\u6bce\u56de\u540c\u3058\u9ad8\u3055\u307e\u3067\u623b\u3063\u3066\u304d\u307e\u3059\u3002<\/p>\n<p>\u304c\u3001\u5b9f\u969b\u306b\u306f\u30dc\u30fc\u30eb\u3084\u58c1\u306b\u306b\u885d\u6483\u304c\u5438\u53ce\u3055\u308c\u308b\u306a\u3069\u3001\u3044\u308d\u3044\u308d\u306a\u7406\u7531\u3067<br \/>\n\u5b8c\u5168\u306b\u540c\u3058\u9ad8\u3055\u307e\u3067\u306f\u623b\u3063\u3066\u3053\u306a\u3044\u306e\u3067\u3059\u306d\u3002<\/p>\n<p>\u3076\u3064\u304b\u3063\u305f\u3053\u3068\u306b\u3088\u3063\u3066\u6e1b\u5c11\u3057\u305f\u901f\u5ea6\u306e\u5272\u5408\u3092\u3001\u300c\u53cd\u767a\u4fc2\u6570\u300d\u3068\u3044\u3044\u307e\u3059\u3002<\/p>\n<p>\u3053\u306e\u3001\u53cd\u767a\u4fc2\u6570\u3092\u8a08\u7b97\u306b\u7d44\u307f\u8fbc\u3093\u3067\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u30d2\u30f3\u30c8\u3068\u3057\u3066\u306f<\/p>\n<ul>\n<li>\u8df3\u306d\u8fd4\u308b\u51e6\u7406\u3092\u3059\u308b\u3068\u304d\u306b\u3001\u4e00\u5b9a\u306e\u5272\u5408\u3067\u901f\u5ea6\u304c\u6e1b\u5c11\u3057\u3066\u3044\u308b<\/li>\n<\/ul>\n<p>\u3068\u3044\u3046\u3053\u3068\u3067\u3059\u306d\u3002<\/p>\n<p>\u610f\u5916\u306b\u308f\u304b\u3063\u3066\u3057\u307e\u3048\u3070\u7c21\u5358\u306a\u306e\u3067\u3001\u3072\u3089\u3081\u304d\u304c\u6c42\u3081\u3089\u308c\u307e\u3059\u306d\uff01<\/p>\n<p>\u305d\u308c\u3067\u306f\u3001\u307e\u305f\u6b21\u56de\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u524d\u56de\u306e\u56de\u7b54 \u524d\u56de\u306e\u5bbf\u984c\u306e\u56de\u7b54\u304b\u3089 \u30dc\u30fc\u30eb\u3092\u6c34\u306b\u6295\u3052\u8fbc\u3093\u3060\u3068\u304d\u306e\u3088\u3046\u306a\u69d8\u5b50\u3092\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u306b\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002 \u554f\u984c\u306f\u3053\u3046\u3067\u3057\u305f\u306d\u3002 \u3053\u308c\u306f\u3001\u305d\u3093\u306a\u306b\u96e3\u3057\u304f\u306a\u304f\u89e3\u3051\u305f\u306e\u3067\u306f\u306a\u3044\u3067\u3057\u3087\u3046\u304b\u3002 const main = () = [&hellip;]<\/p>\n","protected":false},"author":15,"featured_media":14992,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[10],"tags":[377,45,302],"class_list":["post-14981","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tech","tag-canvas","tag-javascript","tag-302"],"jetpack_featured_media_url":"https:\/\/www.agent-grow.com\/self20percent\/wp-content\/uploads\/2019\/08\/850c7612116999490846136e772ab7fd-10.png","jetpack_shortlink":"https:\/\/wp.me\/p7Bq4F-3TD","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.agent-grow.com\/self20percent\/wp-json\/wp\/v2\/posts\/14981","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.agent-grow.com\/self20percent\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.agent-grow.com\/self20percent\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.agent-grow.com\/self20percent\/wp-json\/wp\/v2\/users\/15"}],"replies":[{"embeddable":true,"href":"https:\/\/www.agent-grow.com\/self20percent\/wp-json\/wp\/v2\/comments?post=14981"}],"version-history":[{"count":0,"href":"https:\/\/www.agent-grow.com\/self20percent\/wp-json\/wp\/v2\/posts\/14981\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.agent-grow.com\/self20percent\/wp-json\/wp\/v2\/media\/14992"}],"wp:attachment":[{"href":"https:\/\/www.agent-grow.com\/self20percent\/wp-json\/wp\/v2\/media?parent=14981"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.agent-grow.com\/self20percent\/wp-json\/wp\/v2\/categories?post=14981"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.agent-grow.com\/self20percent\/wp-json\/wp\/v2\/tags?post=14981"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}