Ejemplo n.º 1
0
        public bool tryGetObject(string id, out MovieClipObject obj)
        {
            if (id == null)
            {
                obj = null;
                return(false);
            }

            return(objects.TryGetValue(id, out obj));
        }
Ejemplo n.º 2
0
 protected override void copyInternalFrom(MovieClipObject obj)
 {
     base.copyInternalFrom(obj);
     if (obj is BuilderMovieClipObject builderObject)
     {
         parameters.Clear();
         foreach (var entry in builderObject.parameters)
         {
             parameters.Add(entry.Key, entry.Value);
         }
     }
 }
Ejemplo n.º 3
0
 protected virtual void copyInternalFrom(MovieClipObject obj)
 {
     _index          = obj.index;
     _layer          = obj.layer;
     position        = obj.position;
     scale           = obj.scale;
     rotation        = obj.rotation;
     pivot           = obj.pivot;
     opacity         = obj.opacity;
     deathTime       = obj.deathTime;
     debugOffset     = obj.debugOffset;
     debugProperties = obj.debugProperties;
 }
Ejemplo n.º 4
0
        public bool updateObject(MovieClipObject obj)
        {
            if (obj?.id == null)
            {
                return(false);
            }
            if (!objects.ContainsKey(obj.id))
            {
                return(false);
            }

            objects[obj.id] = obj;
            sortedObjects   = null;
            return(true);
        }
Ejemplo n.º 5
0
        public bool createObject(
            MovieClipObject obj,
            Offset position           = null,
            Offset pivot              = null,
            Size scale                = null,
            float rotation            = 0,
            float opacity             = 1,
            float delay               = 0,
            AppearAnimation animation = AppearAnimation.none,
            float appearTime          = kDefaultAppearTime)
        {
            if (!addObject(obj))
            {
                return(false);
            }

            obj.initConstants(
                position: position,
                pivot: pivot,
                scale: scale,
                rotation: rotation,
                opacity: opacity);
            var targetPosition = position ?? Offset.zero;

            switch (animation)
            {
            case AppearAnimation.none:
                break;

            case AppearAnimation.fadeIn:
                obj.opacityTo(opacity, timestamp + delay, appearTime, 0);
                break;

            case AppearAnimation.scale:
                obj.scaleTo(scale ?? new Size(1, 1),
                            timestamp + delay,
                            appearTime,
                            new Size(0, 0));
                break;

            case AppearAnimation.overScale:
                obj.scaleTo(scale ?? new Size(1, 1),
                            timestamp + delay,
                            appearTime,
                            new Size(0, 0),
                            Curves.easeOutBack);
                break;

            case AppearAnimation.fromTop:
                obj.moveTo(targetPosition,
                           timestamp + delay,
                           appearTime,
                           targetPosition - new Offset(0, kDefaultAppearDistance));
                break;

            case AppearAnimation.fromBottom:
                obj.moveTo(targetPosition,
                           timestamp + delay,
                           appearTime,
                           targetPosition + new Offset(0, kDefaultAppearDistance));
                break;

            case AppearAnimation.fromLeft:
                obj.moveTo(targetPosition,
                           timestamp + delay,
                           appearTime,
                           targetPosition - new Offset(kDefaultAppearDistance, 0));
                break;

            case AppearAnimation.fromRight:
                obj.moveTo(targetPosition,
                           timestamp + delay,
                           appearTime,
                           targetPosition + new Offset(kDefaultAppearDistance, 0));
                break;
            }

            return(true);
        }