scenejs icon indicating copy to clipboard operation
scenejs copied to clipboard

Disable animations when Scene is in paused state.

Open fitzmode opened this issue 4 years ago • 3 comments

I have some elemens in a Scene, and I would like to have the animations applied only when Scene is playing. The scenario is the elements can be moved around to adjust their positions before the Scene is played. The problem then is some elements may be offscreen before they are actually played, making an editing use case tedious to implement and depends on a lot of conditional code.

Is there a simple way of conditionally setting the css transforms only when the Scene | SceneItem in a playing state.

Scene({...}, {
...,
disabled: true
})

fitzmode avatar Jun 23 '20 21:06 fitzmode

@fitzmode

What does this mean?

The problem then is some elements may be offscreen before they are actually played, making an editing use case tedious to implement and depends on a lot of conditional code.

Is it certain that a specific item is in a delayed state while it is playing?

daybrush avatar Jun 24 '20 16:06 daybrush

@daybrush Consider a div with SceneItem properties of transform: translate(-400px, 50px) relative to a parent div and a duration of 1 second i.e the div is initially out of view if the parent has overflow hidden .

To be able to use a Moveable on it, one would need to progress the timeline to the specific time the SceneItem finishes. My question is, is there a way to disable the application of SceneItem properties when it is paused, to allow for manipulation of elements, then reapply SceneItem properties on play event.

fitzmode avatar Jun 25 '20 10:06 fitzmode

@fitzmode Well not yet. If what I think is correct, I wonder if it can work with this code.


const frame = item.newFrame(time);

frame.set(....);



// ...
item.update();


daybrush avatar Jul 01 '20 12:07 daybrush