theatre-js / theatre

Motion design editor for the web
https://www.theatrejs.com
Apache License 2.0
11.36k stars 361 forks source link

Changing the project state on the fly #389

Open vimlesh1975 opened 1 year ago

vimlesh1975 commented 1 year ago

I am making a project which animates fabricjs objects with theatrejs studio, and exports pure html with fabirc.min.js and core-only.min.js having animation state.. While working on a project, I would like to import already exported file to modify. I can remove existing fabric objects and sheet objects, add imported fabric objects and create sheet objects. Up to this is fine. But sequence state is not being applied. basically I want to call again project = getProject('HTML Animation Tutorial', {state}), but this would be a new state. But this is disallowed. I want to ask what is workaround for this use case? https://vimlesh1975.github.io/ReactCasparClient/WebAnimator

My import code is const importHtml = async () => { deleteAllObjects() const [aa] = await window.showOpenFilePicker(); if (aa) { const file = await aa.getFile(); const content = await file.text(); var canvasContent = content.split('const content =')[1].split(';')[0]; initialiseCore(canvasContent); var animationContetent = content.split('{state:')[1].split('});')[0]; console.log(animationContetent); project = getProject('HTML Animation Tutorial', { state: JSON.parse(animationContetent) }); } }

vimlesh1975 commented 1 year ago

Now as a workaround I am creating a new project while importing a file. Now I want to delete earlier project and its sheet.

GhostCatcg commented 12 months ago

Hello, have you found any way to solve the problem of not being able to import again?