本文整理汇总了C#中PlaneProjection类的典型用法代码示例。如果您正苦于以下问题:C# PlaneProjection类的具体用法?C# PlaneProjection怎么用?C# PlaneProjection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PlaneProjection类属于命名空间,在下文中一共展示了PlaneProjection类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawLeftPage
private void DrawLeftPage()
{
//Tworzę obiekt canvas
Canvas cv = new Canvas();
cv.Width = 100;
cv.Height = 100;
SolidColorBrush sb = new SolidColorBrush(Color.FromArgb(255, 0, 255, 255));
cv.Background = sb;
Canvas.SetLeft(cv, 150);
Canvas.SetTop(cv, 100);
//Projekcja
PlaneProjection pp = new PlaneProjection();
pp.LocalOffsetX = -50.0;
cv.Projection = pp;
//Dodaję canvas
plutno.Children.Add(cv);
//Tworzę animację
stL = new Storyboard();
DoubleAnimation db = new DoubleAnimation();
db.Duration = new Duration(TimeSpan.FromMilliseconds(1000));
db.From = 0.0;
db.To = -180.0;
Storyboard.SetTarget(db, pp);
Storyboard.SetTargetProperty(db, new PropertyPath(PlaneProjection.RotationYProperty));
//Dodanie animacji do storyboarda
stL.Children.Add(db);
}
示例2: LightBoxView
public LightBoxView()
: base()
{
this.projection = new PlaneProjection();
this.timer = new DispatcherTimer();
this.timer.Tick += new EventHandler(OnTick);
this.image.Projection = new PlaneProjection();
}
示例3: SetProjection
private void SetProjection(double xAngle, double yAngle)
{
PlaneProjection projection = Projection as PlaneProjection;
if (projection == null)
{
projection = new PlaneProjection();
Projection = projection;
}
projection.RotationX = xAngle;
projection.RotationY = yAngle;
}
示例4: Star
public Star(ImageSource source, double size)
{
Image image = new Image();
image.Source = source;
image.Projection = new PlaneProjection();
this.projection = (PlaneProjection)image.Projection;
image.Opacity = GlobalValue.OPACITY;
image.Width = size;
image.Height = size;
this.Children.Add(image);
}
示例5: MemoSummaryControl
/// <summary>
/// CTOR
/// </summary>
public MemoSummaryControl()
{
_planeprojection = new PlaneProjection
{
CenterOfRotationX = 0.5,
CenterOfRotationY = 0.5
};
this.Projection = _planeprojection;
this.ManipulationStarted += new EventHandler<ManipulationStartedEventArgs>(OnManipStarted);
this.ManipulationDelta += new EventHandler<ManipulationDeltaEventArgs>(OnManipDelta);
this.ManipulationCompleted += new EventHandler<ManipulationCompletedEventArgs>(OnManipulationCompleted);
}
示例6: CreateEffectAnimation
/// <internalonly />
protected internal override ProceduralAnimation CreateEffectAnimation(AnimationEffectDirection direction)
{
FrameworkElement target = GetTarget();
if (_projection == null) {
_projection = target.Projection as PlaneProjection;
if (_projection == null) {
_projection = new PlaneProjection();
_projection.CenterOfRotationX = 0.5;
_projection.CenterOfRotationY = 0.5;
_projection.CenterOfRotationZ = 0.5;
target.Projection = _projection;
}
}
DoubleAnimation zOffsetAnimation =
new DoubleAnimation(_projection, PlaneProjection.GlobalOffsetZProperty, Duration,
(direction == AnimationEffectDirection.Forward ? Distance : 0));
zOffsetAnimation.Interpolation = GetEffectiveInterpolation();
if (_shadowLength == 0) {
zOffsetAnimation.AutoReverse = AutoReverse;
return zOffsetAnimation;
}
if (_dropShadow == null) {
_dropShadow = target.Effect as DropShadowEffect;
if (_dropShadow == null) {
_dropShadow = new DropShadowEffect();
_dropShadow.BlurRadius = 0;
_dropShadow.ShadowDepth = 0;
_dropShadow.Color = Colors.Black;
_dropShadow.Opacity = 0.5;
target.Effect = _dropShadow;
}
}
DoubleAnimation shadowAnimation =
new DoubleAnimation(_dropShadow, DropShadowEffect.BlurRadiusProperty, Duration,
(direction == AnimationEffectDirection.Forward ? _shadowLength : 0));
shadowAnimation.Interpolation = GetEffectiveInterpolation();
ProceduralAnimationSet animationSet = new ProceduralAnimationSet(zOffsetAnimation, shadowAnimation);
animationSet.AutoReverse = AutoReverse;
return animationSet;
}
示例7: LayoutRoot_Loaded
// Load WelcomePromo user control
private void LayoutRoot_Loaded(object sender, RoutedEventArgs e)
{
if (this.timer == null)
{
this.timer = new DispatcherTimer();
this.timer.Interval = TimeSpan.FromMilliseconds(50);
this.timer.Tick += new EventHandler(timer_Tick);
this.timer.Start();
}
Reset(); // reset all rectangles
this.curRectangle = GetCurrentRectangle();
this.projection = (PlaneProjection)this.curRectangle.Projection;
}
示例8: UpdateStateValue
public override void UpdateStateValue(BoxData newState)
{
state = newState;
if (state._state == LightBox.ConcealState)
{
this.image.Source = GetLightBoxImage(state);
this.image.Stretch = Stretch.UniformToFill;
}
else
{
this.projection = (PlaneProjection)this.image.Projection;
this.projection.RotationX = 0;
this.timer.Interval = TimeSpan.FromMilliseconds(50);
this.timer.Start();
}
}
示例9: CreateImagePushpin
/// <summary>
/// Creates an Image pushpin
/// </summary>
/// <param name="imageUri">Uri of the image to use for the pushpin icon</param>
/// <param name="width">Width of the pushpin</param>
/// <param name="height">Height of the pushpin</param>
/// <param name="offset">Offset distance for the pushpin so that the point of the
/// pin is aligned with the associated coordinate.</param>
/// <returns></returns>
public static UIElement CreateImagePushpin(Uri imageUri, double width, double height, int rotateTr, Point offset, PlaneProjection planeProjection)
{
//Source.RenderTransform.r
//TransformGroup
RotateTransform RotateTr = new RotateTransform();
RotateTr.Angle = rotateTr;
return new Image()
{
Source = new BitmapImage(imageUri),
//RenderTransform = RotateTr,
Width = width,
Height = height,
//Stretch = System.Windows.Media.Stretch.Uniform,
//VerticalAlignment = VerticalAlignment.Center,
//HorizontalAlignment = HorizontalAlignment.Center,
Margin = new Thickness(offset.X, offset.Y, 0, 0),
Projection = planeProjection,
};
}
示例10: CreateStoryboard
protected override Storyboard CreateStoryboard(FrameworkElement target)
{
Storyboard result = new Storyboard();
if (target != null)
{
DoubleAnimation animation = new DoubleAnimation();
animation.From = From;
animation.To = To;
if (Speed != -1)
animation.SpeedRatio = Speed;
if (Duration != -1)
{
animation.SpeedRatio = 1;
animation.Duration = TimeSpan.FromMilliseconds(Duration);
}
EasingFunction.EasingMode = Mode;
PlaneProjection projection = new PlaneProjection();
target.Projection = projection;
animation.EasingFunction = EasingFunction;
Storyboard.SetTarget(animation, projection);
if(RotationCenter!=null){
projection.CenterOfRotationX=RotationCenter.X;
projection.CenterOfRotationY=RotationCenter.Y;
}
if (RotationAxe == null)
{
RotationAxe = PlaneProjection.RotationYProperty;
}
Storyboard.SetTargetProperty(animation, new PropertyPath(RotationAxe));
result.Children.Add(animation);
}
else
{
Debugger.Log(1, "animation", "target is null for RotateEffect");
}
return result;
}
示例11: NookBoxView
public NookBoxView()
: base()
{
this.projection = new PlaneProjection();
this.image.Source =
BlackboxImageUtils.Image(BlackboxImageType.NookBoxBackground);
this.imageForeground.Source =
BlackboxImageUtils.Image(BlackboxImageType.NookBoxForeground);
this.imageForeground.Projection = new PlaneProjection();
this.projection = (PlaneProjection)this.imageForeground.Projection;
this.rotatedTimer = new DispatcherTimer();
this.rotatedTimer.Interval = TimeSpan.FromMilliseconds(RotatedTimeSpane);
this.rotatedTimer.Tick += new EventHandler(OnRotatedTimerTick);
this.rotatedTimer.Start();
this.speed = NormalSpeed;
this.acceleratedTimer = new DispatcherTimer();
this.acceleratedTimer.Interval = TimeSpan.FromMilliseconds(AcceleratedTimeSpan);
this.acceleratedTimer.Tick += new EventHandler(OnAcceleratedTimerTick);
}
示例12: PrepareGrowStoryBoard
/// <summary>
/// 由小到大显示Element
/// </summary>
/// <param name="Element">需要应用Storyboard的对象</param>
/// <param name="seconds">动画处理时间</param>
/// <returns>已经根据Element封装好的动画,返回的Storyboard直接使用Begin函数即可</returns>
public static Storyboard PrepareGrowStoryBoard(FrameworkElement Element, double seconds)
{
PlaneProjection _planePrj = new PlaneProjection();
Element.Projection = _planePrj;
Storyboard _storyboard = new Storyboard();
TransformGroup transGroup = new TransformGroup();
ScaleTransform scaletrans = new ScaleTransform();
transGroup.Children.Add(scaletrans);
scaletrans.CenterX = 0.5;
scaletrans.CenterY = 0.5;
Element.RenderTransform = transGroup;
Element.RenderTransformOrigin = new Point(0.5, 0.5);
DoubleAnimation doubleX = new DoubleAnimation();
doubleX.From = 0;
doubleX.To = 1;
doubleX.FillBehavior = FillBehavior.HoldEnd;
_storyboard.Children.Add(doubleX);
DoubleAnimation doubleY = new DoubleAnimation();
doubleY.From = 0;
doubleY.To = 1;
doubleY.FillBehavior = FillBehavior.HoldEnd;
_storyboard.Children.Add(doubleY);
//调用封装透明度和旋转X轴方法
AddDoubleAnimation(Element, seconds, _storyboard);
Storyboard.SetTarget(doubleX, Element);
Storyboard.SetTargetProperty(doubleX,
new PropertyPath("(UIElement.RenderTransform).(transGroup.Children)[0].(ScaleTransform.ScaleX)"));
Storyboard.SetTarget(doubleY, Element);
Storyboard.SetTargetProperty(doubleY,
new PropertyPath("(UIElement.RenderTransform).(transGroup.Children)[0].(ScaleTransform.ScaleY)"));
_storyboard.Completed += (s, e) => { _storyboard.Stop(); };
return _storyboard;
}
示例13: TryAttachProjectionAndTransform
/// <summary>
/// Prepares a framework element to be feathered by adding a plane projection
/// and a composite transform to it.
/// </summary>
/// <param name="root">The root visual.</param>
/// <param name="element">The framework element.</param>
private static bool TryAttachProjectionAndTransform(PhoneApplicationFrame root, FrameworkElement element)
{
GeneralTransform generalTransform;
try
{
generalTransform = element.TransformToVisual(root);
}
catch (ArgumentException)
{
return false;
}
Point coordinates = generalTransform.Transform(Origin);
double y = coordinates.Y + element.ActualHeight / 2.0;
double offset = (root.ActualHeight / 2.0) - y;
// Cache original projection and transform.
TurnstileFeatherEffect.SetOriginalProjection(element, element.Projection);
TurnstileFeatherEffect.SetOriginalRenderTransform(element, element.RenderTransform);
// Attach projection.
PlaneProjection projection = new PlaneProjection();
projection.GlobalOffsetY = offset * -1.0;
projection.CenterOfRotationX = FeatheringCenterOfRotationX;
element.Projection = projection;
// Attach transform.
Transform originalTransform = element.RenderTransform;
TranslateTransform translateTransform = new TranslateTransform();
translateTransform.Y = offset;
TransformGroup transformGroup = new TransformGroup();
transformGroup.Children.Add(originalTransform);
transformGroup.Children.Add(translateTransform);
element.RenderTransform = transformGroup;
return true;
}
示例14: DisplayHandCards
private void DisplayHandCards()
{
var element = new HandCardsElement(Player.HandCards,
showFaces: true,
rotationAngle: 0,
displayCardCount: false)
{
CardWidth = myHandCardsElement.CardWidth,
CardHeight = myHandCardsElement.CardHeight,
};
UIElement rootVisual = Application.Current.RootVisual;
var startRect = myHandCardsElement.GetRect(rootVisual);
var endRect = new Rect(0, 0, rootVisual.RenderSize.Width, rootVisual.RenderSize.Height);
const double endXStep = 1.1;
double endCardWidth = rootVisual.RenderSize.Width / (Player.HandCards.Count * endXStep + 2 * (endXStep - 1));
double endCardHeight = myHandCardsElement.CardHeight * endCardWidth / myHandCardsElement.CardWidth;
var projection = new PlaneProjection();
element.Projection = projection;
myHandCardsElement.Visibility = Visibility.Collapsed;
myHandCardsElement.NavigationAction = null;
Cursor = Cursors.Arrow;
Action onClosed = delegate
{
myHandCardsElement.Visibility = Visibility.Visible;
Timer timer = null;
timer = new Timer(delegate
{
myHandCardsElement.NavigationAction = DisplayHandCards;
timer.Dispose();
},
null, 500, int.MaxValue);
};
UIManager.Instance.ShowInPopup(element, startRect, endRect, onClosed,
new AnimationInfo(element, new PropertyPath(HandCardsElement.XStepProperty), myHandCardsElement.XStep, endXStep),
new AnimationInfo(element, new PropertyPath(HandCardsElement.MaxAngleProperty), myHandCardsElement.MaxAngle, 0),
new AnimationInfo(element, new PropertyPath(HandCardsElement.AngleStepProperty), myHandCardsElement.AngleStep, 0),
new AnimationInfo(element, new PropertyPath(HandCardsElement.CardWidthProperty), myHandCardsElement.CardWidth, endCardWidth),
new AnimationInfo(element, new PropertyPath(HandCardsElement.CardHeightProperty), myHandCardsElement.CardHeight, endCardHeight),
new AnimationInfo(projection, new PropertyPath(PlaneProjection.RotationXProperty), -45, 0));
}
示例15: PrepareControlForTilt
/// <summary>
/// Prepares a control to be tilted by setting up a plane projection and some event handlers
/// </summary>
/// <param name="element">The control that is to be tilted</param>
/// <param name="centerDelta">Delta between the element's center and the tilt container's</param>
/// <returns>true if successful; false otherwise</returns>
/// <remarks>
/// This method is pretty conservative; it will fail any attempt to tilt a control that already
/// has a projection on it
/// </remarks>
static bool PrepareControlForTilt(FrameworkElement element, Point centerDelta)
{
// Don't clobber any existing transforms
if (element.Projection != null || (element.RenderTransform != null && element.RenderTransform.GetType() != typeof(MatrixTransform)))
return false;
TranslateTransform transform = new TranslateTransform();
transform.X = centerDelta.X;
transform.Y = centerDelta.Y;
element.RenderTransform = transform;
PlaneProjection projection = new PlaneProjection();
projection.GlobalOffsetX = -1 * centerDelta.X;
projection.GlobalOffsetY = -1 * centerDelta.Y;
element.Projection = projection;
element.ManipulationDelta += TiltEffect_ManipulationDelta;
element.ManipulationCompleted += TiltEffect_ManipulationCompleted;
return true;
}