# 2D Mirror Effect

#### <a class="anchor" id="bkmrk--2"></a>Description

This chapter briefly describes how to use the 2D mirror effect.

<div class="contents" id="bkmrk-ensure-that-this-eff"><div class="contents"><div class="textblock"><dl class="note"><dt></dt><dd><p class="callout info">Ensure that this effect is supported by the device platform in use.</p>

</dd></dl></div></div></div>#### **Configure a 2D Mirror Effect** 

##### <a class="anchor" id="bkmrk--4"></a>Mirror Effect

By using [Candera::MirrorBitmapBrushBlend](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_mirror_bitmap_brush_blend.html "Output includes the bitmap image and it's reflection."), a mirror reflection can be applied to a bitmap node.

Following properties of a mirror effect can be configured:

<div class="contents" id="bkmrk-mirror-axis-modifica"><div class="contents"><div class="textblock">- Mirror Axis Modifications
- Alpha Value

</div></div></div>Following is an example of a mirror effect with a diagonal mirror axis and an alpha value of 1.0f:

<div drawio-diagram="2667"><img src="https://doc316en.candera.eu/uploads/images/drawio/2023-02/drawing-4-1677466536.png" alt=""/></div>

<div class="contents" id="bkmrk--0"><div class="contents"><div class="textblock"><div class="image">  
</div></div></div></div>Refer to <span style="color: rgb(230, 126, 35);">[SceneComposer User Manual](https://doc316en.candera.eu/books/scene-design/page/effects)</span> about how to configure a MirrorBitmapBrushBlend effect in a 2D scene.

#### **Modify 2D Mirror Effect Properties** 

##### <a class="anchor" id="bkmrk--6"></a>Set Mirror Axis

To set the Mirror Axis you need to set two vectors.

<div class="contents" id="bkmrk-the-first-vector-def"><div class="contents"><div class="textblock">- The first vector defines the start point of the mirror axis (the startpoint's X and Y value),
- and the second vector defines the end of the axis.

</div></div></div>The following example shows how to implement a mirror axis from the startpoint (0, 400) to the endpoint (700, 400).

```
Float fromX = 0.0f;
Float fromY = 400.0f;
Float toX = 700.0f;
Float toY = 400.0f;

mirror->MirrorAxisFrom().Set(Vector2(fromX, fromY));
mirror->MirrorAxisTo().Set(Vector2(toX, toY));
```

##### <a class="anchor" id="bkmrk--7"></a>Set Mirror Alpha Value

It is possible to set the mirrors alpha value, so that the mirror looks more or less intensive.

```
Float mirrorAlpha = 0.7f;
mirror->Alpha()= mirrorAlpha;
```

<div drawio-diagram="2668"><img src="https://doc316en.candera.eu/uploads/images/drawio/2023-02/drawing-4-1677466579.png" alt=""/></div>