[PYTHON] Manim's method 2

Overview

I checked manim's method. I tried using SVGMobject.

I wrote svg with 9vae.

image.png

Made svg

Only the d attribute of path is used.

<?xml version="1.0" encoding="utf-8"?>
<!-- Generator:9va-0.7.7 (9va-win) http://9vae.blogspot.jp/ -->
<svg xmlns:xlink="http://www.w3.org/1999/xlink" image-rendering="optimizeSpeed" baseProfile="basic" version="1.1"  xmlns="http://www.w3.org/2000/svg"
  id="03.svg" viewBox="0 0 512 288" >
  <defs>
  <mask id="SVG_Canvas"><rect fill="#FFFFFF" x="0" y="0" width="512" height="288"></rect></mask>
  </defs>
  <g id="SVG_Still" mask="url(#SVG_Canvas)">
    <path fill="#80ffff" stroke="#000000" stroke-width="1.00" d="M55.00,46.00C62.13,46.00 74.13,46.00 88.50,46.00 C102.81,46.00 114.81,46.00 122.00,46.00C122.00,51.63 122.00,61.13 122.00,72.50 C122.00,83.81 122.00,93.31 122.00,99.00C114.81,99.00 102.81,99.00 88.50,99.00 C74.13,99.00 62.13,99.00 55.00,99.00C55.00,93.31 55.00,83.81 55.00,72.50 C55.00,61.13 55.00,51.63 55.00,46.00Z"></path>
    <path fill="none" stroke="#000000" stroke-width="1.00" d="M169.00,36.00C175.81,36.00 187.25,36.00 201.00,36.00 C214.69,36.00 226.13,36.00 233.00,36.00C233.00,44.13 233.00,57.69 233.00,74.00 C233.00,90.25 233.00,103.81 233.00,112.00C226.13,112.00 214.69,112.00 201.00,112.00 C187.25,112.00 175.81,112.00 169.00,112.00C169.00,103.81 169.00,90.25 169.00,74.00 C169.00,57.69 169.00,44.13 169.00,36.00Z"></path>
    <path fill="#80ffff" stroke="#000000" stroke-width="1.00" d="M59.00,126.00 C66.00,125.75 71.75,128.19 76.63,133.38 C81.75,138.19 84.19,143.94 84.00,151.00 C84.19,158.00 81.75,163.75 76.63,168.63 C71.75,173.75 66.00,176.19 59.00,176.00 C51.94,176.19 46.19,173.75 41.38,168.63 C36.19,163.75 33.75,158.00 34.00,151.00 C33.75,143.94 36.19,138.19 41.38,133.38 C46.19,128.19 51.94,125.75 59.00,126.00 Z"></path>
    <path fill="none" stroke="#000000" stroke-width="1.00" d="M134.00,100.00 C140.13,99.69 145.25,103.06 149.50,110.31 C154.00,117.06 156.13,125.13 156.00,135.00 C156.13,144.81 154.00,152.88 149.50,159.69 C145.25,166.88 140.13,170.25 134.00,170.00 C127.81,170.25 122.75,166.88 118.50,159.69 C113.94,152.88 111.81,144.81 112.00,135.00 C111.81,125.13 113.94,117.06 118.50,110.31 C122.75,103.06 127.81,99.69 134.00,100.00 Z"></path>
    <path fill="#80ffff" stroke="#000000" stroke-width="1.00" d="M318.00,71.00C316.38,66.13 313.69,58.81 310.00,54.00 C306.19,50.63 302.69,50.88 300.00,54.00 C297.56,55.81 296.81,59.56 297.00,67.00 C295.88,74.88 295.75,83.75 299.00,93.00 C302.19,102.00 307.38,108.13 316.00,112.00 C325.13,116.19 334.50,116.63 343.00,114.00 C350.56,113.88 354.31,111.56 357.00,101.00 C361.75,86.06 364.13,67.19 361.00,54.00 C356.38,44.25 347.69,43.88 338.00,49.00 C329.00,54.56 322.06,64.31 318.00,71.00Z"></path>
    <path fill="none" stroke="#000000" stroke-width="1.00" d="M429.00,76.00 C416.69,74.13 406.81,64.19 401.00,57.00C398.50,64.56 396.25,77.00 403.00,91.00 C415.56,104.38 433.81,114.81 446.00,121.00L465.00,57.00 L459.00,51.00 C452.38,59.50 441.56,71.56 429.00,76.00 Z"></path>
    <path fill="#80ffff" stroke="#000000" stroke-width="1.00" d="M48.00,196.00L48.00,249.00 100.00,242.00 48.00,196.00 Z"></path>
    <path fill="none" stroke="#000000" stroke-width="1.00" d="M158.00,193.00L155.00,249.00 208.00,248.00 158.00,193.00 Z"></path>
  <text fill="#000000" text-anchor="middle" font-family="sans-serif" x="304.0000" y="179.4000" font-size="21">
A</text>
  </g>
<!-- SourceCode:9va-0.7.7 (9va-win) --><!--
IwZFVkEtUyBWAgEAagFJBAIAASBCBAABAQBaBAH///9PIQRDOlxVc2Vyc1x6ZW9uXERvY3VtZW50c1wwMy5zdmcjAE8AUABkTAgAAANwAuAFiALgB6AC4AegBIgHoAYwBYgGMANwBjADcASIdxB04mQAWID//wD//wAAAAAAACQDCAAAJAUGAAAAAEMBVUUATAgAAAqQAkAMkAJADpACQA6QBKAOkAcADJAHAAqQBwAKkASgdAJYgP//////AP8AAAAATAgAAAOwB+AEyghWBUAJcATKCooDsAsAApYKigIgCXAClghWdOJYgP//AP//AAAAAAAAQwH/TAgAAAhgBkAJWAblCcAIcAlYCfsIYAqgB2gJ+wcACHAHaAbldAJYgP//////AP8AAAAATAoAABPgBHATYANgEsADYBKQBDASsAXQE8AHABVwByAWUAZQFpADYBUgAxB04liA//8A//8AAAAAAABDAn/ARQBMBgAAGtAEwBkQA5AZMAWwG+AHkB0QA5AcsAMwdAJYgP//////AP8AAAAAQwGgRQBMAwAAAwAMQAMAD5AGQA8gdOJYgP//AP//AAAAAAAAQwBFAEwDAAAJ4AwQCbAPkA0AD4B0AliA//////8A/wAAAABUCwAAEpgKCBNoC1hBYQBmAG8AZABYgP//AP//AAAAAAAASA0AAAAVAA0AAAAAEAAAZQBKAYAkBQCAgIAAJAUBAAAAAP//
-->
</svg>

Sample code

from manimlib.imports import *

class test(Scene):
	def construct(self):
		c = SVGMobject(file_name="03.svg")
		self.add(c)
		self.wait()

result

image.png

that's all.

Recommended Posts

Manim's method 7
Manim's method 13
Manim's method 2
Manim's method 18
Manim's method 17
Manim's method 5
Manim's method 3
Manim's method 15
Manim's method 11
Manim's method 16
Manim's method 20
Manim's method 10
Manim's method 9
Manim's method 6
Manim's method 21
Manim's method 4
Manim's method 8
Manim's method 14
Manim's method 22
Manim's method 19
Manim's method 12
Manim's method part 23
manim's manners
Binary method
Special method
Special method
Understand k-means method
Clustering of clustering method
Dictionary items method
[PyTorch] Installation method
N cross method
Image collection method
Regression analysis method
Gradient method implementation 1
Python-peewee connection method
Class method static method
youtube-dl update method
Monte Carlo method
Mode-Matching Method Simulation_Python
Johnson method (python)
[Python] Semi-Lagrange method