atelier:mitsuba

i love UI/UX, Blend, XAML, Behavior, P5, oF, Web, Tangible Bits and Physical computing. なにかあればお気軽にご連絡ください。atelier@c-mitsuba.com

Perspective3Dで立方体を描いてみた・・・かったorz

結論

*要SL3プラグイン

http://c-mitsuba.dyndns.org/SqSL/SqSL.html


Cancasタグの中に立方体を作って、

そのキャンバスをまわそうとしたらこうなったw

なぜだろう。

<UserControl x:Class="SilverlightApplication7.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    Width="400" Height="300">
    <Grid x:Name="LayoutRoot" Background="White">
        <Canvas x:Name="square">
            <Canvas.Resources>
                <Storyboard x:Name="Rotate">
                    <DoubleAnimation BeginTime="00:00:00"
                  Storyboard.TargetName="square"
                  Storyboard.TargetProperty="(UIElement.Projection).(RotationX)"
                  RepeatBehavior="Forever" AutoReverse="True"
                  From="45" To="-25">
                    </DoubleAnimation>
                    <DoubleAnimation BeginTime="00:00:00"
                  Storyboard.TargetName="square"
                  Storyboard.TargetProperty="(UIElement.Projection).(RotationZ)"
                  RepeatBehavior="Forever" AutoReverse="True"
                  From="55" To="-45">
                    </DoubleAnimation>
                    <DoubleAnimation BeginTime="00:00:00"
                  Storyboard.TargetName="square"
                  Storyboard.TargetProperty="(UIElement.Projection).(RotationY)"
                  RepeatBehavior="Forever" AutoReverse="True"
                  From="85" To="-95">
                    </DoubleAnimation>
                </Storyboard>
            </Canvas.Resources>
            <Canvas.Projection>
                <PlaneProjection RotationX="0" RotationY="0" RotationZ="0"></PlaneProjection>
            </Canvas.Projection>
            
            <Rectangle x:Name="s1" Width="150" Height="150" Fill="Gray" Stroke="Blue">
                <Rectangle.Projection>
                    <PlaneProjection RotationX="0" RotationY="0" RotationZ="0"></PlaneProjection>
                </Rectangle.Projection>
            </Rectangle>
            
            <Rectangle x:Name="s2" Width="150" Height="150" Fill="Gray" Stroke="Blue" Canvas.Top="75">
                <Rectangle.Projection>
                    <PlaneProjection RotationX="90" RotationY="0" RotationZ="0"></PlaneProjection>
                </Rectangle.Projection>
            </Rectangle>

            <Rectangle x:Name="s3" Width="150" Height="150" Fill="Gray" Stroke="Blue" Canvas.Top="-75">
                <Rectangle.Projection>
                    <PlaneProjection RotationX="-90" RotationY="0" RotationZ="0"></PlaneProjection>
                </Rectangle.Projection>
            </Rectangle>

            <Rectangle x:Name="s4" Width="150" Height="150" Fill="Gray" Stroke="Blue" Canvas.Left="75">
                <Rectangle.Projection>
                    <PlaneProjection RotationX="0" RotationY="90" RotationZ="0"></PlaneProjection>
                </Rectangle.Projection>
            </Rectangle>

            <Rectangle x:Name="s5" Width="150" Height="150" Fill="Gray" Stroke="Blue" Canvas.Left="-75">
                <Rectangle.Projection>
                    <PlaneProjection RotationX="0" RotationY="-90" RotationZ="0"></PlaneProjection>
                </Rectangle.Projection>
            </Rectangle>

            <Rectangle Visibility="Collapsed" x:Name="s6" Width="150" Height="150" Fill="Gray" Stroke="Blue">
                <Rectangle.Projection>
                    <PlaneProjection RotationX="0" RotationY="0" RotationZ="0"></PlaneProjection>
                </Rectangle.Projection>
            </Rectangle>

        </Canvas>
    </Grid>
</UserControl>