Beispiel #1
0
    public Timeline(int length = 1000, string name = "timeline", bool mute = false)
    {
        this.length = length;
        this.name   = name;
        this.mute   = mute;

        access = new Access(code);

        access.defaults.timeframe = "read";
        Params(true, 0, 0, 0, true, 0, -999999, false);

        ////Timeline code ----
        code.Init(this);

        //setup binding per timeline
        binding = code.binding;
        binding.Init(this);

        //setup buffer
        buffer = code.buffer;
        buffer.Init(this);

        //setup interpolation
        interpolation = buffer.interpolation;

        //setup timeframe
        timeframe = code.timeframe;
        timeframe.Init(this);

        if (!GUI.initialized)
        {
            string sceneName = SceneManager.GetActiveScene().name;
            ////
            TimelineCode.scene = scenes.Init(this, (Timeline.Scenes.Scene) this.scenes.GetMember(sceneName));

            ////Timeline gui ----
            gui.Init(this); // moved to timline gui Awake()
            timeframe.InitGUI(this);
        }
    }
Beispiel #2
0
            public override void Start(Timeline[] timelines)
            {
                Init(timelines);
                var obj     = new { position = new { type = "position" }, rotation = new { type = "rotation" } };
                var element = new
                {
                    position = new { x = 10, y = 0.1 },
                    variable = variable,
                    nodes    = timeline.code.binding.Add(
                        new object[] {
                        TimelineCode.timeline1,
                        obj.position, 800,
                        obj.rotation, 801,
                        "x", 100f,
                        "y", 50f, 100f,
                        801, 802,
                        false
                    }
                        )
                };

                // TODO Make Queue
                timeline.code.binding.Queue(
                    new object[] {
                    TimelineCode.timeline1,
                    element.position, 800,
                    'x', 100f,
                    'y', 50f,
                    801, 802,
                    false
                }
                    );

                string tlname = timeline.name;

                timeline.access.defaults.timeframe = "read";
                timeline.timeframe.Update();

                Core.Binding bind   = timeline.code.binding;
                Core.Buffer  buffer = timeline.code.buffer;

                Core.TLGameObject earth          = new Core.TLGameObject("Earth");
                Core.TLTransform  earthTransform = earth.transform;
                bind.Add(
                    new object[] {
                    TimelineCode.timeline1,
                    earthTransform.rotation, 804,
                    earthTransform.position, 805, // give binding it's current position
                    'x', 0f,                      // if no value then give current
                    801,
                    false
                }
                    );

                Core.TLGameObject moon          = new Core.TLGameObject("Moon");
                Core.TLTransform  moonTransform = moon.transform;
                moon.nodes = timeline.code.binding.Add(
                    new object[] {
                    TimelineCode.timeline1,
                    moonTransform.rotation, 806,
                    'x', 0f,
                    //'y', 0f,
                    //'z', 0f,
                    801,
                    false
                }
                    );

                //timeline.code.binding.Test();

                buffer.Eval(
                    TimelineCode.timeline1,
                    new object[] {
                    earthTransform.rotation,
                    //earthTransform.position,
                    'x', 360f,
                    "linear", 2200,
                    earthTransform.position,
                    'x', 360f,
                    "inSine", 2200
                }
                    );

                buffer.Eval(
                    TimelineCode.timeline1,
                    new object[] {
                    moonTransform.rotation,
                    'x', 1080f + 360f,
                    "linear", 2198
                }, false, false, (node) => {
                    TimelineCode.Log("This is the end.----------------------------------------------#######");
                    buffer.ZeroOut(TimelineCode.timeline1, 0, timeline.length, new Core.TLType[] { earthTransform.position }, new string[] { "x" });
                    return(0);
                }
                    );

                //buffer.ZeroOut(TimelineCode.timeline1, 0, timeline.length, new Core.TLType[]{earthTransform.position}, new string[]{"x"});

                TimelineCode.timeline1.timeframe.Process = () => {
                    //Log("TL1");
                };
                TimelineCode.timeline2.timeframe.Process = () => {
                    //Log("TL2");
                };
                TimelineCode.timeline1.timeframe.Invoke  = () => {
                    //Log("TL1");
                };
                TimelineCode.timeline2.timeframe.Invoke  = () => {
                    //Log("TL2");
                };
            }
Beispiel #3
0
 public Access(Core code)
 {
     this.code    = code;
     this.binding = code.binding;
 }
Beispiel #4
0
            public override void Start(Timeline[] timelines)
            {
                Init(timelines);
                Core.Binding bind   = timeline.code.binding;
                Core.Buffer  buffer = timeline.code.buffer;

                BottleObject bottle = new BottleObject();

                Core.TLImpulseTransform bottleTransform = bottle.parent.transform;
                bind.Add(
                    new object[] {
                    TimelineCode.timeline1,
                    bottleTransform.rotation, 806,
                    bottleTransform.position, 805, // give binding it's current position
                    'x',                           // if no value then give current
                    'y',                           // if no value then give current
                    'z',                           // if no value then give current
                    801, 802, 803,
                    false
                }
                    );

                buffer.Eval(
                    TimelineCode.timeline1,
                    new object[] {
                    bottleTransform.rotation,
                    'z', 90f,
                    "inSine", 500,
                }, false, false, (node) => {
                    node.parameter.mute = true;    // Let Impulse Take Control
                    return(0);
                }
                    );

                buffer.Eval(
                    TimelineCode.timeline1,
                    new object[] {
                    bottleTransform.position,
                    'y', 15f,
                    "inSine", 500,
                    'x', 15f,
                    "outSine", 500,
                }, false, false, (node) => {
                    node.parameter.mute = true;    // Let Impulse Take Control
                    bottle.parent.impulseObject.body.velocity.Set(0, 0);
                    bottle.parent.impulseObject.body.force.Set(0, 0);
                    bottle.parent.impulseObject.body.shape.Initialize();
                    return(0);
                }
                    );

                TimelineCode.timeline1.timeframe.Process = () => {
                    //Log("TL1");
                };
                TimelineCode.timeline2.timeframe.Process = () => {
                    //Log("TL2");
                };
                TimelineCode.timeline1.timeframe.Invoke  = () => {
                    //Log("TL1");
                };
                TimelineCode.timeline2.timeframe.Invoke  = () => {
                    //Log("TL2");
                };
            }