GithubHelp home page GithubHelp logo

Comments (5)

Prinzhorn avatar Prinzhorn commented on September 13, 2024

What if one behavior just sets the background to red, but another behavior animates the color? The first behavior would only need to apply the style in attach and remove it in detach. The other needs to do it for every scroll.

Let me fall back. What is it that I'm actually trying to solve?

  • Merging multiple transforms from different behaviors (layout + transform)
  • I'm also trying to sync render and scroll calls bc right now render doesn't have access to the layout engine
  • Possibly add prefixes transparently

from scrollmeister.

Prinzhorn avatar Prinzhorn commented on September 13, 2024

I'm also trying to sync render and scroll calls bc right now render doesn't have access to the layout engine

that's fixed by now

from scrollmeister.

Prinzhorn avatar Prinzhorn commented on September 13, 2024

Instead of making it a behavior itself I've put it in the core of Behaviors themselves. Using this.css.translate = 'foo' inside a behavior gives you all the things mentioned above. It will transparently store styles from multiple behaviors and merges them. You also don't need to clean up just like this.listen. The behavior will remove your styles for you. Why can't everything be so simple?

There is just one little thing we need to take care of: ordering. Especially in the case of CSS transforms we need to have a consistent order, because the order of transform operations matters. This is tricky because two behaviors that don't have a common dependency do not have a guaranteed order in which they are attached.

from scrollmeister.

Prinzhorn avatar Prinzhorn commented on September 13, 2024

There is just one little thing we need to take care of: ordering. Especially in the case of CSS transforms we need to have a consistent order, because the order of transform operations matters. This is tricky because two behaviors that don't have a common dependency do not have a guaranteed order in which they are attached.

The actual order in this case is not important (there simply is no intrinsic order) but we need to make the order consistent. For the most important case (layout -> transform behavior) the order is given by the dependencies. However, we currently don't have a linearized list of behaviors. We will create and update this list every time defineBehavior is called (divide-and-conquery the problem down to a single behavior and its position within the list). This list can then be used by both the attachBehaviors call and the applyBehaviorStyle method.

from scrollmeister.

Prinzhorn avatar Prinzhorn commented on September 13, 2024

The order is now consistent with the order the behaviors are defined.

from scrollmeister.

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.