视觉工作室中的文字动画 [英] Animation of words in visual studio

查看:22
本文介绍了视觉工作室中的文字动画的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题 1

我正在 Visual Studio 2015 中开发 WPF 应用程序.语言是视觉基础.我需要在应用程序启动时为我的徽标设置动画.因为我是新手,我不知道如何为 word 设置动画.我希望做一个滑动效果(就像 word 2016 中的那样).我对所有想法持开放态度,感谢您的帮助.

I am working on a WPF application in visual studio 2015.The language is visual basic.I need to animate my logo when the app start.Since i am newbie,i don't know how to animate word.I am hoping to do a sliding effect (like that in word 2016).I am open to all ideas and thanks for your help.

我上网又上网,在visual basic 6中发现了这个,

I went online and online and found this in visual basic 6,

Private Sub trmText_Timer()
   If lblCaption.Caption <> StrCap Then
     If lblCaption.Alignment = 0 Then
        'run from left
        lblCaption.Caption = Left(StrCap, Len(lblCaption.Caption) + 1)
     ElseIf lblCaption.Alignment = 1 Then
        'run from right
        lblCaption.Caption = Right(StrCap, Len(lblCaption.Caption) + 1)
     ElseIf lblCaption.Alignment = 2 Then
        'run from the middle
       lblCaption.Caption = Mid(StrCap, Len(StrCap) \ 2 + Len(StrCap) Mod 2 - Num, _
                            2 * (Num + 1) - Len(StrCap) Mod 2)
       Num = Num + 1
     End If
   Else
      lblCaption.Caption = ""
      Num = 0
   End If
End Sub

但它看起来很旧&原始.寻找一些现代风格的设计.

But it looks old & primitive.Looking for some modern like designs.

问题 2

如果我为徽标使用动画 gif 会影响我的应用程序性能.(这就是我坚持使用平面文本的原因).有人知道制作 gif 的好应用程序吗?

If i use animated gif's for my logo would it affect my application performance.(which is the reason why i stick to plane text).Any one know any good application to make gif?

问题 3

如果我决定使用 gif,任何人都知道如何阻止 gif 图像重复多次.(就像 android 的那样,它将多个图像交换到屏幕上并在最后一个屏幕上停止直到设备启动.我可以用上面的方法来显示我的标志吗?如果可以,怎么显示?

If i decided to go with gif anyone know how to stop the gif image from repeating itself more than once.(like that of android which swaps multiple images onto screen and stops on the last screen till device boots up ).Can i use the above method to display my logo.if so,how??

提前致谢.任何想法都值得赞赏.

Thanks in advance.Any idea is appreciated.

推荐答案

尝试使用 DoubleAnimation 为您的文本设置渲染变换动画.在这个例子中,我在我的窗口上使用了 2 个标签.此代码将每个标签的 TranslateTransform 的 X 属性从屏幕外动画化到屏幕上.此外,在第一个标签完成之前,第二个标签不会开始动画.当窗口显示时,标题标签将从左侧进入,然后副标题标签将以相同的方式进入.您可以根据自己的需要使用这些值.

Try using a DoubleAnimation to animate a render transform for your text. In this example, I use 2 Labels on my Window. This code animates the X property of the TranslateTransform of each label from offscreen to onscreen. In addition, the second label doesn't begin animating until the first has completed. When the window is shown, the title label will come in from the left and then the sub-title label will come in the same way. You can play with the values to suit your needs.

<Window x:Class="MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="MainWindow" Height="300" Width="400">
    <Grid>
        <Label Foreground="Red" FontSize="72" FontWeight="Bold">Title
            <Label.RenderTransform>
                <TranslateTransform x:Name="TitleLeftToRight"/>
            </Label.RenderTransform>
            <Label.Triggers>
                <EventTrigger RoutedEvent="Label.Loaded">
                    <EventTrigger.Actions>
                        <BeginStoryboard>
                            <Storyboard>
                                <DoubleAnimation DecelerationRatio="1.0" Storyboard.TargetName="TitleLeftToRight" Storyboard.TargetProperty="X" From="-300" To="100" Duration="00:00:00.5" />
                            </Storyboard>
                        </BeginStoryboard>
                    </EventTrigger.Actions>
                </EventTrigger>
            </Label.Triggers>
        </Label>
        <Label Foreground="Blue" FontSize="24" Margin="0,85,0,0">Sub Title
            <Label.RenderTransform>
                <TranslateTransform x:Name="SubTitleLeftToRight" X="-200"/>
            </Label.RenderTransform>
            <Label.Triggers>
                <EventTrigger RoutedEvent="Label.Loaded">
                    <EventTrigger.Actions>
                        <BeginStoryboard>
                            <Storyboard>
                                <DoubleAnimation DecelerationRatio="1.0" Storyboard.TargetName="SubTitleLeftToRight" Storyboard.TargetProperty="X" From="-300" To="125" BeginTime="0:0:0.5" Duration="00:00:00.5" />
                            </Storyboard>
                        </BeginStoryboard>
                    </EventTrigger.Actions>
                </EventTrigger>
            </Label.Triggers>
        </Label>
    </Grid>
</Window>

这篇关于视觉工作室中的文字动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆