テキストに反射効果を加える方法

チャクニット・ビン
チャクニット・ビン
2024年6月24日
更新済み 2024年12月10日
共有:
This article was translated from English: Does it need improvement?
Translated
View the article in English

テキストのリフレクション効果とは、テキストを元の形よりも下に鏡のように映し出す視覚的強調効果です。 このエフェクトは、表面上の文字の反射をシミュレートし、しばしばデザインに深みとリアリズムを加える。

IronWordの使用を開始する

今日から無料トライアルでIronWordをあなたのプロジェクトで使い始めましょう。

最初のステップ:
green arrow pointer


反射効果の追加

テキストの反射効果を指定するには、TextStyleオブジェクトを作成し、ReflectionオブジェクトでReflectionEffectプロパティに値を入れます。 最後に、TextStyle オブジェクトを TextEffect プロパティに割り当てることで、スタイルを持つ新しいテキストを追加します。

:path=/static-assets/word/content-code-examples/how-to/text-effect-reflection-effect.cs
using IronWord;
using IronWord.Models;

// Create new Word document
WordDocument doc = new WordDocument();

// Create and configure text style
TextStyle textStyle = new TextStyle();
textStyle.TextEffect = new TextEffect()
{
    ReflectionEffect = new Reflection(),
};

// Add text with style
doc.AddText("Hello World").Style = textStyle;

// Export new Word document
doc.SaveAs("reflectionEffect.docx");
Imports IronWord
Imports IronWord.Models

' Create new Word document
Private doc As New WordDocument()

' Create and configure text style
Private textStyle As New TextStyle()
textStyle.TextEffect = New TextEffect() With {.ReflectionEffect = New Reflection()}

' Add text with style
doc.AddText("Hello World").Style = textStyle

' Export new Word document
doc.SaveAs("reflectionEffect.docx")
$vbLabelText   $csharpLabel
反射効果を追加

反射効果のプロパティ

リフレクション・エフェクトは、多様な設計要件を満たすために、さまざまな調整可能な属性を提供する。 各物件の詳細については、以下のリストを参照のこと:

  • SchemeColor: 反射効果のスキームカラーを取得または設定します。
  • HorizontalSkewAngle: 反射効果の水平スキュー角度を取得または設定します。 スキュー角は度単位で指定する。
  • HorizontalScalingFactor: リフレクション効果の水平スケーリング係数を取得または設定します。
  • DistanceFromText: 反射効果をテキストまたはオブジェクトからの距離を取得または設定します。 距離はポイント(1/72インチ)で指定されています。
  • DirectionAngle: 反射効果の方向角度を取得または設定します。 方向角度は度単位で指定する。
  • FadeDirectionAngle: 反射効果のフェード方向を取得または設定します。
  • EndPosition: リフレクション効果の終端位置を取得または設定します。
  • StartPosition: リフレクション効果の開始位置を取得または設定します。
  • EndingOpacity: 反射効果の終了時の不透明度を取得または設定します。
  • VerticalScalingFactor: 反射効果の垂直スケーリング係数を取得または設定します。
  • StartingOpacity: 反射効果の開始時の不透明度を取得または設定します。
  • アライメント: リフレクション効果のアライメントを取得または設定します。
  • BlurRadius: 反射効果のぼかし半径を取得または設定します。 ぼかしの半径はポイント(1/72インチ)で指定されます。
  • VerticalSkewAngle: 反射効果の垂直傾斜角を取得または設定します。 スキュー角は度単位で指定する。
:path=/static-assets/word/content-code-examples/how-to/text-effect-customized-reflection-effect.cs
using IronWord;
using IronWord.Models;
using IronWord.Models.Enums;

// Create new Word document
WordDocument doc = new WordDocument();

// Create and configure text style
TextStyle textStyle = new TextStyle();
textStyle.TextEffect = new TextEffect()
{
    ReflectionEffect = new Reflection()
    {
        Alignment = RectangleAlignmentValues.BottomLeft,
        BlurRadius = 5,
        DirectionAngle = 90,
        DistanceFromText = 5,
        EndingOpacity = 100,
        EndPosition = 10,
        FadeDirectionAngle = 90,
        HorizontalScalingFactor = 100,
        HorizontalSkewAngle = 0,
        SchemeColor = IronWord.Models.Color.Gold,
        StartingOpacity = 0,
        StartPosition = 0,
        VerticalScalingFactor = -100,
        VerticalSkewAngle = 0,
    },
};

// Add text with style
doc.AddText("Customized reflection").Style = textStyle;

// Export new Word document
doc.SaveAs("customizedReflectionEffect.docx");
Imports IronWord
Imports IronWord.Models
Imports IronWord.Models.Enums

' Create new Word document
Private doc As New WordDocument()

' Create and configure text style
Private textStyle As New TextStyle()
textStyle.TextEffect = New TextEffect() With {
	.ReflectionEffect = New Reflection() With {
		.Alignment = RectangleAlignmentValues.BottomLeft,
		.BlurRadius = 5,
		.DirectionAngle = 90,
		.DistanceFromText = 5,
		.EndingOpacity = 100,
		.EndPosition = 10,
		.FadeDirectionAngle = 90,
		.HorizontalScalingFactor = 100,
		.HorizontalSkewAngle = 0,
		.SchemeColor = IronWord.Models.Color.Gold,
		.StartingOpacity = 0,
		.StartPosition = 0,
		.VerticalScalingFactor = -100,
		.VerticalSkewAngle = 0
	}
}

' Add text with style
doc.AddText("Customized reflection").Style = textStyle

' Export new Word document
doc.SaveAs("customizedReflectionEffect.docx")
$vbLabelText   $csharpLabel
反射効果のカスタマイズ
チャクニット・ビン
ソフトウェアエンジニア
ChaknithはIronXLとIronBarcodeで作業しています。彼はC#と.NETに深い専門知識を持ち、ソフトウェアの改善と顧客サポートを支援しています。ユーザーとの対話から得た彼の洞察は、より良い製品、文書、および全体的な体験に貢献しています。