PiCreature scenes shouldn't break, though specific designs are still out of the public repo

This commit is contained in:
Grant Sanderson 2017-05-08 08:32:56 -07:00
parent 2c121a0ba7
commit 012a9579c5
3 changed files with 71 additions and 6 deletions

View file

@ -39,3 +39,36 @@ Try running the following:
python extract_scene.py -p example_scenes.py SquareToCircle
-p gives a preview of an animation, -w will write it to a file, and -s will show/save the final image in the animation.
Look through the old_projects folder to see the code for previous 3b1b videos.
While developing a scene, the -s flag is helpful to just see what things look like at the end without having to generate the full animation. It can also be helpful to put self.force_skipping() at the top of the construct method, and self.revert_to_original_skipping_status() before the portion of the scene that you want to test, and run with the -p flag to just see a preview of one part of the scene.
Scene with PiCreatures are somewhat 3b1b specific, so the specific designs for various expressions are not part of the public repo. You should still be able to run them, but they will fall back on using the "plain" expression for the creature.

View file

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 21.0.2, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 480 480" style="enable-background:new 0 0 480 480;" xml:space="preserve">
<style type="text/css">
.st0{fill:#FFFFFF;}
.st1{fill:#0C7F99;}
</style>
<path class="st0" d="M251.6,114.7c0,4.2-1.4,8.2-3.7,11.3l-30.4,0.3c-2.6-3.1-4-7.3-4-11.6c0-10.5,8.5-19,19-19
C243.1,95.6,251.6,104.2,251.6,114.7z"/>
<path class="st0" d="M306.6,114.7c0,4.2-1.4,8.2-3.7,11.3l-30.4,0.3c-2.6-3.1-4-7.3-4-11.6c0-10.5,8.5-19,19-19
C298.1,95.6,306.6,104.2,306.6,114.7z"/>
<path d="M238,99.8c-1.3,0.1-2.3,1.1-2.3,2.4c0,1.3,1.1,2.4,2.4,2.4c1.3,0,2.4-1.1,2.4-2.4c0-1.3-1.1-2.4-2.4-2.4
C238.1,99.8,238,99.8,238,99.8l2.9-1c4.3,0,7.7,3.5,7.7,7.7s-3.5,7.7-7.7,7.7s-7.7-3.5-7.7-7.7s3.5-7.7,7.7-7.7"/>
<path d="M293,99.8c-1.3,0.1-2.3,1.1-2.3,2.4c0,1.3,1.1,2.4,2.4,2.4s2.4-1.1,2.4-2.4c0-1.3-1.1-2.4-2.4-2.4
C293.1,99.8,293,99.8,293,99.8l2.9-1c4.3,0,7.7,3.5,7.7,7.7s-3.5,7.7-7.7,7.7s-7.7-3.5-7.7-7.7s3.5-7.7,7.7-7.7"/>
<path class="st1" d="M228.4,157.1h64.4c-15.4,63.8-25.1,105.4-25.1,151c0,8,0,69.5,23.4,69.5c12,0,22.2-10.8,22.2-20.5
c0-2.8,0-4-4-12.5c-15.4-39.3-15.4-88.3-15.4-92.3c0-3.4,0-43.9,12-95.1h63.8c7.4,0,26.2,0,26.2-18.2c0-12.5-10.8-12.5-21.1-12.5
H187.4c-13.1,0-32.5,0-58.7,27.9c-14.8,16.5-33,46.7-33,50.1s2.8,4.6,6.3,4.6c4,0,4.6-1.7,7.4-5.1c29.6-46.7,59.2-46.7,73.5-46.7
h32.5c-12.5,42.7-26.8,92.3-73.5,192c-4.6,9.1-4.6,10.3-4.6,13.7c0,12,10.3,14.8,15.4,14.8c16.5,0,21.1-14.8,27.9-38.7
c9.1-29.1,9.1-30.2,14.8-53L228.4,157.1"/>
<path d="M246.3,149.1c5.5,0,1.9,0.1,13.5,0c10.3-0.1,12.4-0.1,15.7-0.2c0,0-0.3-3.1-0.3-3.1c-3.7,0.1-9.3,0.2-14.7,0.2
c-3.9,0-8.5,0-14.6,0"/>
</svg>

After

Width:  |  Height:  |  Size: 1.8 KiB

View file

@ -39,12 +39,20 @@ class PiCreature(SVGMobject):
}
def __init__(self, mode = "plain", **kwargs):
self.parts_named = False
try:
svg_file = os.path.join(
PI_CREATURE_DIR,
"PiCreatures_%s.svg"%mode
)
digest_config(self, kwargs, locals())
SVGMobject.__init__(self, file_name = svg_file, **kwargs)
except:
warnings.warn("No PiCreature design with mode %s"%mode)
svg_file = os.path.join(
PI_CREATURE_DIR,
"PiCreatures_plain.svg"
)
SVGMobject.__init__(self, file_name = svg_file, **kwargs)
if self.flip_at_start:
self.flip()
if self.start_corner is not None: