English 中文(简体)
计算系数,以达到正常速度估算
原标题:Calculate coefficient to get normal speed animation
  • 时间:2012-05-15 12:35:09
  •  标签:
  • c#
  • .net
  • wpf

我利用一些WPF的估算,在垂直上将用户群迁移。

这里是法典

public void RestartAnimation(double contentControlHeight, double thisHeight)
        {
            if (cp != null && IsLoaded)
                da.From = contentControlHeight;  
                da.To = -thisHeight;
                da.RepeatBehavior = RepeatBehavior.Forever;
                da.Duration = new Duration(TimeSpan.FromSeconds(this.Duration)); 
                sb.Children.Clear();
                sb.Children.Add(da);
                Storyboard.SetTargetProperty(da, new PropertyPath("(Canvas.Top)"));
                Storyboard.SetTarget(da, cp);
                sb.Begin();           
            }
        }

It works fine but I have discovered if the height is greater then the motion is faster.

因此,我需要认识到两点:

一些速度范围值为1-100(非常缓慢――超快),在内部,我需要一些<斯特隆>普图拉/科莱/斯特隆”。

I did some experiments with the static speed and different height and got some table.

enter image description here

请帮助我标出计算方法的。 我必须做的是仅仅确定速度范围(1-100年),并且不管怎么说,它应当做细微的工作。

谢谢你!

最佳回答

我并不肯定你对比率(StackPanel Height / ContentControl Height)感兴趣,而只是对difference感兴趣。 (StackPanel Height - ContentControl Height)。

你们希望其速度是每秒30个餐厅(实际上相当缓慢,只是从上面的“快速”价值中得出)。 你们有兴趣根据需要多少秒才能确定你的任期,以每秒30个餐厅的距离(高空的差别)。

因此,你需要:

var duration = TimeSpan.FromSeconds((thisHeight - contentControlHeight) / pixelPerSecondSpeed);

这就是你如何经常地离开速度。

问题回答

你们需要使估计时间正常。 因此,请指出,对于中上组高度与中标高度之比(>5:0>/ 编号)而言,“N>>/ 编号”二字的“热速”一词被视为“热速”(现在应当决定什么编号为“N>/>。

因此,现在可以说,与<代码>0.5不同的是,我们希望确定计算期限应当是什么。 这容易:

var duration = TimeSpan.FromSeconds(N * R / 0.5);

让我相信,你也希望以正常期限开展工作。 请允许我就这一直线比额表100表示“正常”速度;我要说,低点数字是指faster animation,因此1“几乎瞬时”和200“正常速度”。 请打电话给正常期限<代码>norm。 嗣后:

var absoluteDuration = TimeSpan.FromSeconds(N * R / 0.5);
var normalizedDuration = absoluteDuration.Seconds * norm / 100;




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...