Giter Site home page Giter Site logo

Comments (4)

wahono77 avatar wahono77 commented on June 2, 2024

I save animation data using studio.createContentOfSaveFile("myproject") to variabel animationData ans save it to file. And after load animationData from file, I want to rebuild sequence animation. But I got nothing. What's wrong in my code?

        studio.setSelection([ObjStudio]);
        const objProp =
          _this.animationData.sheetsById.Objects.sequence.tracksByObject[
            objName
          ];
        if (objProp) {
          const propKeys = Object.keys(objProp.trackIdByPropPath);
          for (var i = 0; i < propKeys.length; i++) {
            let propValue =
              objProp.trackData[objProp.trackIdByPropPath[propKeys[i]]];
            if (propValue.keyframes.length > 0) {
              let propname = JSON.parse(propKeys[i]);
              for (var j = 0; j < propValue.keyframes.length; j++) {
                sheet.sequence.position = propValue.keyframes[j].position;
                studio.transaction(({ set, unset }) => {
                  if (propname.length == 1) {
                    set(
                      ObjStudio.props[propname[0]],
                      propValue.keyframes[j].value
                    );
                  } else {
                    set(
                      ObjStudio.props[propname[0]][propname[1]],
                      propValue.keyframes[j].value
                    );
                  }
                });
              }
            }
          }
        }

from theatre.

vimlesh1975 avatar vimlesh1975 commented on June 2, 2024

The code may work but before using set function, prop must have been manually right click and choose sequence.
I normally save content and animationContent both in a file. When i open the file I Create a new project with saved animationContent. See a ref https://github.com/vimlesh1975/ReactCasparClient/blob/b98222f8a19eeac8cb8b09ae867d9bf1ea56dd52/client/src/theatrejs/WebAnimator.jsx#L1927

from theatre.

wahono77 avatar wahono77 commented on June 2, 2024

The code may work but before using set function, prop must have been manually right click and choose sequence. I normally save content and animationContent both in a file. When i open the file I Create a new project with saved animationContent. See a ref https://github.com/vimlesh1975/ReactCasparClient/blob/b98222f8a19eeac8cb8b09ae867d9bf1ea56dd52/client/src/theatrejs/WebAnimator.jsx#L1927

Thanks vimlesh1975, but right click and choose sequence is impossible if we have many keyframes :)
I think we need new API to create sequence from code.

from theatre.

wahono77 avatar wahono77 commented on June 2, 2024

I got the solution. After load project, sequence should be play to show sequence UI editor
I create the test project here

https://codepen.io/wahono77/pen/RwLNJXK

from theatre.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.