Exemplo n.º 1
0
def makeAnimation(top):
    xamlStr = """
<Storyboard xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
    <DoubleAnimationUsingKeyFrames>
        <EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="{0}">
            <EasingDoubleKeyFrame.EasingFunction>
                <QuadraticEase EasingMode="EaseOut"/>
            </EasingDoubleKeyFrame.EasingFunction>
        </EasingDoubleKeyFrame>
        <EasingDoubleKeyFrame KeyTime="0:0:0.4" Value="{1}">
            <EasingDoubleKeyFrame.EasingFunction>
                <QuadraticEase EasingMode="EaseIn"/>
            </EasingDoubleKeyFrame.EasingFunction>
        </EasingDoubleKeyFrame>
        <EasingDoubleKeyFrame KeyTime="0:0:0.6" Value="{2}">
            <EasingDoubleKeyFrame.EasingFunction>
                <QuadraticEase EasingMode="EaseOut"/>
            </EasingDoubleKeyFrame.EasingFunction>
        </EasingDoubleKeyFrame>
        <EasingDoubleKeyFrame KeyTime="0:0:0.8" Value="{3}">
            <EasingDoubleKeyFrame.EasingFunction>
                <QuadraticEase EasingMode="EaseIn"/>
            </EasingDoubleKeyFrame.EasingFunction>
        </EasingDoubleKeyFrame>
    </DoubleAnimationUsingKeyFrames>
</Storyboard>
""".format(top - 30, top, top - 30, top)

    sr = StringReader(xamlStr)
    sb = XamlServices.Load(sr)
    sr.Dispose()

    Storyboard.SetTarget(sb.Children[0], harriet.Window.Window)
    Storyboard.SetTargetProperty(sb.Children[0], PropertyPath("Top"))
    return sb
Exemplo n.º 2
0
def GetLinesFromText(text):
    reader = StringReader(text)
    lines = []
    try:
        line = reader.ReadLine()
        while line is not None:
            lines.append(line)
            line = reader.ReadLine()
    finally:
        reader.Dispose()
    return lines
Exemplo n.º 3
0
def makeEndAnimation():
    xamlStr = """
<Storyboard xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
    <DoubleAnimationUsingKeyFrames>
        <DiscreteDoubleKeyFrame KeyTime="0" Value="1"/>
        <EasingDoubleKeyFrame KeyTime="0:0:0.15" Value="1.2">
            <EasingDoubleKeyFrame.EasingFunction>
                <QuadraticEase EasingMode="EaseOut"/>
            </EasingDoubleKeyFrame.EasingFunction>
        </EasingDoubleKeyFrame>
        <EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="1.0">
            <EasingDoubleKeyFrame.EasingFunction>
                <QuadraticEase EasingMode="EaseIn"/>
            </EasingDoubleKeyFrame.EasingFunction>
        </EasingDoubleKeyFrame>
    </DoubleAnimationUsingKeyFrames>
    <DoubleAnimationUsingKeyFrames>
        <DiscreteDoubleKeyFrame KeyTime="0" Value="1"/>
        <EasingDoubleKeyFrame KeyTime="0:0:0.15" Value="0.84">
            <EasingDoubleKeyFrame.EasingFunction>
                <QuadraticEase EasingMode="EaseOut"/>
            </EasingDoubleKeyFrame.EasingFunction>
        </EasingDoubleKeyFrame>
        <EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="1.0">
            <EasingDoubleKeyFrame.EasingFunction>
                <QuadraticEase EasingMode="EaseIn"/>
            </EasingDoubleKeyFrame.EasingFunction>
        </EasingDoubleKeyFrame>
    </DoubleAnimationUsingKeyFrames>
</Storyboard>
"""

    sr = StringReader(xamlStr)
    sb = XamlServices.Load(sr)
    sr.Dispose()

    #FIXME: 入れる先が用意されてないのでダメ
    Storyboard.SetTarget(sb.Children[0], harriet.Character)
    Storyboard.SetTarget(sb.Children[1], harriet.Character)

    Storyboard.SetTargetProperty(
        sb.Children[0], PropertyPath("RenderTransform.Children[2].ScaleX"))
    Storyboard.SetTargetProperty(
        sb.Children[1], PropertyPath("RenderTransform.Children[2].ScaleY"))

    return sb