仕組み
A textbook figure of a six-panel truss: seven pinned joints, eleven members, a pin support at A and a roller at D. One load sits on a top joint, E, F or G. Every member force comes from the method of joints and is drawn in the tension or compression colour, with a width that grows with the force and a chip with the signed value (+ tension, − compression). The support reactions appear as arrows with their values. Drag the load along the top chord, tap a top joint or use the segmented control; it snaps to the nearest joint. Select a member on the figure to read its force, and how it was with the load at the previous joint.
向いている場面
- Teach statics: let learners see that the bottom chord pulls and the top chord pushes, and that a diagonal can change from tension to compression when the load moves.
- Explain support reactions with the lever rule: the closer the load is to a support, the more of it that support carries.
向かない場面
- For a real structural design, use engineering software: this figure is one idealised, pin-jointed truss with loads at joints only.
使い方
import React, { useState } from 'react'
import { ExhibitTrussForces } from './ExhibitTrussForces.jsx'
export function TrussLesson() {
const [joint, setJoint] = useState('F')
return (
<ExhibitTrussForces
value={joint}
onChange={(next, { forces }) => setJoint(next)}
defaultMember="EB"
load={12}
labels={{ title: 'A load at mid-span' }}
/>
)
}プロパティ
| プロパティ | 型 | 既定値 | 説明 |
|---|---|---|---|
value | 'E' | 'F' | 'G' | — | 荷重がかかる上弦の節点を外部から指定します。 |
defaultValue | 'E' | 'F' | 'G' | 'F' | 内部状態での荷重の初期節点で、リセットでもここに戻ります。 |
onChange | (joint, details) => void | — | 荷重が動いたときに、新しい節点と { reason('drag'、'press'、'key'、'cancel'、'reset')、previous、forces(部材ごとの軸力 kN、引張が正)、reactions({ A, D }、kN)} を渡して呼ばれます。 |
member | string | — | 選択中の部材を外部から指定します。両端の節点で呼びます:AB、BC、CD、EF、FG、AE、EB、BF、FC、CG、GD。 |
defaultMember | string | 'EB' | 最初とリセット後に選択される部材です。 |
onMemberChange | (member, { reason, force }) => void | — | 別の部材を選んだときに、その軸力(kN、引張が正)を渡して呼ばれます。 |
load | number | 12 | 荷重の大きさ(kN)です。すべての軸力が比例して変わり、部材の太さはこの荷重で生じうる最大の軸力を基準に描きます。 |
labels | object | — | 組み込みの文言を置き換えます:title、caption、tension、compression、zero、legendTension、legendCompression、members、memberText('{member}'、'{state}'、'{value}')、readout('{member}')、compare('{joint}'、'{value}')、compareHint、loadAt、positions(三つ)、reactionText('{joint}'、'{value}')、unit、reset。 |
locale | string | 'en' | 小数の表示に使う言語タグです。 |
className | string | — | カードに追加するクラス名です。幅の指定などに使います(既定は 30rem、コンテナより広くなりません)。 |
アクセシビリティ
- The member chips form a radio group: Tab reaches the selected one, arrows move to the next member from left to right, Home and End go to the first and last. Each chip's name reads the member, its state and its force.
- The load position is a segmented control (a radio group): arrows, Home and End move the load between E, F and G. The draggable load on the figure is a pointer shortcut for the same choice.
- The readout is a polite live region: it reads the selected member, its state and force, and the comparison with the previous load position. Each reaction is a note named with its support and value. Reset is a button, marked unavailable while nothing has changed.
- Dragging the load uses pointer capture and touch-action: none, so the page does not scroll mid-drag; a cancelled gesture returns the load to where it started.
- Colour is not the only key: every member shows a signed value, and the readout names the state in words.
モーション
When the load moves, member colours and widths change over --ds-duration-base and the load glides to its joint; while it is dragged it follows the pointer and the forces switch when it passes the middle between two joints. With reduced motion every change lands at once.
プロジェクトに追加
Pro メンバーはプロンプトをコピーし、コーディングエージェントが無料コンポーネントと同じ手順でソースを導入します。
ExhibitTrussForces.jsxexhibit-truss-forces.csstokens.cssREADME.md
2 つのファイルを一緒に導入します。スタイルは tokens.css の変数を読み、予備の値も持つため、単体でも表示できます。



