Compositor.CreateImplicitAnimationCollection Metode
Definisi
Penting
Beberapa informasi terkait produk prarilis yang dapat diubah secara signifikan sebelum dirilis. Microsoft tidak memberikan jaminan, tersirat maupun tersurat, sehubungan dengan informasi yang diberikan di sini.
Membuat instans ImplicitAnimationCollection.
public:
virtual ImplicitAnimationCollection ^ CreateImplicitAnimationCollection() = CreateImplicitAnimationCollection;
ImplicitAnimationCollection CreateImplicitAnimationCollection();
public ImplicitAnimationCollection CreateImplicitAnimationCollection();
function createImplicitAnimationCollection()
Public Function CreateImplicitAnimationCollection () As ImplicitAnimationCollection
Mengembalikan
Mengembalikan objek ImplicitAnimationCollection yang dibuat.
Persyaratan Windows
Rangkaian perangkat |
Windows 10 Anniversary Edition (diperkenalkan dalam 10.0.14393.0)
|
API contract |
Windows.Foundation.UniversalApiContract (diperkenalkan dalam v3.0)
|
Contoh
class PropertyAnimation
{
PropertyAnimation(Compositor compositor, SpriteVisual heroVisual, SpriteVisual listVisual)
{
// Define ImplicitAnimationCollection
ImplicitAnimationCollection implicitAnimations = compositor.CreateImplicitAnimationCollection();
// Trigger animation when the “Offset” property changes.
implicitAnimations["Offset"] = CreateAnimation(compositor);
// Assign ImplicitAnimations to a visual. Unlike Visual.Children,
// ImplicitAnimations can be shared by multiple visuals so that they
// share the same implicit animation behavior (same as Visual.Clip).
heroVisual.ImplicitAnimations = implicitAnimations;
// ImplicitAnimations can be shared among visuals
listVisual.ImplicitAnimations = implicitAnimations;
listVisual.Offset = new Vector3(20f, 20f, 20f);
}
Vector3KeyFrameAnimation CreateAnimation(Compositor compositor)
{
Vector3KeyFrameAnimation animation = compositor.CreateVector3KeyFrameAnimation();
animation.InsertExpressionKeyFrame(0f, "this.StartingValue");
animation.InsertExpressionKeyFrame(1f, "this.FinalValue");
animation.Target = “Offset”;
animation.Duration = TimeSpan.FromSeconds(0.25);
return animation;
}
}