<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>kimizuka</author_name>
  <author_url>https://blog.hatena.ne.jp/kimizuka/</author_url>
  <blog_title>みかづきブログ・カスタム</blog_title>
  <blog_url>https://blog.kimizuka.org/</blog_url>
  <categories>
    <anon>React</anon>
  </categories>
  <description>単純な往復運動であればsin関数を使って実装しますが、これだと等速にはなりません。 いや、数学の得意な人であれば、どうにかして等速にできるのかもしれないですが、今回は単純に区間を区切った式で等速往復を実装します。 DEMO ※ クリックすると動き出します ソースコード（抜粋） function Invader({ count, initX }) { const maxDistance = 400; // 折り返しを行う距離 const speed = 1; const size = 40; const [x, setX] = useState(0); useEffect(() =&gt; { set…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fblog.kimizuka.org%2Fentry%2F2022%2F09%2F06%2F235653&quot; title=&quot;Reactで等速で往復運動するコンポーネントをつくる 👾 - みかづきブログ・カスタム&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url>https://cdn-ak.f.st-hatena.com/images/fotolife/k/kimizuka/20220907/20220907004558.png</image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2022-09-06 23:56:53</published>
  <title>Reactで等速で往復運動するコンポーネントをつくる 👾</title>
  <type>rich</type>
  <url>https://blog.kimizuka.org/entry/2022/09/06/235653</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
