Пример #1
0
        private static void AddAnimations(DocumentData data, IEnumerable <Animation> animations)
        {
            foreach (var animation in animations)
            {
                var domainAnimation = new Domain.Animations.Animation(data.MessageBus, animation.Id, animation.Name)
                {
                    BeginFrame      = animation.BeginFrame,
                    EndFrame        = animation.EndFrame,
                    FramesPerSecond = animation.FramesPerSecond,
                    IsLoop          = animation.IsLoop
                };

                foreach (var nodeAnimation in animation.NodeAnimations)
                {
                    var nodeId = nodeAnimation.NodeId;
                    foreach (var propertyAnimation in nodeAnimation.PropertyAnimations)
                    {
                        var domainPropertyAnimation = new Domain.Animations.PropertyAnimation(data.MessageBus, propertyAnimation.Id, animation.Id, nodeId, (PropertyType)propertyAnimation.Property, propertyAnimation.Vertex);
                        domainAnimation.InternalAdd(data.Nodes[nodeId], domainPropertyAnimation);
                        data.PropertyAnimations.Add(domainPropertyAnimation);
                        AddAnimationKeys(data, propertyAnimation, domainPropertyAnimation);
                    }
                }

                data.Animations.Add(domainAnimation);
            }
        }
Пример #2
0
 private static void AddAnimationKeys(DocumentData data, PropertyAnimation propertyAnimation, Domain.Animations.PropertyAnimation domainPropertyAnimation)
 {
     foreach (var key in propertyAnimation.Keys)
     {
         var interpolation = MapInterpolationData(key.InterpolationType, key.Curve);
         var domainKey     = new Domain.Animations.Key(data.MessageBus, key.Id, propertyAnimation.Id, key.Frame, key.Value, interpolation);
         domainPropertyAnimation.InternalAdd(domainKey);
         data.Keys.Add(domainKey);
     }
 }