impress / impress.js

It's a presentation framework based on the power of CSS3 transforms and transitions in modern browsers and inspired by the idea behind prezi.com.
http://impress.js.org
MIT License
37.67k stars 6.66k forks source link

Refactor: Make core a general "3D animation API", move parsing of steps to plugin #742

Open henrikingo opened 5 years ago

henrikingo commented 5 years ago

This is an idea @bartaz has discussed with me as I became active in this project. I'm writing down this ticket now triggered by #649.

The basic idea is to simplify the core even more, so that core just moves the viewport to given coordinates. Even the parsing of data-x/y/z attributes would move out of core to some kind of step-positioning plugin.

As a first pass, I'm going to include the concept of a step as a core object though. It is common for animation software to build animations out of steps, so this seems justified. This will result in a more complex api, not less.

Core objects:

The new API could therefore be:

addStep(element, coordinates, [index]) // default: append. This would be the `css()` part of current `initStep()`
removeStep(index)
getSteps() // return: array
getCurrentStep() // return: {index: ..., el: ..., coordinates: ...}

// Move camera to arbitrary coordinates
// Coordinates is essentially this object: https://github.com/impress/impress.js/blob/master/src/impress.js#L282
setCoordinates(coordinates)
getCoordinates()
panZoom(relativeCoordinates)

// The rest stay same as before, but goto() now becomes setCoordinates(getSteps()[target].coordinates))
goto(target) // as currently, target can be an index, step id
next()
prev()
init()
tear()
lib()

What could move out of core:

janishutz commented 1 year ago

Honestly… really amazing idea.

janishutz commented 1 year ago

I am going to be looking into doing this in December this year or January next year when I have time again to work on other projects than my current ones