### Setup TorchServe Locally on macOS Source: https://github.com/facebookresearch/animateddrawings/blob/main/README.md Installs and starts TorchServe locally on macOS without Docker. This script is a convenient alternative for local experimentation. Ensure you are in the 'torchserve' directory before running. ```bash cd torchserve ./setup_macos.sh torchserve --start --ts-config config.local.properties --foreground ``` -------------------------------- ### Component Mounting and Initial State Setup Source: https://github.com/facebookresearch/animateddrawings/blob/main/examples/fixer_app/dist/index.html Sets up the initial props, state, context, and calls lifecycle methods like getDerivedStateFromProps and componentDidMount during the mounting phase. ```javascript function lo(e, n, t) { var l = e.stateNode; l.props = t, l.state = e.memoizedState, l.refs = Ja, Ha(e); var a = n.contextType; "object" == typeof a && null !== a ? l.context = Ua(a) : (a = Wl(n) ? Al : Bl.current, l.context = Hl(e, a)), l.state = e.memoizedState, "function" == typeof (a = n.getDerivedStateFromProps) && (Za(e, n, a, t), l.state = e.memoizedState), "function" == typeof n.getDerivedStateFromProps || "function" == typeof l.getSnapshotBeforeUpdate || "function" != typeof l.UNSAFE_componentWillMount && "function" != typeof l.componentWillMount || (n = l.state, "function" == typeof l.componentWillMount && l.componentWillMount(), "function" == typeof l.UNSAFE_componentWillMount && l.UNSAFE_componentWillMount(), n !== l.state && eo.enqueueReplaceState(l, l.state, null), Xa(e, t, l, r), l.state = e.memoizedState), "function" == typeof l.componentDidMount && (e.flags |= 4194308); } ``` -------------------------------- ### Start Rendering with Custom Skeleton Configuration Source: https://context7.com/facebookresearch/animateddrawings/llms.txt Initiates the rendering process using a specified configuration file for custom skeletons like Rokoko/Mixamo BVH. ```python render.start('./examples/config/mvc/rokoko_motion_example.yaml') ``` -------------------------------- ### Render Quadruped Animation Source: https://github.com/facebookresearch/animateddrawings/blob/main/examples/quadruped/README.md Execute the animation rendering process using the specified configuration file. This command starts the video generation. ```python from animated_drawings import render render.start('./examples/config/mvc/four_legs.yaml') ``` -------------------------------- ### MVC Configuration File Example Source: https://context7.com/facebookresearch/animateddrawings/llms.txt The root configuration file passed to `render.start()`. It composes character, motion, and retarget configurations, and overrides defaults from `animated_drawings/mvc_base_cfg.yaml`. Only fields that differ from defaults need to be specified. ```yaml # my_animation.yaml scene: ADD_FLOOR: False # render a floor plane ADD_AD_RETARGET_BVH: False # visualize the driving BVH skeleton ANIMATED_CHARACTERS: - character_cfg: examples/characters/char1/char_cfg.yaml motion_cfg: examples/config/motion/dab.yaml retarget_cfg: examples/config/retarget/fair1_ppf.yaml view: CLEAR_COLOR: [1.0, 1.0, 1.0, 0.0] # RGBA background (transparent white) BACKGROUND_IMAGE: null # optional path to a background image WINDOW_DIMENSIONS: [500, 500] # width × height in pixels DRAW_AD_RIG: False # show skeleton rig overlay DRAW_AD_TXTR: True # show character texture DRAW_AD_COLOR: False # show per-bone color instead of texture DRAW_AD_MESH_LINES: False # show mesh wireframe USE_MESA: False # True for headless/server rendering CAMERA_POS: [0.0, 0.7, 2.0] # x y z camera position CAMERA_FWD: [0.0, 0.5, 2.0] # camera forward vector controller: MODE: video_render # 'interactive' or 'video_render' OUTPUT_VIDEO_PATH: ./video.mp4 # .mp4 or .gif OUTPUT_VIDEO_CODEC: avc1 # required for .mp4 output KEYBOARD_TIMESTEP: 0.0333 # arrow-key scrub step (interactive mode only) ``` -------------------------------- ### Render Scene from YAML Configuration Source: https://context7.com/facebookresearch/animateddrawings/llms.txt Start the rendering process for a scene defined in a YAML configuration file. This is used for scenes with multiple characters or custom view settings. ```python from animated_drawings import render render.start('./multi_char_background.yaml') # Produces: multi_char.gif with two characters dancing over the background ``` -------------------------------- ### React Context Provider and Consumer Setup Source: https://github.com/facebookresearch/animateddrawings/blob/main/examples/fixer_app/dist/index.html Defines a React context object, including its Provider and Consumer components. Used for sharing values between components without prop drilling. ```javascript function d(e){return(e={$$typeof:H,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null}).Provider={$$typeof:A,_context:e},e.Consumer=e} ``` -------------------------------- ### Install Animated Drawings with Conda Source: https://github.com/facebookresearch/animateddrawings/blob/main/README.md Installs the project within a Python virtual environment using Conda. Ensure you have Miniconda installed and follow the steps to create and activate the environment before installing the package. ```bash conda create --name animated_drawings python=3.8.13 conda activate animated_drawings git clone https://github.com/facebookresearch/AnimatedDrawings.git cd AnimatedDrawings pip install -e . ``` -------------------------------- ### render.start() — Launch an animation from a config file Source: https://context7.com/facebookresearch/animateddrawings/llms.txt The sole public Python API function. It accepts the path to an MVC YAML config file, constructs the full scene (characters, motions, view), and starts the render loop. Depending on the controller mode in the config, the result is either an interactive OpenGL window or a video file written to disk. ```APIDOC ## render.start() ### Description Launches an animation from a specified configuration file. This is the primary entry point for users of the library. ### Method Python function call ### Parameters - **config_file_path** (string) - Required - Path to the MVC YAML configuration file. ### Request Example ```python from animated_drawings import render # Interactive window render.start('./examples/config/mvc/interactive_window_example.yaml') # Export MP4 render.start('./examples/config/mvc/export_mp4_example.yaml') # Export transparent GIF render.start('./examples/config/mvc/export_gif_example.yaml') # Headless rendering render.start('./my_configs/headless_render.yaml') ``` ### Response No explicit return value documented. The function initiates a rendering process which may output to a window or a file. ``` -------------------------------- ### Start Interactive Animation Window Source: https://github.com/facebookresearch/animateddrawings/blob/main/README.md Launches an interactive window to view the animation. This requires a Python interpreter and the 'animated_drawings' environment to be active. The animation is controlled by a specified YAML configuration file. ```python from animated_drawings import render render.start('./examples/config/mvc/interactive_window_example.yaml') ``` -------------------------------- ### Multi-Character Scene Configuration Source: https://context7.com/facebookresearch/animateddrawings/llms.txt Configure a scene with multiple characters and a background image using a YAML file. This setup defines character configurations, motion, retargeting, background image, and rendering parameters. ```yaml # multi_char_background.yaml scene: ANIMATED_CHARACTERS: - character_cfg: examples/characters/char1/char_cfg.yaml motion_cfg: examples/config/motion/dab.yaml retarget_cfg: examples/config/retarget/fair1_ppf_duo1.yaml - character_cfg: examples/characters/char2/char_cfg.yaml motion_cfg: examples/config/motion/dab.yaml retarget_cfg: examples/config/retarget/fair1_ppf_duo2.yaml view: BACKGROUND_IMAGE: examples/characters/char4/background.png WINDOW_DIMENSIONS: [300, 400] CAMERA_POS: [0.1, 1.3, 2.7] controller: MODE: video_render OUTPUT_VIDEO_PATH: ./multi_char.gif ``` -------------------------------- ### Launch Animation with render.start() Source: https://context7.com/facebookresearch/animateddrawings/llms.txt The sole public Python API function to launch an animation. It accepts the path to an MVC YAML config file and starts the render loop, producing either an interactive window or a video file. ```python from animated_drawings import render # Interactive window — use spacebar to pause, arrow keys to scrub, q to quit render.start('./examples/config/mvc/interactive_window_example.yaml') # Export MP4 render.start('./examples/config/mvc/export_mp4_example.yaml') # Export transparent GIF render.start('./examples/config/mvc/export_gif_example.yaml') # Headless rendering on a remote server (no display required) # Requires USE_MESA: True in the view section of the config render.start('./my_configs/headless_render.yaml') ``` -------------------------------- ### Generate Animation from Image Locally Source: https://github.com/facebookresearch/animateddrawings/blob/main/README.md Generates an animation from an input image using a locally running TorchServe instance. This command is the same whether using Docker or the local macOS setup. ```bash python image_to_animation.py drawings/garlic.png garlic_out ``` -------------------------------- ### Build Fixer App React Application Source: https://github.com/facebookresearch/animateddrawings/blob/main/examples/fixer_app/README.md Run these commands in the fixer_app directory to install dependencies and build the React app. This process uses Parcel to inline JS and CSS, and shx sed for post-build modifications. ```bash cd fixer_app npm install npm run build ``` -------------------------------- ### Launch Annotation Fixing Interface Source: https://github.com/facebookresearch/animateddrawings/blob/main/README.md Starts a web interface for visualizing and correcting model-predicted annotations (mask and joints) for a character. Navigate to http://127.0.0.1:5050 in your browser to use the tool. Requires the output directory from a previous analysis step. ```bash python fix_annotations.py garlic_out/ ``` -------------------------------- ### Custom Hook for State and Effect Management Source: https://github.com/facebookresearch/animateddrawings/blob/main/examples/fixer_app/dist/index.html An example of a custom hook that likely combines useState, useEffect, or other hooks to encapsulate reusable logic. ```javascript function Wo(e,n){var t=No,r=$o(),l=n(),a=!kr(r.memoizedState,l);if(a&&(r.memoizedState=l,Ru=!0),r=r.queue,ru(Ko.bind(null,t,r,e),[ e ]),r.getSnapshot!==n||a||null!==To&&1&To.memoizedState.tag){if(t.flags|=2048,Jo(9,qo.bind(null,t,r,l,n),void 0,null),null===Ai)throw Error(y(349));0!=(30&Po)||Qo(t,n,l)}return l} ``` -------------------------------- ### Use BVH Files with Different Skeletons Source: https://github.com/facebookresearch/animateddrawings/blob/main/README.md Use any BVH format motion clip. If the BVH's skeleton differs from the project's examples, create a new motion config file and retarget config file. Run from a Python interpreter within the AnimatedDrawings root directory. ```python from animated_drawings import render render.start('./examples/config/mvc/different_bvh_skeleton_example.yaml') ``` -------------------------------- ### Component Instantiation and Initialization Source: https://github.com/facebookresearch/animateddrawings/blob/main/examples/fixer_app/dist/index.html Initializes a React component instance, setting up its state, context, and updater. ```javascript function to(e, n, t) { var r = !1, l = $l, a = n.contextType; return "object" == typeof a && null !== a ? a = Ua(a) : (l = Wl(n) ? Al : Bl.current, a = (r = null != (r = n.contextTypes)) ? Hl(e, l) : $l), n = new n(t, a), e.memoizedState = null !== n.state && void 0 !== n.state ? n.state : null, n.updater = eo, e.stateNode = n, n._reactInternals = e, r && ((e = e.stateNode)._reactInternalMemoizedUnmaskedChildContext = l, e._reactInternalMemoizedMaskedChildContext = a), n.state = e.memoizedState; } ``` -------------------------------- ### Configure Mock Data for Application Source: https://github.com/facebookresearch/animateddrawings/blob/main/examples/fixer_app/index.html Sets up mock data for the application's configuration and image assets. This is useful for testing or development environments where real data is not available. ```javascript window.cfg = window.CFGMOCK; // {{ cfg|tojson }}; window.image = window.IMGMOCK; // {{ image|tojson }}; ``` -------------------------------- ### Basic Component State Initialization Source: https://github.com/facebookresearch/animateddrawings/blob/main/examples/fixer_app/dist/index.html Initializes the state for a component, setting up the initial memoized state and queue for state updates. ```javascript function Bo(e,n){return"function"==typeof n?n(e):n} ``` ```javascript function Ho(){} ``` -------------------------------- ### Configure Character and Motion for Animation Source: https://github.com/facebookresearch/animateddrawings/blob/main/examples/quadruped/README.md Edit the `four_example.yaml` file to set the `character_cfg` to your new animal configuration file. This YAML snippet shows the structure for defining animated characters, their motion, and retargeting configurations. ```yaml scene: ANIMATED_CHARACTERS: - character_cfg: path/to/your/new/animal/config motion_cfg: examples/config/motion/zombie.yaml retarget_cfg: examples/config/retarget/four_legs.yaml controller: MODE: video_render OUTPUT_VIDEO_PATH: ./video.gif ``` -------------------------------- ### Convert Human to Animal Configuration Source: https://github.com/facebookresearch/animateddrawings/blob/main/examples/quadruped/README.md Run this script on the generated `char_cfg.yaml` file to prepare it for animal animation. Ensure the script is in the same directory or its path is specified. ```python python human_to_animal path/to/your/yaml ``` -------------------------------- ### Build and Run TorchServe Docker Container Source: https://github.com/facebookresearch/animateddrawings/blob/main/README.md Builds the Docker image for TorchServe and then runs it as a detached container, exposing necessary ports. Ensure Docker Desktop is running and has sufficient RAM allocated. ```bash cd torchserve docker build -t docker_torchserve . docker run -d --name docker_torchserve -p 8080:8080 -p 8081:8081 docker_torchserve ``` -------------------------------- ### Main Application Rendering Source: https://github.com/facebookresearch/animateddrawings/blob/main/examples/fixer_app/dist/index.html Renders the main application UI, including an image, interactive skeleton points and lines, and a form for submitting annotations. This is the entry point for the React application. ```javascript o(document.getElementById("app")).render((0,u.jsx)((function(){const e=window.cfg,t=window.image.data,r=e.height,l=e.width,a=e.skeleton,[o,i]=n(s).useState((()=>JSON.parse(JSON.stringify(a)))),[d,p]=n(s).useState(null),[m,h]=n(s).useState(!1);return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsxs)("div",{style:{position:"relative",height:r},children:[(0,u.jsx)("div",{style:{position:"absolute"},children:(0,u.jsx)("img",{src:"data:image/png;base64,"+t,style:{height:r,width:l}})}),(0,u.jsxs)("div",{style:{position:"absolute"},children:[(0,u.jsxs)("svg",{style:{width:l,height:r},viewBox: `0 0 ${l} ${r}`, xmlns:"http://www.w3.org/2000/svg",children:[ o.map((e=>{if(!e.parent)return;let n=o.find((n=>n.name===e.name));return(0,u.jsx)(f,{x1:e.loc[0],y1:e.loc[1],x2:n.loc[0],y2:n.loc[1],isActive:m&&[e.name,e.parent].indexOf(d)>=0},`${e.name}-${e.parent}`)}))),o.map((e=>(0,u.jsx)(c,{cx:e.loc[0],cy:e.loc[1],xBounds:[0,l],yBounds:[0,r],onPositionUpdate:n=>{const t=[n.x,n.y],r=o.map((n=>n.name!==e.name?n:{...n,loc:t}));i(r),h(n.active)},onHover:n=>{p(n?e.name:null)},strokeWidth:"2",stroke:"white",r:"4"},e.name)))])}),d?(0,u.jsx)("div",{className:"tooltip",children:d?.replace("l_","left ")?.replace("r_","right ")}):null]})]}),(0,u.jsxs)("form",{method:"POST",action:"/annotations/submit",children:[(0,u.jsx)("input",{hidden:!0,type:"text",value:JSON.stringify({...e,skeleton:o}),id:"data",name:"data"}),(0,u.jsx)("button",{type:"submit",children:"Submit"})]})]}),{})); ``` -------------------------------- ### Docker TorchServe for Auto-Annotation Source: https://context7.com/facebookresearch/animateddrawings/llms.txt This workflow demonstrates how to use a TorchServe Docker container for auto-annotating a drawing. It includes building and running the container, verifying its health, and performing an end-to-end animation process. ```bash # 1. Build and start the TorchServe Docker container cd torchserve docker build -t docker_torchserve . docker run -d --name docker_torchserve -p 8080:8080 -p 8081:8081 docker_torchserve # 2. Verify the server is healthy curl http://localhost:8080/ping # Expected response: # { "status": "Healthy" } # 3. Animate a drawing end-to-end (image → annotation → video) cd ../examples python image_to_animation.py drawings/garlic.png garlic_out # Produces: garlic_out/video.gif # garlic_out/mask.png # garlic_out/texture.png # garlic_out/char_cfg.yaml # 4. (Optional) Correct bad joint predictions via browser UI python fix_annotations.py garlic_out/ # Navigate to http://127.0.0.1:5050, drag joints, click Submit # 5. Re-render after fixing annotations python annotations_to_animation.py garlic_out # Output: garlic_out/video.gif ``` -------------------------------- ### MVC Configuration File Structure Source: https://context7.com/facebookresearch/animateddrawings/llms.txt The MVC config is the root configuration file passed to `render.start()`. It composes character, motion, and retargeting configurations into a full scene. Only fields that differ from defaults need to be specified. ```APIDOC ## MVC Configuration File ### Description Top-level scene composition file that defines characters, motions, and view settings for the animation. ### Structure ```yaml # my_animation.yaml scene: ADD_FLOOR: False ADD_AD_RETARGET_BVH: False ANIMATED_CHARACTERS: - character_cfg: motion_cfg: retarget_cfg: view: CLEAR_COLOR: [1.0, 1.0, 1.0, 0.0] BACKGROUND_IMAGE: null WINDOW_DIMENSIONS: [500, 500] DRAW_AD_RIG: False DRAW_AD_TXTR: True DRAW_AD_COLOR: False DRAW_AD_MESH_LINES: False USE_MESA: False CAMERA_POS: [0.0, 0.7, 2.0] CAMERA_FWD: [0.0, 0.5, 2.0] controller: MODE: video_render OUTPUT_VIDEO_PATH: ./video.mp4 OUTPUT_VIDEO_CODEC: avc1 KEYBOARD_TIMESTEP: 0.0333 ``` ### Parameters #### Scene Parameters - **ADD_FLOOR** (boolean) - Optional - Whether to render a floor plane. - **ADD_AD_RETARGET_BVH** (boolean) - Optional - Whether to visualize the driving BVH skeleton. - **ANIMATED_CHARACTERS** (list of objects) - Required - Defines the characters in the scene, each with its own configuration for character, motion, and retargeting. - **character_cfg** (string) - Required - Path to the character configuration file. - **motion_cfg** (string) - Required - Path to the motion configuration file. - **retarget_cfg** (string) - Required - Path to the retargeting configuration file. #### View Parameters - **CLEAR_COLOR** (list of floats) - Optional - RGBA background color. - **BACKGROUND_IMAGE** (string or null) - Optional - Path to a background image. - **WINDOW_DIMENSIONS** (list of integers) - Optional - Width and height of the window in pixels. - **DRAW_AD_RIG** (boolean) - Optional - Whether to show the skeleton rig overlay. - **DRAW_AD_TXTR** (boolean) - Optional - Whether to show the character texture. - **DRAW_AD_COLOR** (boolean) - Optional - Whether to show per-bone color instead of texture. - **DRAW_AD_MESH_LINES** (boolean) - Optional - Whether to show mesh wireframe. - **USE_MESA** (boolean) - Optional - Set to True for headless/server rendering. - **CAMERA_POS** (list of floats) - Optional - x, y, z camera position. - **CAMERA_FWD** (list of floats) - Optional - Camera forward vector. #### Controller Parameters - **MODE** (string) - Optional - Rendering mode: 'interactive' or 'video_render'. - **OUTPUT_VIDEO_PATH** (string) - Optional - Path for the output video file (.mp4 or .gif). - **OUTPUT_VIDEO_CODEC** (string) - Optional - Video codec, required for .mp4 output. - **KEYBOARD_TIMESTEP** (float) - Optional - Step for scrubbing with arrow keys in interactive mode. ``` -------------------------------- ### Download Amateur Drawings Dataset Annotations Source: https://github.com/facebookresearch/animateddrawings/blob/main/README.md Use wget to download the annotation file for the Amateur Drawings Dataset. This file is approximately 275MB. ```bash # download annotations (~275Mb) wget https://dl.fbaipublicfiles.com/amateur_drawings/amateur_drawings_annotations.json ``` -------------------------------- ### Download Amateur Drawings Dataset Images Source: https://github.com/facebookresearch/animateddrawings/blob/main/README.md Use wget to download the image archive for the Amateur Drawings Dataset. This archive is approximately 50GB. ```bash # download images (~50Gb) wget https://dl.fbaipublicfiles.com/amateur_drawings/amateur_drawings.tar ``` -------------------------------- ### Generate Annotation from Image Source: https://github.com/facebookresearch/animateddrawings/blob/main/examples/quadruped/README.md Use this command to generate an annotation file from your drawing. Specify the input file path. ```bash python image_to_animation.py path/to/your/file ``` -------------------------------- ### React Element Creation Utilities Source: https://github.com/facebookresearch/animateddrawings/blob/main/examples/fixer_app/dist/index.html Provides utility functions for creating and manipulating React elements, including handling different element types and reconciliation. ```javascript function l(e, n) { return (e = qs(e, n)).index = 0, e.sibling = null, e; } ``` ```javascript function a(n, t, r) { return n.index = r, e && null !== (r = n.alternate) ? (r = r.index) < t ? (n.flags |= 2, t) : r : (n.flags |= 1048576, t); } ``` ```javascript function o(n) { return e && null === n.alternate && (n.flags |= 2), n; } ``` ```javascript function u(e, n, t, r) { return null === n || 6 !== n.tag ? ((n = Gs(t, e.mode, r)).return = e, n) : ((n = l(n, t)).return = e, n); } ``` ```javascript function i(e, n, t, r) { var a = t.type; return a === D ? c(e, n, t.props.children, r, t.key) : null !== n && (n.elementType === a || "object" == typeof a && null !== a && a.$$typeof === W && uo(a) === n.type) ? ((r = l(n, t.props)).ref = ao(e, n, t), r.return = e, r) : ((r = Ks(t.type, t.key, t.props, null, e.mode, r)).ref = ao(e, n, t), r.return = e, r); } ``` ```javascript function s(e, n, t, r) { return null === n || 4 !== n.tag || n.stateNode.containerInfo !== t.containerInfo || n.stateNode.implementation !== t.implementation ? ((n = Js(t, e.mode, r)).return = e, n) : ((n = l(n, t.children || [])).return = e, n); } ``` ```javascript function c(e, n, t, r, a) { return null === n || 7 !== n.tag ? ((n = Ys(t, e.mode, r, a)).return = e, n) : ((n = l(n, t)).return = e, n); } ``` ```javascript function f(e, n, t) { if ("string" == typeof n && "" !== n || "number" == typeof n) return (n = Gs("" + n, e.mode, t)).return = e, n; if ("object" == typeof n && null !== n) { switch (n.$$typeof) { case O: return (t = Ks(n.type, n.key, n.props, null, e.mode, t)).ref = ao(e, null, n), t.return = e, t; case F: return (n = Js(n, e.mode, t)).return = e, n; case W: return f(e, (0, n._init)(n._payload), t); } if (me(n) || K(n)) return (n = Ys(n, e.mode, t, null)).return = e, n; oo(e, n); } return null; } ``` ```javascript function d(e, n, t, r) { var l = null !== n ? n.key : null; if ("string" == typeof t && "" !== t || "number" == typeof t) return null !== l ? null : u(e, n, "" + t, r); if ("object" == typeof t && null !== t) { swi } } ``` -------------------------------- ### Handling Component Lifecycle Methods (Pre-Mount) Source: https://github.com/facebookresearch/animateddrawings/blob/main/examples/fixer_app/dist/index.html Calls legacy lifecycle methods like componentWillReceiveProps before the initial render. This is part of the older React lifecycle. ```javascript function ro(e, n, t, r) { e = n.state; "function" == typeof n.componentWillReceiveProps && n.componentWillReceiveProps(t, r), "function" == typeof n.UNSAFE_componentWillReceiveProps && n.UNSAFE_componentWillReceiveProps(t, r), n.state !== e && eo.enqueueReplaceState(n, n.state, null); } ``` -------------------------------- ### Generate Animation from Image using Docker Source: https://github.com/facebookresearch/animateddrawings/blob/main/README.md Converts an input image into an animated GIF using the TorchServe Docker container. The script analyzes the image, detects and rigs the character, and applies motion data. The output animation is saved as 'video.gif' in the specified output directory. ```bash cd ../examples python image_to_animation.py drawings/garlic.png garlic_out ``` -------------------------------- ### Fix Annotations Mock Configuration Source: https://github.com/facebookresearch/animateddrawings/blob/main/examples/fixer_app/index.html This snippet shows a mock configuration for fixing annotations, including window dimensions and skeleton data. It's used for setting up the annotation process. ```javascript @import "./styles.css"; // MOCK: // window.cfg = {"height": 392, "skeleton": [{"loc": [166, 248], "name": "root", "parent": null}, {"loc": [166, 248], "name": "hip", "parent": "root"}, {"loc": [166, 133], "name": "torso", "parent": "hip"}, {"loc": [169, 51], "name": "neck", "parent": "torso"}, {"loc": [134, 133], "name": "right_shoulder", "parent": "torso"}, {"loc": [82, 142], "name": "right_elbow", "parent": "right_shoulder"}, {"loc": [21, 150], "name": "right_hand", "parent": "right_elbow"}, {"loc": [199, 133], "name": "left_shoulder", "parent": "torso"}, {"loc": [255, 137], "name": "left_elbow", "parent": "left_shoulder"}, {"loc": [316, 146], "name": "left_hand", "parent": "left_elbow"}, {"loc": [143, 250], "name": "right_hip", "parent": "root"}, {"loc": [147, 320], "name": "right_knee", "parent": "right_hip"}, {"loc": [147, 380], "name": "right_foot", "parent": "right_knee"}, {"loc": [190, 246], "name": "left_hip", "parent": "root"}, {"loc": [195, 320], "name": "left_knee", "parent": "left_hip"}, {"loc": [199, 380], "name": "left_foot", "parent": "left_knee"}], "width": 333}; // window.image = {"data": "iVBORw0KGgoAAAANSUhEUgAAAU0AAAGICAYAAADF1bLDAAAgAElEQVR4AczBiZNd52Hm59/7nXP323ujARA7mgDFRRQVbYntSSV2yhV7UlM18f+ZVMoZz5iCKMsWSXm0Udw3kMRCrL3fvus53/cGB0xLqsOG3QTB8TyP/uGnr5qvQBKHsU3FNhVJfBWSqEjCNkchiW+aJOok8bhsI4mKJB7FNoeRREUSlRACtjlgm0qMkbIsKYqC6XTKZDxmbzBgMpmyvz9kMi6YzUqmkxmzWUFKJoQMhUiMJVmW0e/36fd7nDlzln6/R6/Xo93u0GjkxDQFzB+TxFGEELBNxTYVSdjGNpIAIYFtDtjmMDFGJCEJ29gmlqLilDBgmz8miQOSkIRtbHOYEAJ1tpFERRIVSRyQxL/ENhXb/DFJPCQhvmCbim1CCFRsc0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/w1pvvM9gbsrZ2grNnzzE336fVbLGyvEC310USkCjKgrIoKcsZKSWKWcFwtM9gsEOl2+nR7/dBIs8aZCFnf3+fnd1dbtz4nLfeeIOiKFhcXKTX6+GUmBUF3W6H9fV1nnvueZZXlgjNgELANiklJHEYSRyFbSqSqEiiKAoqxmAecsqoSOIhAQbb2MY2tjkgiYokJIGNAZsHTEoJA7bBxjZZllHJsowQAiZRllPsxO7uHhsb97l79z43btwCi/FoTEyJM2fOcHH9HCeOrzE3P48k8jxHEhXbmC+IP7BNJYTAUdjGNgck8cds81VI4jC2qdjmUSRxFE7icdmmYpuKbSTxRCmhKy+/amQgAaYiiUoIAUlUJPHfiiSOIoTA12Wb ``` -------------------------------- ### useEffect Hook with Dependencies Source: https://github.com/facebookresearch/animateddrawings/blob/main/examples/fixer_app/dist/index.html Demonstrates the useEffect hook for handling side effects. It allows specifying dependencies to control when the effect should re-run. ```javascript function eu(e,n,t,r){var l=jo();No.flags|=e,l.memoizedState=Jo(1|n,t,void 0,void 0===r?null:r)} ``` ```javascript function nu(e,n,t,r){var l=$o();r=void 0===r?null:r;var a=void 0;if(null!==zo){var o=zo.memoizedState;if(a=o.destroy,null!==r&&Do(r,o.deps))return void(l.memoizedState=Jo(n,t,a,r))}No.flags|=e,l.memoizedState=Jo(1|n,t,a,r)} ``` ```javascript function ru(e,n){return nu(2048,8,e,n)} ``` ```javascript function lu(e,n){return nu(4,2,e,n)} ``` ```javascript function au(e,n){return nu(4,4,e,n)} ``` -------------------------------- ### Render Animation from Fixed Annotations Source: https://github.com/facebookresearch/animateddrawings/blob/main/README.md Creates an animation using corrected annotation files. This command should be run after modifying annotations using the `fix_annotations.py` script. Specify the directory containing the updated annotation files. ```bash python annotations_to_animation.py garlic_out ```