benlime

benlime

LiveMotion enables high performance animations declared on the server and run on the client.

As a follow up to my previous thread A library for high performance LiveView animations I released the first initial version 0.1.0 of the library for you to play around with it.

There is still a lot to do, but works as a first version. I would be glad if you give it a try. I hope it makes animations using LiveView a lot more convenient.

Docs: LiveMotion — LiveMotion v0.3.1
Repo: GitHub - benvp/live_motion: High performance animation library for Phoenix LiveView · GitHub
Examples: https://livemotion.benvp.co

https://cleanshot-cloud-fra.accelerator.net/media/26144/yvBCYQ2B1940j2e20mhHJO12vauM1cfJo5gJgRP0.mp4
https://cleanshot-cloud-fra.accelerator.net/media/26144/p5RbCZhU7yRjtyBAb6E9U0LCNjzeJgBvGjP4Tqc7.mp4
If it would be preferable to merge it with my previous thread, please do so :slight_smile: I just thought it would be better to have a distinct thread for it.

Cheers
Ben

Showing Posts 1 to 10

benlime

benlime OP

Just release v0.1.2 which adds the LiveMotion.JS.show/1 function. This function was previously mentioned in the docs, but did not exist yet.

This let’s you now add client side animations for dynamically showing elements (e.g. on button clicks).

11
Post #1
kingdomcoder

kingdomcoder

Well done @benlime

Kudos!

bjunc

bjunc

Haven’t had a chance to peak under the hood, but you might find my CubicBezier lib useful. Essentially a port of the CSS timing functions (similar to what is used in GS and other tweening libs).

benlime

benlime OP

Not sure if I am missing something, but I think that’s not required for LiveMotion because all animations happen on the client. So there is actually no need to have cubic-bezier functions within the Elixir codebase.

v0.2.0

I released a new version which introduces two new lifecycle functions on_animation_start and on_animation_complete. These will allow you to push events or run JS actions whenever an animation starts or ends. You can do something like the following (in a phx-click handler for example):

MotionJS.animate([rotate: [0, 45, -45, 90, 0]], [duration: 1], to: "#rectangle")
  |> MotionJS.show(to: "#love-div", keyframes: [opacity: 1, y: 20, rotate: 180])
  |> Phoenix.LiveView.JS.push("some_push")

Additionally fixes a bug that animations did not run on update.

bjunc

bjunc

I don’t think you’re missing anything. Like I said, I didn’t look at the code, and it wasn’t immediately clear where the animation positions were being computed. The cubic-bezier lib above is for replicating client-side tweening libraries, but computed on a server.

In my tests, it is technically feasible to “stream” positioning from the server using this lib, but it can be impractical for many use-cases (opting for a FLIP model where the actual animation is computed client-side). However, there are some nice use-cases for calculating the percentage of a tween based on the easing function.

benlime

benlime OP

I understand. With LiveMotion I’m striving to fully run all animations directly on the client. I know there are technical demos with streaming animations, but as you said, it is quite impractical for almost all use cases. That’s why LiveMotion only declares (on the server) how the animation should be performed. The JS part then reads the declaration and performs the animations on the client accordingly.

benlime

benlime OP

I added a website with a few examples of LiveMotion. I’ll add more in the next couple of weeks.

15
Post #7
cblavier

cblavier

Awesome! Keep up with the good work :flexed_biceps:

thelastinuit

thelastinuit

Not all heroes wear capes!

benlime

benlime OP

I just released v0.3.0 of LiveMotion. This update includes support for LiveView 0.18 and adds a few new things. Check out the changelog.

Next up will be a new component called presence which will make transitions like the following possible.

https://twitter.com/benvp_/status/1562425248514916352

I orignally wanted to include it in this release, but it is still a bit experimental and needs a bit of polishing.

Stay tuned.

Where Next? Top

Trending in Announcing Top

wojtekmach
Hey everyone! Req is an HTTP client for Elixir that I’ve been working on for quite some time. There is already a lot of HTTP clients out...
New
handnot2
Samly can be used to enable SAML 2.0 Single Sign On in a Plug/Phoenix application. This library uses Erlang esaml to provide plug enabl...
New
woylie
Flop is an Elixir library that applies filtering, ordering and pagination parameters to your Ecto queries. offset-based pagination with...
New
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
fuelen
Hi all! I want to present a small library which provides a mix task for generating an Entity-Relationship Diagram for Ecto schemas. You...
New
anuaralfetahe
Hello Published a new library - ProcessHub! ProcessHub is a library designed to manage process distribution within the Elixir cluster. ...
New

Other Trending Topics Top

mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
mudasobwa
I am seeing a lot of aplications of Argumentum ad Vericundiam in software discussions. They do link some piece of writing and point us to...
New
AstonJ
This showed up on my feed.. anyone heard of it? Just hype? Ox Alpha is a reasoning model designed for coding, sustained ag...
New
sergio
It’s not that it’s vocabulary is too advanced. It’s something worse. I get lost trying to follow even a paragraph written by Claude. It’...
New
sorenone
Today we’re releasing Oban for Python. Not an Oban client in Python. Not a pythonx wrapper embedded in Elixir. Nope, it’s a fully operati...
New
akoutmos
@hugobarauna, Dr. Dimitrios Koutmos (my brother) and I (Alex Koutmos) have been hard at work on writing a book on how you can use Elixir ...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews