Skip to content

Commit

Permalink
delete EmergentScene
Browse files Browse the repository at this point in the history
  • Loading branch information
AhmmedHesham authored Apr 26, 2024
1 parent d5f755e commit 8e23ebd
Showing 1 changed file with 0 additions and 76 deletions.
76 changes: 0 additions & 76 deletions src/notebook/processism_OOP.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -12,82 +12,6 @@
"from AnimationManger import * "
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%%manim -ql --fps 30 -v WARNING EmergentScene\n",
"\n",
"DEFAULT_COLOR = BLUE\n",
"DEFAULT_BUFF = 0.3\n",
"\n",
"class CircleCluster(VGroup):\n",
" def __init__(self, positions, color=DEFAULT_COLOR, scaler=0.25):\n",
" super().__init__()\n",
" self.circles = [Circle(color=color, fill_opacity=1).scale(scaler).move_to(pos) for pos in positions]\n",
" self.add(*self.circles)\n",
"\n",
" def connect_circles(self, arrow_configs, buff=DEFAULT_BUFF, color=DEFAULT_COLOR):\n",
" self.arrows = [DoubleArrow(self.circles[i].get_center(), self.circles[j].get_center(), buff=buff, color=color, **config)\n",
" for (i, j, config) in arrow_configs]\n",
" self.add(*self.arrows)\n",
"\n",
" def animate_connections(self, scene, fade_in=True):\n",
" animation = FadeIn if fade_in else FadeOut\n",
" for arrow in self.arrows:\n",
" scene.play(animation(arrow))\n",
"\n",
" def label_circles(self, labels, configs=None):\n",
" if configs is None:\n",
" configs = [{} for _ in labels]\n",
" self.labels = [Text(label, color=BLACK, **config).scale(textScale).next_to(self.circles[i], UP)\n",
" for i, (label, config) in enumerate(zip(labels, configs))]\n",
" self.add(*self.labels)\n",
"\n",
" def animate_labels(self, scene, fade_in=True):\n",
" animation = FadeIn if fade_in else FadeOut\n",
" for label in self.labels:\n",
" scene.play(animation(label))\n",
"\n",
"class EmergentScene(ThreeDScene):\n",
" def construct(self):\n",
" cluster_positions = [\n",
" 1.5 * LEFT + 2 * UP,\n",
" 1.5 * RIGHT + 2 * UP,\n",
" 1.5 * RIGHT + 1 * DOWN, \n",
" 1.5 * LEFT + 1 * DOWN]\n",
" connections = [\n",
" (0, 1, {}),\n",
" (0, 3, {}),\n",
" (1, 2, {}),\n",
" (2, 3, {}),\n",
" (3, 1, {}),\n",
" (2, 0, {})\n",
" ]\n",
"\n",
" \n",
"\n",
" labels = [\"Entity 1\", \"Entity 2\", \"Entity 3\", \"Entity 4\"]\n",
" self.animate( labels, cluster_positions, connections)\n",
"\n",
" def animate(self, labels, cluster_positions, connections): \n",
" cluster = CircleCluster(cluster_positions)\n",
" cluster.label_circles(labels)\n",
" cluster.connect_circles(connections)\n",
" self.play(FadeIn(cluster.circles[0]))\n",
" self.play(FadeIn(cluster.labels[0]))\n",
" self.wait(1)\n",
" self.play(FadeOut(cluster.labels[0]))\n",
" self.play(FadeIn(cluster.circles[1]))\n",
" self.play(FadeIn(cluster.arrows[0]))\n",
" self.play(FadeIn(cluster.circles[2]), FadeIn(cluster.circles[3]))\n",
" self.play(FadeIn(cluster.arrows[1]), FadeIn(cluster.arrows[2]), FadeIn(cluster.arrows[3]), FadeIn(cluster.arrows[4]), FadeIn(cluster.arrows[5]))\n",
" \n",
" "
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down

0 comments on commit 8e23ebd

Please # to comment.