ahmadwasfi
Show HN: Rethinking the UI = F(State) Model
https://github.com/livetrails/targetjs
Most modern frameworks model UI as a function of state: change state, re-render. but modern rich UX is increasingly about the space between states. It is about how to represent a smooth transition between states to have a fluid UI.Today, we handle these "in-betweens" state by bolting on external libraries like Framer Motion or GSAP. These often feel like a continuous fight of synching two...
Rebol-style JS framework for async operations and animations
TargetJS: Unifying UI Dev – Animations, State, APIs
Enhancing functions and variables with lifecycles for UI development
Show HN: A UI Framework with a Unified Interface for Variables and Methods
About two months ago, I introduced TargetJ, a JavaScript UI framework. A lot has been done since then, and I have got a lot better at how to describe it. TargetJ provides in nutshell a unified interface for variables and methods, called target. They become the building blocks of components instead of relying on direct usage of variables and methods. This new concept provides more flexible and...
Integrating just the DOM animation from TargetJ with React is likely not feasible, as the two would conflict.
However, I agree that using the Web Animations API could be beneficial when user actions are not involved. This is a great suggestion, and I haven't given it much thought before. I will consider adding a separate API for it using the Web Animations API.
TargetJ uses a unified mechanism for both development and animation by creating targets. Each target essentially has two variables: target and actual. When actual does not equal target, TargetJ will update actual until it matches target through iterations controlled by steps and stepIntervals.
For example, to animate an object along its x-axis:
App(new TModel({ x: [300, 20, 50], // Moves x to 300px in 20 steps with 50ms pauses in between html: 'Hello world' })); You can find more examples at: https://targetj.io/examples.
For Performance: - TargetJ optimizes rendering by minimizing DOM manipulations. - TargetJ divides objects automatically into a tree structure, tracking only the branches visible to the user. See examples of infinite scrolling at https://targetj.io/examples/g-Infinite-scrolling.html and infinite zooming at https://targetj.io/examples/h-Infinite-zooming.html.
I am making the site https://targetj.io more mobile-friendly, which will take a few days. In the meantime, it's best to check it on a computer.
Show HN: TargetJ – New JavaScript framework that can animate anything
https://github.com/livetrails/targetj
I am excited to introduce to you TargetJ, a new JavaScript framework that can animate anything. I have been working on this project for over two years, driven by the complexity of current UI frameworks.You can find the interactive documentation at www.targetj.io.I hope you find it useful for creating great web experiences. If you have any questions about the framework or want to share your...
# The problem
Animating an object in JavaScript is quite challenging, and orchestrating intricate animations among multiple objects is even more complex. Additionally, existing frameworks address it by introducing extra complexity. Furthermore, there is no one single coherent software solution that addresses animation, controls program flow, handles events, and loads data from external APIs, etc.
# The solution
TargetJ simplifies development and animation by employing one concept across all aspects of the program. It is used in animation, controlling program flow, integrating APIs, and so on. This unified approach means that it is easy to learn and can solve complicated problems.
The novel concept that forms its core is called 'targets', Targets are used as the main building blocks of components instead of direct variables and methods. Each component in TargetJ is a set of targets.
# Brief overview of how it operates
Each target in TargetJ essentially has two variables: target and actual. The target can be a static value or a method, while the actual value is always represented as a value. When the target value does not equal the actual value, TargetJ will update the actual value iteratively until it matches the target value. This iteration is determined by two additional variables: steps and step interval. Steps dictate the number of iterations, and the step interval specifies the duration in milliseconds that the system waits before executing the next iteration.
To animate a variable, create a target after its name. There are default target names you can use to animate and impact the UI, such as x, y, width, height, opacity, scale, rotate, zIndex, html, style, css, scrollLeft, and scrollTop. You can also dynamically change how HTML elements are nested using the domHolder or domParent targets. Additionally, there are other target names for dynamic control, such as canHandleEvents to specify which events are handled and canHaveDom to determine if the object requires a DOM element.
A target has a simple life cycle by default: it is executed only once when enabled. The optional enabling method creates dependencies between targets and ensures they execute at precisely the right moment.
# Other features
As a result of using targets, we can develop web sites or apps that require minimal HTML, and CSS, eliminate the need for static HTML nesting, and control the execution flow based on timing, among other benefits.
Explore the full potential of TargetJ and dive into our interactive documentation at www.targetj.io.