gpt4 book ai didi

silverlight - 如何在 SketchFlow 中为 "typing"文本设置动画?

转载 作者:行者123 更新时间:2023-12-04 07:04:30 27 4
gpt4 key购买 nike

在 Microsoft 的 Expression Blend 3 SketchFlow 应用程序中。

您将如何为 设置动画文本输入 ,理想情况下,逐个角色时尚。就好像用户正在输入一样。

一个相关的闪烁光标将使它完美,但这远远超出了“很高兴拥有”的境界。

关键帧动画系统,不允许您操纵

Common Property > Text



字段,因此它不会作为该动画关键帧中记录的更改持续存在。

我正在寻找编辑器步骤(使用某种其他控件)甚至 XAML 代码...
<VisualState>
<StoryBoard>
<DoubleAnimationUsingKeyFrame ... >

最佳答案

在用 solution involving a wipe animation 写博客之后文本块上的矩形,带有 using a custom behavior 更高级解决方案的响应博客文章附加到文本块已创建。

创建 'TypeOnAction' 行为并添加到 TextBlock,将提供所需的逐字符显示效果,并具有可自定义的出现率。获取完整代码示例 here .

public class TypeOnAction : TriggerAction<TextBlock>
{
DispatcherTimer timer;
int len = 1;

public TypeOnAction()
{
timer = new DispatcherTimer();
}

protected override void Invoke(object o)
{
if (AssociatedObject == null)
return;

AssociatedObject.Text = "";
timer.Interval = TimeSpan.FromSeconds(IntervalInSeconds);
timer.Tick += new EventHandler(timer_Tick);
len = 1;
timer.Start();
}

void timer_Tick(object sender, EventArgs e)
{
if (len > 0 && len <= TypeOnText.Length)
{
AssociatedObject.Text = TypeOnText.Substring(0, len);
len++;
timer.Start();
}
else
timer.Stop();
}

public string TypeOnText
{
get { return (string)GetValue(TypeOnTextProperty); }
set { SetValue(TypeOnTextProperty, value); }
}

public static readonly DependencyProperty TypeOnTextProperty =
DependencyProperty.Register("TypeOnText", typeof(string), typeof(TypeOnAction), new PropertyMetadata(""));

public double IntervalInSeconds
{
get { return (double)GetValue(IntervalInSecondsProperty); }
set { SetValue(IntervalInSecondsProperty, value); }
}

public static readonly DependencyProperty IntervalInSecondsProperty =
DependencyProperty.Register("IntervalInSeconds", typeof(double), typeof(TypeOnAction), new PropertyMetadata(0.35));

}

关于silverlight - 如何在 SketchFlow 中为 "typing"文本设置动画?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1322232/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com