Objective:
There will be a JSON input file containing shapes, animations list. The goal is to read through these JSON data and provide the appropriate animation video processed through either Manim or MoviePy
The sample JSON data will look like this:
sceneData = {
frameData: {
type: "color",
fill: "green",
},
animationObjectsList: [
{
uid: "f3",
type: "text",
opacity: 0,
x: 30,
y: 570,
text: "This is how the text will appear over an image. The image here can be related to news",
fontSize: 14,
fontFamily: "Source Sans 3",
fontStyle: "600",
fill: "white",
width: 300,
padding: 20,
align: "center",
shadowBlur: 10, // Set the shadow blur radius
shadowOffsetX: 5, // Set the shadow horizontal offset
shadowOffsetY: 5, // Set the shadow vertical offset
},
{
uid: "f2",
type: "rectangle",
x: 280,
y: 20,
width: 50,
height: 50,
fill: "#472296",
},
{
uid: "f2",
type: "rectangle",
x: 280,
y: 20,
width: 50,
height: 50,
fill: "#472296",
},
{
"uid": "f4",
"type": "circle",
"x": 102,
"y": 147,
"radius": 70,
"fill": "#e6e6e6",
"stroke": "#1e1e1e",
"strokeWidth": 4,
"draggable": true,
"rotation": 0,
"scaleX": 1,
"scaleY": 1,
"offsetX": 0,
"offsetY": 0,
"skewX": 0,
"opacity": 1,
"skewY": 0
}
{
"uid": "f5",
"type": "line",
"rotation": 0,
"points": [
10,
20,
50,
60
],
"stroke": "#1e1e1e",
"strokeWidth": 10,
"draggable": true,
"opacity": 1,
"x": 160,
"y": 343,
"scaleX": 1,
"scaleY": 1,
"offsetX": 0,
"offsetY": 0,
"skewX": 0,
"skewY": 0
}
],
animations: {
f3: {
name: "Fade In Vertical",
on: "f3",
uid: "f3",
duration: 1,
key: "fade_in_vertical",
initialData: {
y: 570,
opacity: 0,
},
toData: {
y: 550,
opacity: 1,
},
},
},
mode: "animation",
backgroundAnimations: {
name: "scale-up",
},
};
The frameData
defines the layout and appearance of each video frame. The color
property within frameData
sets the background color for the frame. Note that the video resolution should be 1080 x 1920
pixels, matching the dimensions of an Instagram Reel.
The animationObjectsList
contains all visual elements that should appear in each video frame.
The animations
object holds a set of animations. Each key within animations
represents a unique identifier (uid
) for an element within animationObjectsList
.
For example, in the animations
object, the key f3
indicates that the animation will apply to the f3
object listed in animationObjectsList
. The transformation defined moves the f3
element from the initialData
position to the finalData
position. In this case, f3
(a text element) will animate by shifting vertically from a y-position of 570px to 550px, moving upwards. Simultaneously, its opacity will increase, creating a “fade up” effect.
The shapes should take the properties(color, background, width) mentioned in the JSON file. For each shape in the AnimationObjectsList, it should have the correct properties.
The duration of the animations
object is also worth noticing. The animation should be of that duration only.
The goal is to process the JSON file and output the video file with animations as mentioned in the JSON file.