RepeatedLayout
トリミング ウィンドウ内のパターンを定期的に複製します。スケールやコンパスを連続的に移動する場合に適しています。 period は繰り返し間隔を設定し、value と anchor は現在の値がどこに配置されるかを決定します。
例
function main() {
return (
<RepeatedLayout axis="horizontal" period={120} value={76} anchor={0.5}>
<Text width={120}>N</Text>
</RepeatedLayout>
);
}
使い方
- children が一枚の模様、period が周期です。value を anchor に合わせるため、value 増加で模様は逆に移動し、offset が追加移動になります。both は二方向、{x,y} で個別指定できます。表示枠で常にクリップします。
- 配置領域を確保した後に x/y と transform を適用します。子を右に動かしても兄弟は押されません。間隔には spacing や Spacer、完成した描画の回転・拡大には transform を使います。
プロパティ
children?ViewContent子の描画コンテンツ。
axis?"horizontal" | "vertical" | "both"horizontal、vertical、both 方向に反復。both は格子状。
"horizontal"period?RepeatAxisValueコピー間隔(ポイント)。x/y で各軸を個別指定。
360value?RepeatAxisValueanchor に合わせる内容座標。値が増えると逆方向に動きます。速度ではありません。
$data.current.heading?.direction ?? 0anchor?RepeatAxisValue表示領域の割合。0 は始端、0.5 は中央、1 は終端。
0.5offset?RepeatAxisValuevalue を anchor に合わせた後の追加移動量(ポイント)。
0alignment?"topLeading" | "top" | "topTrailing" | "leading" | "center" | "trailing" | "bottomLeading" | "bottom" | "bottomTrailing"重ねた子 View の位置。四隅・四辺・中央の 9 種類。
"topLeading"共通プロパティ
width?number | "auto" | "fill"幅。ポイント指定、自動サイズ、親領域への拡張に対応します。
100height?number | "auto" | "fill"高さ。ポイント指定、自動サイズ、親領域への拡張に対応します。
80padding?numberコンテンツの内側余白(ポイント)。
0x?number見た目の移動量(ポイント)。x は右、y は下。レイアウトの占有領域は変わりません。
0y?number見た目の移動量(ポイント)。x は右、y は下。レイアウトの占有領域は変わりません。
0transform?ViewTransformレイアウトを変えず全体を変形。移動はポイント、回転・傾きは度、倍率 1 は等倍、基点は 0–1。
{rotation: 0}background?Paint背景の色またはグラデーション。clear は透明。
"clear"opacity?numberView 全体の不透明度。0 は透明、1 は不透明。
1cornerRadius?number角丸の半径(ポイント)。
0clip?"rectangle" | "ellipse"切り抜き形状は rectangle または ellipse。Material は false で無効化も可能。
"rectangle"mask?View | nullアルファマスク用の View。レイアウトに影響せず中央に配置されます。null でマスクを無効にします。
<Circle width="fill" height="fill" background="white"/>zIndex?number兄弟 View の重なり順。大きい値ほど手前。
0blur?numberぼかし半径(ポイント)。0 で無効。
4innerShadow?DrawingEffect効果の色、不透明度、ぼかし半径、x/y オフセット。距離はポイント。
{color: HDR("black"), opacity: 0.5, radius: 4, x: 0, y: 2}glow?DrawingEffect効果の色、不透明度、ぼかし半径、x/y オフセット。距離はポイント。
{color: HDR("cyan"), radius: 8, opacity: 0.8}shadowColor?Color外側の影の色。
HDR("black")shadowOpacity?number外側の影の不透明度 0–1。0 で非表示。
0shadowRadius?number外側の影のぼかし半径(ポイント)。
4shadowX?number影の移動量(ポイント)。x は右、y は下。
0shadowY?number影の移動量(ポイント)。x は右、y は下。
2animations?Animation[]プロパティ変更のアニメーション。duration/delay は秒、from/to は端点、repeat/autoreverse は反復、wrap は周期。
[{property: "opacity", duration: 0.25, curve: "easeInOut"}]key?string | number兄弟要素間で安定した識別子。
組み合わせ例
function main() {
return (
<RepeatedLayout
width={240}
height={140}
axis="both"
period={{ x: 80, y: 50 }}
value={{ x: 40, y: 25 }}
anchor={{ x: 0.5, y: 0.5 }}
alignment="center"
>
<Symbol name="plus" fontSize={20} color={$env.accent} />
</RepeatedLayout>
);
}
アニメーション
widthheightpaddingxyopacitybackgroundcornerRadiusblurshadowColorshadowOpacityshadowRadiusshadowXshadowYperiodvalueanchoroffsettransform.translateXtransform.translateYtransform.scaleXtransform.scaleYtransform.rotationtransform.skewXtransform.skewYtransform.anchorXtransform.anchorYperiod.xperiod.yvalue.xvalue.yanchor.xanchor.yoffset.xoffset.y省略時の動作
表は実装で確認した省略時の動作です。プロパティ例は既定値ではありません。固定結果には明示指定し、環境に依存する寸法やテーマ色を定数と思わないでください。