Giter Site home page Giter Site logo

Comments (7)

alejolale avatar alejolale commented on May 29, 2024

Hi !
I'm interested in this work ! could you explain more clear this work ?

Thanks for your answer

from etro.

clabe45 avatar clabe45 commented on May 29, 2024

Absolutely! Because properties can be keyframes, functions, or just simple values; we need a way to get the current value of a property for a frame. Right now, the util function val(property, element, time) does this, but I think there is a way to make the syntax nicer (and more friendly to usage from the user).

The task is to write a getter and setter for each public property (that's intended to be used externally). I'm thinking something like:

// for layers
set propName(value) {
    this._propName = value;
}

get propName() {
    return val(this._propName, this, this._movie.currentTime - this.startTime);
}

Doing this will solve another problem: There are some properties that require custom logic when accessing their values, like layer dimensions default to the movie's dimensions when they are undefined. Right now, this is handled by resizing the canvas to the current frame's values each frame. Then, the canvas's dimensions are read for the rest of the frame. It would be a lot better to put this logic in a getter, like:

// in layer.Base
get width() {
    return val(this._width, this, this._movie.currentTime - this.startTime);
}

I just created #20 which ideally should be done first, so you can use this.currentTime for movies and layers and this._target.currentTime for effects when you pass the time to val.

from etro.

clabe45 avatar clabe45 commented on May 29, 2024

I updated the OP with a checklist. Just pick one and push it to a new feature branch for this issue, unless you're feeling ambitious. Or, you can start with one of the smaller good first issues, if you'd like.

from etro.

thefishgineer avatar thefishgineer commented on May 29, 2024

Any progress on this? I can help with this.

from etro.

clabe45 avatar clabe45 commented on May 29, 2024

@alejolale Are you currently working on this issue?

from etro.

clabe45 avatar clabe45 commented on May 29, 2024

@rc41186 I forget about this, yes you can work on it if you're still interested

from etro.

clabe45 avatar clabe45 commented on May 29, 2024

I decided not to do this, because it would be very error-prone to have to implement setters and getters (that call val) for every public property in every class. Instead, I implemented property filters (0fca188) that process the results of val. You only need to implement property filters when custom logic needs to be applied to the instant value.

from etro.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.