# WhileTrue animation not working

**URL:** <https://forums.fusetools.com/t/whiletrue-animation-not-working/7069>\
**Category:** General\
**Created:** [April 20, 2018, 6:48pm UTC](https://forums.fusetools.com/t/whiletrue-animation-not-working/7069 "2018-04-20T18:48:49Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![satz](https://avatars.discourse-cdn.com/v4/letter/s/35a633/32.png) [@satz](https://forums.fusetools.com/u/satz)\
**Post date:** [April 20, 2018, 6:48pm UTC](https://forums.fusetools.com/t/whiletrue-animation-not-working/7069/1 "2018-04-20T18:48:50Z")

</div>

I have created Material Design Toast base on tutorials. But the animation part not working as expected. What’s wrong in my approach.

> ```
> <Panel ux:Class="Toast" Layer="Overlay">
> <string ux:Property="Text" />
> <bool ux:Property="Visible" />
> <WhileTrue Value="{ReadProperty Visible}">
> <ActivatingAnimation>
> <DropShadow/>
> <BringToFront Target="btn"/>
> <Change btn.Visibility="Visible" Delay="0" DelayBack="0.26" />
> <Change btn.Opacity="0.6" Duration="0.36" />   
> </ActivatingAnimation>   
> </WhileTrue>
> <Rectangle ux:Name="btn" Visibility="Collapsed" Opacity="0" Height="36" CornerRadius="20" Color="#323232" Padding="16,0" Margin="16">
> <Text Value="{Property this.Text}" Font="RobotoRegular" Color="#FFFFFF" FontSize="14" Alignment="CenterLeft"/>
> </Rectangle> 
> </Panel>
> 
> ```

And to call Toast component

> ```
> <Toast Text="Error: Please fill all fields" Visible="{isError}" Alignment="Center" ux:Name="toastError">
> </Toast>
> 
> ```

---

<div class="post-metadata">

**Author:** ![Arturs](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/arturs/32/582_2.png) [@Arturs](https://forums.fusetools.com/u/Arturs)\
**Post date:** [April 21, 2018, 8:44am UTC](https://forums.fusetools.com/t/whiletrue-animation-not-working/7069/2 "2018-04-21T08:44:57Z")

</div>

Hey.

Your component looks great, but `ActivatingAnimation` is used to animate page when a specific page gets active and visible. Also, I would suggest using [Shadow](https://docs.fusetools.com/fuse/controls/shadow.html) over `DropShadow`. Shadow class is known as a better solution. I think shadow belongs to rectangle so I moved it inside the rectangle.  
Here is modified code:

```auto
<Panel ux:Class="Toast" Layer="Overlay">
	<string ux:Property="Text" />
    <bool ux:Property="Visible" />
       <WhileTrue Value="{ReadProperty Visible}">
            <BringToFront Target="btn"/>
            <Change btn.Visibility="Visible" Delay="0" DelayBack="0.26" />
            <Change btn.Opacity="0.6" Duration="0.36" />   
	    </WhileTrue>
	    <Rectangle ux:Name="btn" Visibility="Collapsed" Opacity="0" Height="36" CornerRadius="20" Color="#323232" Padding="16,0" Margin="16">
            <Shadow Size="10"/>
			<Text Value="{Property this.Text}" Font="RobotoRegular" Color="#FFFFFF" FontSize="14" Alignment="CenterLeft"/>
		</Rectangle> 
</Panel>

```

Hope this helps.

---

<div class="post-metadata">

**Author:** ![satz](https://avatars.discourse-cdn.com/v4/letter/s/35a633/32.png) [@satz](https://forums.fusetools.com/u/satz)\
**Post date:** [April 21, 2018, 9:44am UTC](https://forums.fusetools.com/t/whiletrue-animation-not-working/7069/3 "2018-04-21T09:44:50Z")

</div>

Thank You Arturs! You have saved my day.

---

<div class="post-metadata">

**Author:** ![satz](https://avatars.discourse-cdn.com/v4/letter/s/35a633/32.png) [@satz](https://forums.fusetools.com/u/satz)\
**Post date:** [April 21, 2018, 9:49am UTC](https://forums.fusetools.com/t/whiletrue-animation-not-working/7069/4 "2018-04-21T09:49:40Z")

</div>

Does foreign code support swift lang now?

I dont see any tutorials on that!

---

<div class="post-metadata">

**Author:** ![Uldis](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/uldis/32/657_2.png) [@Uldis](https://forums.fusetools.com/u/Uldis)\
**Post date:** [April 23, 2018, 1:09pm UTC](https://forums.fusetools.com/t/whiletrue-animation-not-working/7069/5 "2018-04-23T13:09:23Z")

</div>

Yes, it does (kind of), and [here’s the docs](https://docs.fusetools.com/native-interop/foreign-code.html#swift). No tutorials I’m afraid, but that link should get you started.

---

<div class="post-metadata">

**Author:** ![satz](https://avatars.discourse-cdn.com/v4/letter/s/35a633/32.png) [@satz](https://forums.fusetools.com/u/satz)\
**Post date:** [April 23, 2018, 2:42pm UTC](https://forums.fusetools.com/t/whiletrue-animation-not-working/7069/6 "2018-04-23T14:42:34Z")

</div>

Hey Uldis,

Thanks for the info! It seems hack at the moment. somewhere in forum i read that swift will be supported in future release.  
I hope it will be out soon!

Best Regards,  
Satz
