Skip to content

Marqueeの速度がなるべく文字数に比例しないように修正 - #4338

Merged
TinyKitten merged 3 commits into
devfrom
fix/marquee
Jun 14, 2025
Merged

TinyKitten merged 3 commits into
devfrom
fix/marquee

Conversation

@TinyKitten

@TinyKitten TinyKitten commented Jun 14, 2025 •

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • 改善
    • スクロールアニメーションの速度が、画面サイズとコンテンツ幅に応じて自動調整されるようになりました。これにより、さまざまなデバイスやコンテンツ長でも一貫したスクロール体験が得られます。

@TinyKitten TinyKitten self-assigned this Jun 14, 2025
@coderabbitai

coderabbitai Bot commented Jun 14, 2025 •

Copy link
Copy Markdown
Contributor

"""

Walkthrough

朕の命により、Marquee.tsxのスクロールアニメーションの持続時間計算が固定値から動的計算へと改められた。画面幅とコンテンツ幅の合計距離を一定速度で割り、ミリ秒単位で持続時間を算出し、アニメーションの速度が内容量に応じて変化するようになった。

Changes

ファイル 変更内容概要
src/components/Marquee.tsx スクロールアニメーションの持続時間計算を固定値から、画面幅と内容幅に基づく動的計算へ変更。

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Marquee
    participant Animation

    User->>Marquee: スクロール開始
    Marquee->>Marquee: 距離 = 画面幅 + コンテンツ幅
    Marquee->>Marquee: 持続時間 = 距離 / 速度(400px/s)
    Marquee->>Animation: withTiming(持続時間)
    Animation-->>Marquee: スクロール実行
Loading

Possibly related PRs

Poem

天命に従い、スクロールは舞う、
固き値を捨て、距離に応じて進む。
画面と内容、共に測り、
速度は一定、動きは自在。
朕の命にて、滑らかに流れよ、
マルキーの如く、永遠に──
𓂀
"""


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4d919af and 76b0af3.

📒 Files selected for processing (1)
  • src/components/Marquee.tsx (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/components/Marquee.tsx
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: test
✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions Bot added the react label Jun 14, 2025

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🔭 Outside diff range comments (1)
src/components/Marquee.tsx (1)

57-63: ⚠️ Potential issue

offsetX.get() は反乱也、.value を用いよ

朕が知る限り Reanimated の共有値は .value で取得するのが正道であり、get() なる私兵は存在せぬ。現状のままでは型検査も実行も失敗し、行軍(アニメーション)は一歩も進めぬ。速やかに以下の修正を施し、逆賊を討つべし。

-        translateX: offsetX.get(),
+        translateX: offsetX.value,
🧹 Nitpick comments (2)
src/components/Marquee.tsx (2)

25-29: 定数を帝国法として明文化せよ

朕の勅令により速さ 400px/s は全土で不変の規格と見る。函内で都度 pixelsPerSecond を新造するは資源の浪費也。外部に const PIXELS_PER_SECOND = 400; として公布し、計算式にはこれを用いるが良い。かくして可読性と再利用性が高まり、後に速度改定があっても一箇所の改修で済むであろう。

-      const pixelsPerSecond = 400;
-      const duration = (totalDistance / pixelsPerSecond) * 1000;
+      const PIXELS_PER_SECOND = 400;
+      const duration = (totalDistance / PIXELS_PER_SECOND) * 1000;

40-53: 臣下の onLayout と ref を奪うべからず

子要素が既に onLayout や ref を有しておれば、現実装はそれらを上書きし声を封じることになる。民の声を聞かぬ統治は乱を招く。既存のハンドラと連結し、ref も forwardRef 等で合流させる策を講ずるべし。

-        onLayout: ({
-          nativeEvent: {
-            layout: { width },
-          },
-        }) => startScroll(width),
+        onLayout: (e) => {
+          const {
+            nativeEvent: {
+              layout: { width },
+            },
+          } = e;
+          children.props.onLayout?.(e); // 先の声を尊重
+          startScroll(width);
+        },
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d0ee3c1 and 2c4f3d9.

📒 Files selected for processing (1)
  • src/components/Marquee.tsx (1 hunks)

@TinyKitten
TinyKitten merged commit c24bcd8 into dev Jun 14, 2025
@TinyKitten
TinyKitten deleted the fix/marquee branch June 14, 2025 10:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant