trystyncote / scripted-video

This is a project that attempts to produce an animation-looking video based on a given script.
MIT License
0 stars 0 forks source link

Change the Syntax of the CREATE/MOVE/DELETE OBJECT keywords. Again. #11

Closed trystyncote closed 1 year ago

trystyncote commented 1 year ago

I've been working with CSS (and HTML by extension) a lot lately and it gave me a solution to something that I was constantly thinking about: how do I allow more added attributes to the OBJECT collection of keywords? I've wanted to add more features to these keywords, seeing as they are currently the heart of the video's output, and allowing more functionality could make it easier to work with. The problem is, I don't want a crazy amount of arguments for one tag. Especially if most of them are optional.

In a draft for the upcoming second test script, I added the following line,

CREATE OBJECT bg: 
    addr/bg.png, 
    0s, 0, 0, 1, 1, looping=allowed;

*Syntax for this script is not set in stone.

The syntax is trying to create a background image on layer 1, in full scale, with it looping over the duration of the screen. This is unreadable and I don't really fancy having all of those positions hard-coded.

Instead, I think I would prefer something like this:

CREATE OBJECT bg {
    file-name: addr/bg.png;
    create-time: 0s;
    x: 0;
    y: 0;
    scale: 1;
    layer: 1;
    looping: allowed;
}

I think that this version is far more readable, and less error-prone. (I think there is a fair liklihood that one will mix two or more of those arguments and then completely break their script.) Optional parameters could simply be excluded.

This syntax, however, comes with the immediately consequence of breaking the Scripter class. Why? Because it's using semi-colons to conclude the individual traits of the script. This parallels the behaviour in CSS, but the Scripter class in my current implementation breaks up lines by semi-colons. This would cause unintended behaviour. For now, this is going to take a back-seat as I work on the testing badge for this project.