Skip to content

Movie isn't rendered when doing a click selector #74

@ChristianEmmanuel-dev

Description

@ChristianEmmanuel-dev

Hello!

Well, this is whats happening

I'm trying to show 2 buttons on screen,

When clicking the idea is if it was button1 to render on screen animation1

If it was button2 to render on screen animation2

I'm using the code shown below and well, all vars used are indeed being updated but it seems animationObject isn't

Any help will be apreciated

Thanks a lot!

import { useState } from "react";
import AnimateCC from "react-adobe-animate";

const App = () => {
  const [paused, setPaused] = useState(false);
  let [animationObject, getAnimationObject] = useState(null);
  const [animationName, setAnimationName] = useState("animacion1");
  const [composition, setComposition] = useState("31CF89A62C0C40B6A9FBB94549BA8682");
  console.log("animationObject ::: " , animationObject);

  const shoot = (animationName,composition) => {
    console.log(animationName);
    console.log(composition);

    setAnimationName(animationName)
    setComposition(composition)
  }
  
  
  return (
    <div style={{ width: "1024px", height: "638px" }}>
      <AnimateCC
        animationName={animationName}   
        composition={composition} 
        paused={paused}        
      />

      <button onClick={() => shoot("animacion1","31CF89A62C0C40B6A9FBB94549BA8682")}>Archivo 1</button>
      <button onClick={() => shoot("animacion2","78AD7AADD9ABE045B68AAC9D6B6B1C41")}>Archivo 2</button>

      <p>{animationName}</p>
           
    </div>
  );
};

export default App;

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions