1505 Commits

Author SHA1 Message Date
TonyCrane
9d7db7aacd release: ready to release v1.6.0 2022-04-07 11:00:43 +08:00
TonyCrane
e8430b38b2 docs: update changelog for #1781 2022-04-07 10:57:21 +08:00
鹤翔万里
1f32a9e674 Some fix (#1781)
* fix: reduce warning from numpy

* fix: fix ControlsExample
2022-04-07 10:50:18 +08:00
TonyCrane
d31f3df5af docs: update changelog for #1779 #1780 2022-04-07 10:05:04 +08:00
鹤翔万里
e9bf13882e Merge pull request #1780 from YishiMichael/master
Add support for `substring` and `case_sensitive` parameters
2022-04-07 09:58:39 +08:00
YishiMichael
3550108ff7 Handle out-of-bound spans 2022-04-07 09:48:44 +08:00
YishiMichael
557707ea75 Support substring and case_sensitive parameters 2022-04-07 00:46:41 +08:00
Grant Sanderson
13c731e166 Merge pull request #1779 from YishiMichael/master
Refactor `LabelledString` and relevant classes
2022-04-06 08:53:23 -07:00
YishiMichael
d349c9283d Merge branch 'master' of https://github.com/YishiMichael/manim 2022-04-06 23:17:19 +08:00
YishiMichael
18963fb9fe Some refactors on LabelledString 2022-04-06 23:16:59 +08:00
YishiMichael
a69c9887f9 Merge branch '3b1b:master' into master 2022-04-06 22:39:26 +08:00
YishiMichael
93f8d3f1ca Some refactors on LabelledString 2022-04-06 22:38:33 +08:00
TonyCrane
e4ccbdfba9 docs: update changelog since v1.5.0 2022-04-06 11:14:45 +08:00
YishiMichael
fc97bfb647 Merge branch '3b1b:master' into master 2022-04-05 22:28:39 +08:00
YishiMichael
f9d8a76767 Remove unnecessary raise statement (#1778)
* Fix typo

* Remove unnecessary raise statement
2022-04-05 22:22:59 +08:00
YishiMichael
55a91a2354 Remove unnecessary raise statement 2022-04-05 22:16:26 +08:00
YishiMichael
50ffcbc5c7 Merge branch '3b1b:master' into master 2022-04-05 21:10:45 +08:00
YishiMichael
b764791258 Fix typo (#1777) 2022-04-05 14:04:26 +08:00
YishiMichael
7f616987a3 Fix typo 2022-04-05 14:01:07 +08:00
Grant Sanderson
648855dae0 Merge pull request #1772 from YishiMichael/master
Construct LabelledString base class for MarkupText and MTex
2022-04-04 10:01:13 -07:00
YishiMichael
974d9d5ab0 Avoid empty spans 2022-04-04 14:53:40 +08:00
YishiMichael
3c3264d7d6 Support passing in spans directly 2022-04-02 22:42:19 +08:00
鹤翔万里
39673a80d7 fix: add missing import of annotations 2022-04-02 22:00:02 +08:00
YishiMichael
84c56b3624 Fix typo 2022-03-31 18:11:37 +08:00
YishiMichael
dc816c9f8d Improve algorithm 2022-03-31 18:08:10 +08:00
YishiMichael
d5ab9a91c4 Reorganize files 2022-03-31 16:15:58 +08:00
YishiMichael
106f2a3837 Fix shallow copying bug 2022-03-31 11:36:50 +08:00
YishiMichael
724a500cc6 Fix shallow copying bug 2022-03-31 11:20:42 +08:00
YishiMichael
461500637e Fix type bug 2022-03-31 10:57:25 +08:00
YishiMichael
fc4f649570 Fix bugs brought by empty strings 2022-03-31 10:36:14 +08:00
YishiMichael
852da9ac2a Merge branch 'master' of https://github.com/YishiMichael/manim 2022-03-30 22:09:54 +08:00
YishiMichael
637d779190 Fix empty zipping bug 2022-03-30 22:09:26 +08:00
YishiMichael
9bbbed3a83 Remove comment 2022-03-30 22:04:10 +08:00
YishiMichael
1cde28838f Merge branch '3b1b:master' into master 2022-03-30 22:02:23 +08:00
YishiMichael
a8039d803e Rename file 2022-03-30 21:58:27 +08:00
YishiMichael
0add9b6e3a Rename file 2022-03-30 21:57:27 +08:00
YishiMichael
c5ec47b0e9 Refactor LabelledString 2022-03-30 21:53:00 +08:00
Grant Sanderson
769a4bbaf9 Merge pull request #1770 from 3b1b/video-work
Small camera/3d updates
2022-03-29 20:35:33 -07:00
Grant Sanderson
0f8d7ed597 Add VPrism, and refactor VCube 2022-03-29 20:34:14 -07:00
Grant Sanderson
2a7a7ac518 Add getter and setter for joint_type 2022-03-29 20:28:48 -07:00
Grant Sanderson
0610f331a4 Add get/set field_of_view for camera frame 2022-03-29 20:20:41 -07:00
Grant Sanderson
a0ba9c8b30 Fix CameraFrame.get_euler_angles to match conventions with set_euler_angles 2022-03-29 19:21:12 -07:00
YishiMichael
7e8b3a4c6b Refactor LabelledString 2022-03-29 23:38:06 +08:00
Grant Sanderson
393f77cb03 Merge pull request #1766 from sunkisser/SVGfeedback
Give the user feedback for SVGs that take a while
2022-03-28 09:30:00 -07:00
YishiMichael
82c972b946 Remove saxutils.unescape process 2022-03-28 19:31:19 +08:00
YishiMichael
89e139009b Remove an error raising 2022-03-28 19:17:40 +08:00
YishiMichael
45faa9063b Add items for hash_seed 2022-03-28 19:02:50 +08:00
YishiMichael
0e31ff12e2 Tiny fix for TransformMatchingString 2022-03-28 18:54:43 +08:00
YishiMichael
473aaea399 Construct LabelledString 2022-03-28 17:55:50 +08:00
Sunkisser
c4ea794107 use tqdm to display progress bar for long running SVG triangulations 2022-03-28 03:30:10 +00:00
Sunkisser
cfba6c431f revert previous changes - we will refactor using tqdm 2022-03-28 02:55:21 +00:00
鹤翔万里
e11c5def63 style: some style fixes 2022-03-28 08:05:41 +08:00
Sunkisser
a3e4246938 use log.debug and display idx+1 2022-03-27 21:59:49 +00:00
YishiMichael
305c6e6ee9 Resolve conflict for #1765 2022-03-27 15:33:51 +08:00
YishiMichael
3b01ec48e6 Refactor MTex 2022-03-27 14:44:50 +08:00
Sunkisser
969aa82f04 user feedback for SVGs that take a while 2022-03-26 23:43:11 +00:00
YishiMichael
e44a2fc8c6 Refactor MTex 2022-03-27 00:29:22 +08:00
YishiMichael
9ac1805e7e Refactor MTex 2022-03-26 20:52:28 +08:00
YishiMichael
6ad8636fab Adjust some typings (#1765)
* Adjust some typings

* Adjust typings
2022-03-23 14:17:34 +08:00
YishiMichael
4a03d196a6 Adjust typings 2022-03-23 13:34:30 +08:00
YishiMichael
519e2f4f1e Adjust some typings 2022-03-23 12:21:40 +08:00
Grant Sanderson
aefde2969f Merge pull request #1764 from 3b1b/video-work
Video work
2022-03-22 11:41:24 -07:00
Grant Sanderson
b7a3201fb3 Reorder imports 2022-03-22 11:31:52 -07:00
Grant Sanderson
a9349057ad Merge branch 'master' of github.com:3b1b/manim into video-work 2022-03-22 11:30:25 -07:00
Grant Sanderson
e812b99594 Re-add necessary imports 2022-03-22 11:07:26 -07:00
Grant Sanderson
0c8b333a42 Merge pull request #1736 from TonyCrane/master
Add type hints according to PEP 484 and PEP 604
2022-03-22 11:05:10 -07:00
Grant Sanderson
f690164087 Merge branch 'master' into master 2022-03-22 11:00:33 -07:00
Grant Sanderson
9d0cc810c5 Make panning more sensitive to mouse movements 2022-03-22 10:36:48 -07:00
Grant Sanderson
8b1f0a8749 Refactor Mobject.set_rgba_array_by_color 2022-03-22 10:35:49 -07:00
Grant Sanderson
c0b7b55e49 Use stroke_color to init arrow 2022-03-22 10:35:34 -07:00
Grant Sanderson
41b52c6117 Merge pull request #1751 from YishiMichael/master
Refactor Text with the latest manimpango
2022-03-22 09:50:43 -07:00
YishiMichael
e5ce0ca286 Reorganize methods 2022-03-22 20:46:35 +08:00
YishiMichael
a8c2a9fa3f Clean up code 2022-03-21 23:11:37 +08:00
YishiMichael
cabc1322d6 Clean up code 2022-03-21 23:06:47 +08:00
YishiMichael
c51811d2f1 Except IndexError for MTex.get_part_by_tex 2022-03-21 22:45:06 +08:00
Grant Sanderson
7bf3615bb1 Refactor rotation methods to use scipy.spatial.transform.Rotation 2022-03-18 17:11:08 -07:00
Grant Sanderson
1872b0516b Normalize rotation axis 2022-03-18 17:10:16 -07:00
Grant Sanderson
625460467f Refactor CameraFrame to use scipy.spatial.transform.Rotation 2022-03-18 16:06:15 -07:00
Grant Sanderson
e19f35585d Add GlowDots, analogous to GlowDot 2022-03-17 12:00:49 -07:00
Grant Sanderson
66819f5dbc Add 2d and 3d pianos 2022-03-17 12:00:29 -07:00
Grant Sanderson
f249da95fb Add a basic Prismify to turn a flat VMobject into something with depth 2022-03-17 12:00:10 -07:00
Grant Sanderson
bb3bd41605 Merge pull request #1762 from widcardw/patch-1
Fix the width of riemann rectangles
2022-03-17 09:06:42 -07:00
widcardw
67f8007764 Fix the width of riemann rectangles 2022-03-17 14:10:30 +08:00
YishiMichael
2a0709664d Add explicit return statement 2022-03-17 11:33:53 +08:00
YishiMichael
de46df78dc Modify warning message 2022-03-17 10:58:41 +08:00
Grant Sanderson
bd6c731e67 Allow CoordinateSystem.coords_to_point to work on arrays of coords 2022-03-16 12:24:22 -07:00
Grant Sanderson
c3e13fff05 Allow Numberline.number_to_point to work on an array of numbers 2022-03-16 12:24:03 -07:00
Grant Sanderson
bf2d9edfe6 Allow interpolate to work on an array of alpha values 2022-03-16 12:23:51 -07:00
Grant Sanderson
fa38b56fd8 Bug fix in cases where empty array is passed to shader 2022-03-16 12:23:11 -07:00
Grant Sanderson
dfbbb34035 Merge pull request #1757 from TurkeyBilly/patch-7
Reorganize getters for ParametricCurve
2022-03-06 09:27:22 -08:00
Bill Xi
0cef9a1e61 Reorganize getters for ParametricCurve 2022-03-06 13:54:42 +08:00
YishiMichael
2d764e12f4 fix char escaping bug 2022-03-03 21:09:05 +08:00
YishiMichael
d744311f15 add warning for slicing methods 2022-03-03 20:47:44 +08:00
YishiMichael
11af9508f2 add back get_parts_by_text, get_part_by_text methods 2022-03-03 20:38:15 +08:00
YishiMichael
a227ffde05 PEP8: reorder imports 2022-03-02 20:28:26 +08:00
YishiMichael
e0b0ae280e Allow passing strings to local_configs 2022-03-02 19:59:14 +08:00
YishiMichael
fce38fd8a5 Modify default value of apply_space_chars 2022-03-02 19:52:45 +08:00
YishiMichael
52a99a0c49 Add global_config, local_configs params 2022-03-02 19:34:56 +08:00
YishiMichael
956e3a69c7 Refactor Text 2022-03-02 18:38:24 +08:00
YishiMichael
95a3ac6876 Refactor Text 2022-02-26 20:36:32 +08:00
YishiMichael
b06a5d3f23 Refactor Text 2022-02-26 20:31:26 +08:00
YishiMichael
fa8962e024 Refactor Text 2022-02-20 23:35:48 +08:00
YishiMichael
0a4c4d5849 Merge branch '3b1b:master' into master 2022-02-20 23:34:10 +08:00
YishiMichael
e879da32d5 Specify UTF-8 encoding for tex files (#1748) 2022-02-17 19:09:55 +08:00
YishiMichael
6b12bc2f5e Merge branch '3b1b:master' into master 2022-02-17 19:06:17 +08:00
YishiMichael
4aeccd7769 Specify UTF-8 encoding for tex files 2022-02-17 19:03:45 +08:00
TonyCrane
4fbe948b63 style: insert an empty line after import 2022-02-16 21:08:25 +08:00
TonyCrane
05bee011d2 chore: update type hint of SVGMobject 2022-02-16 20:37:07 +08:00
鹤翔万里
37b548395c Merge branch 'master' into master 2022-02-16 20:30:53 +08:00
TonyCrane
4356c42e00 release: ready to release v1.5.0 2022-02-16 12:01:03 +08:00
TonyCrane
aea79be6cc workflow: only build wheels for python 3.6+ 2022-02-16 11:59:33 +08:00
TonyCrane
a08e9b01de Merge branch 'update' 2022-02-16 11:47:46 +08:00
TonyCrane
9f3b404df6 resolve conflict and add type hints for it 2022-02-16 11:46:55 +08:00
TonyCrane
8ef42fae24 Merge branch 'master' of https://github.com/3b1b/manim 2022-02-16 11:21:20 +08:00
TonyCrane
6be6bd3075 docs: change the style of changelog 2022-02-16 11:20:08 +08:00
TonyCrane
a33eac7aa8 docs: update changelog for #1742 #1744 #1745 #1746 2022-02-16 11:17:37 +08:00
Grant Sanderson
9d6a28bc29 Merge pull request #1746 from 3b1b/video-work
Change interaction-to-embed keybinding
2022-02-15 10:14:18 -08:00
Grant Sanderson
06405d5758 Merge branch 'master' of github.com:3b1b/manim into video-work 2022-02-15 10:11:35 -08:00
Grant Sanderson
46e356e791 Change keyboard shortcut to drop into an embedding to be ctrl+shift+e 2022-02-15 10:10:57 -08:00
Grant Sanderson
97ca42d454 Merge pull request #1745 from YishiMichael/master
Reorganize inheriting order and refactor SVGMobject
2022-02-15 10:05:53 -08:00
Grant Sanderson
a4eee6f44c Merge pull request #1744 from TurkeyBilly/patch-3
Add text_config for DecimalNumber
2022-02-15 09:59:46 -08:00
YishiMichael
8cac16b452 Update display_during_execution 2022-02-15 21:59:09 +08:00
YishiMichael
719cd8cde3 Remove redundant brackets 2022-02-15 21:54:56 +08:00
Bill Xi
0bb9216c14 Update hash_obj method 2022-02-15 21:50:14 +08:00
YishiMichael
6f9df8db26 Improve hashing algorithm 2022-02-15 21:38:22 +08:00
YishiMichael
3756605a45 Update display_during_execution 2022-02-15 20:55:44 +08:00
TonyCrane
0e4d4155a3 workflow: only build wheels for python 3.7+ 2022-02-15 20:23:59 +08:00
YishiMichael
0cab23b2ba Reorganize inheriting order of SVGMobject 2022-02-15 20:16:15 +08:00
TonyCrane
854f7cd2bf fix: remove type alias import in indication.py 2022-02-15 18:47:17 +08:00
TonyCrane
41c4023986 chore: add type hints to manimlib.animation 2022-02-15 18:39:45 +08:00
TonyCrane
d19e0cb9ab fix: remove import before future 2022-02-15 14:56:00 +08:00
TonyCrane
f085e6c2dd chore: add type hints to manimlib.window 2022-02-15 14:55:35 +08:00
TonyCrane
91ffdeb2d4 chore: add type hints to manimlib.shader_wrapper 2022-02-15 14:49:02 +08:00
TonyCrane
db71ed1ae9 fix: fix type hint of remove_empty_value 2022-02-15 14:38:55 +08:00
TonyCrane
4c16bfc2c0 chore: add type hints to manimlib.mobject 2022-02-15 14:37:15 +08:00
Bill Xi
aef02bfcf9 changed hashing 2022-02-15 11:45:17 +08:00
TonyCrane
3744844efa fix: fix type hint of set_array_by_interpolation 2022-02-15 11:35:22 +08:00
Bill Xi
9d04e287d7 Removed init_colors 2022-02-15 10:20:06 +08:00
Bill Xi
97c0f4857b Update numbers.py
Added config passing for text
2022-02-15 09:35:10 +08:00
Grant Sanderson
7f9b0a7eac Merge pull request #1742 from 3b1b/video-work
Presenter mode bug fix
2022-02-14 07:58:55 -08:00
Grant Sanderson
133724d29a Allow for using right arrow in presenter mode 2022-02-14 07:56:26 -08:00
Grant Sanderson
559b96e7ce Small bug fix for presenter mode 2022-02-14 07:52:06 -08:00
TonyCrane
773e013af9 chore: add type hints to manimlib.mobject.svg 2022-02-14 22:55:41 +08:00
TonyCrane
61c70b426c remove unnecessary import 2022-02-14 21:43:22 +08:00
TonyCrane
9bdcc8b635 style: remove quotes of annotations according to PEP 563 2022-02-14 21:41:45 +08:00
TonyCrane
66caf0c1ad chore: only import some classes when type checking 2022-02-14 21:34:56 +08:00
TonyCrane
62cab9feaf chore: re-add type hint for EventListener 2022-02-14 21:25:46 +08:00
TonyCrane
be5de32d70 chore: add type hints to manimlib.scene 2022-02-14 21:22:18 +08:00
鹤翔万里
09ce4717aa Merge branch '3b1b:master' into master 2022-02-14 20:02:50 +08:00
TonyCrane
7fb6f352c4 fix: fix some bugs caused by type hints and imports 2022-02-14 20:02:24 +08:00
TonyCrane
f29ef87bba style/docs: fix argument help style and update docs for it 2022-02-14 19:50:30 +08:00
TonyCrane
e39f81ccff Merge branch '3b1b-master' 2022-02-14 14:12:21 +08:00
TonyCrane
a0ed9edb42 resolve conflict 2022-02-14 14:12:06 +08:00
TonyCrane
fc1e916f42 docs: update changelog for #1725 #1727 #1728 #1731 #1739 #1740 2022-02-14 14:03:51 +08:00
Grant Sanderson
b3b7d214ad Fix Write bug (#1740)
* Avoid division by zero error for calling Write on null objects
2022-02-13 20:04:05 -08:00
Grant Sanderson
602809758e Video work (#1739)
* Enable setting points to a null list, and adding one point at a time.

* Add refresh_locked_data

* Add presenter mode to scenes with -p option

* Allow for an embed by hitting e during interaction

* Add set_min_height, etc.

* Make sure null parametric curve has at least one point

* Account for edge case where \{ is used in Tex

* Allow for logging notes in wait calls, useful for presenter mode

* Simplify choose, and add gen_choose for fractional amounts

* Default to no top on axes

* Allow match_x, match_y, etc. to take in a point

* Allow wait calls to ignore presenter mode

* Just use math.combo, no caching with choose(n, r)

* Use generator instead of list in bezier

* Bubble init_colors should override

* Account for "px" values read in from an svg

* Stop displaying when writing is happening

* Update the way Bubble override SVG colors
2022-02-13 15:16:16 -08:00
TonyCrane
960463d143 docs: remove support for python 3.6 2022-02-13 20:47:04 +08:00
TonyCrane
9a8aee481d chore: add type hints to manimlib.event_handler 2022-02-13 20:03:05 +08:00
TonyCrane
1064e2bb30 chore: add type hints to manimlib.camera 2022-02-13 19:32:53 +08:00
TonyCrane
992e61ddf2 style: rename Color type to ManimColor 2022-02-13 19:02:28 +08:00
TonyCrane
19187ead06 chore: add type hints to manimlib.mobject.types 2022-02-13 18:56:50 +08:00
TonyCrane
7f8216bb09 chore: replace some iterable with npt.ArrayLike 2022-02-13 15:18:04 +08:00
TonyCrane
e78113373a chore: add type hints to manimlib.mobject.mobject 2022-02-13 15:11:35 +08:00
TonyCrane
35025631eb chore: fix type hint of bezier 2022-02-13 12:56:03 +08:00
Elisha Hollander
f9351536e4 minor fixes (#1737) 2022-02-13 11:12:41 +08:00
TonyCrane
6e292daf58 chore: add type hints to manimlib.utils 2022-02-12 23:47:23 +08:00
YishiMichael
67f5b10626 Attempt to refactor SVGMobject with svgelements (#1731)
* Some small refactors

* Refactor MTex

* Implement TransformMatchingMTex

* Some refactors

* Some refactors

* Some small refactors

* Strip strings before matching

* Implement get_submob_tex

* Use RGB color mode

* Some small refactors

* Try refactoring SVGMobject with svglib

* Refactor SVGMobject using svgelements

* Refactor SVGMobject using svgelements

* Use functions instead of func names as dict values

* style: modify import order to conform to PEP8

* Set default values to None

* modify import order

* Remove unused import

Co-authored-by: TonyCrane <tonycrane@foxmail.com>
2022-02-11 07:53:21 -08:00
YishiMichael
baba6929df Implement ImplicitFunction (#1727) 2022-02-07 08:24:40 -08:00
YishiMichael
d6b20a7306 Refactor MTex and implement TransformMatchingMTex (#1725)
* Some small refactors

* Refactor MTex

* Implement TransformMatchingMTex

* Some refactors

* Some refactors

* Some small refactors

* Strip strings before matching

* Implement get_submob_tex

* Use RGB color mode

* Some small refactors
2022-02-07 08:21:53 -08:00
鹤翔万里
4c3ba7f674 Clean dependencies (#1728)
* clean dependencies

* add classifiers to metadata
2022-02-05 22:13:34 +08:00
TonyCrane
3883f57bf8 release: ready to release v1.4.1 2022-02-04 11:03:37 +08:00
TonyCrane
d2e0811285 import Iterable from collections.abc instead of collections 2022-02-04 10:55:59 +08:00
Grant Sanderson
1e2a6ffb8a Merge pull request #1724 from TurkeyBilly/patch-2
Temporarily fix boolean operation bug
2022-01-31 08:06:27 -08:00
Bill Xi
56e5696163 Update boolean_ops.py 2022-01-31 23:29:36 +08:00
TonyCrane
1ec00629a5 release: ready to release v1.4.0 2022-01-30 13:06:22 +08:00
TonyCrane
aa6335cd90 docs: update changelog for #1719 #1720 #1721 and #1723 2022-01-30 13:00:57 +08:00
YishiMichael
7093f7d02d Some small refactors to MTex (#1723) 2022-01-30 12:42:35 +08:00
Grant Sanderson
fad9ed2df7 Merge pull request #1720 from YishiMichael/master
Handle explicit color-related commands
2022-01-29 08:01:48 -08:00
YishiMichael
725155409b Some small refactors 2022-01-29 21:06:54 +08:00
YishiMichael
a6675eb043 Some small refactors 2022-01-29 14:35:27 +08:00
YishiMichael
5d2dcec307 Fix color-related bugs 2022-01-29 14:05:52 +08:00
Grant Sanderson
f60dc7cd07 Merge pull request #1719 from 3b1b/parse-style
Parse style from <style> tag and Add support to <line> tag
2022-01-27 13:33:14 -08:00
YishiMichael
6c39cac62b Remove redundant attribute 2022-01-28 01:19:02 +08:00
鹤翔万里
2bd25a55fa add back override parameter to init_colors 2022-01-28 00:20:13 +08:00
鹤翔万里
0e4edfdd79 improve config helper (#1721) 2022-01-28 00:16:19 +08:00
YishiMichael
277256a407 Merge branch '3b1b:master' into master 2022-01-27 23:11:19 +08:00
YishiMichael
831b7d455c Handle explicit color-related commands 2022-01-27 23:09:05 +08:00
TonyCrane
1d14a23af9 docs: update changelog for #1712 #1717 and #1716 2022-01-27 22:21:40 +08:00
TonyCrane
dffa70ea15 docs: update changelog for #1704 and #1709 2022-01-27 22:09:57 +08:00
TonyCrane
31976063df add dependency cssselect2 2022-01-27 17:31:14 +08:00
TonyCrane
aa135280ac support <line> tag in SVG 2022-01-27 17:23:58 +08:00
TonyCrane
f0160822ba fix bug of ref map 2022-01-27 17:17:19 +08:00
TonyCrane
48e07d1817 parse style attribute using tinycss 2022-01-27 17:16:52 +08:00
TonyCrane
3ef5899a24 some cleanups 2022-01-27 16:43:45 +08:00
TonyCrane
f895455264 add parser for <style> tag of SVG 2022-01-27 16:37:51 +08:00
Grant Sanderson
3baa14103e Merge pull request #1716 from YishiMichael/master
Refactor MTex and some clean-ups
2022-01-26 08:56:44 -08:00
Grant Sanderson
c315300ff1 Merge branch 'master' into master 2022-01-26 08:54:18 -08:00
Grant Sanderson
3b17d6d0eb Merge pull request #1718 from 3b1b/text-fix
Text fix
2022-01-26 08:21:36 -08:00
Grant Sanderson
8a29de5ef0 Override style for Text 2022-01-26 08:21:00 -08:00
Grant Sanderson
ecb729850a Small style fixes 2022-01-26 08:20:45 -08:00
Grant Sanderson
a770291053 Include style in MTex.get_mobjects_from 2022-01-26 08:20:38 -08:00
Grant Sanderson
27c666fab5 Merge pull request #1717 from 3b1b/svg-style
Parse and generate style for SVG
2022-01-26 07:56:03 -08:00
YishiMichael
942a7e71b8 Update MTex 2022-01-26 23:46:13 +08:00
TonyCrane
ebb75d1235 cached SVGMobject in SingleStringTex with default color 2022-01-26 20:37:44 +08:00
TonyCrane
9af23415a2 synchronize SingleStringTex's color to SVGMobject 2022-01-26 20:20:48 +08:00
TonyCrane
19778e405a some cleanups 2022-01-26 19:55:47 +08:00
TonyCrane
833e40c2d4 fix default style 2022-01-26 19:50:27 +08:00
TonyCrane
9df53b8a18 fix the bug of M command with more than 2 args 2022-01-26 14:05:01 +08:00
TonyCrane
ff86b0e378 fix the bug of outdated relative_point after command Z 2022-01-26 13:56:42 +08:00
TonyCrane
92adcd75d4 add style support to svg 2022-01-26 13:53:53 +08:00
YishiMichael
240f5020b4 Add back default_config.yml 2022-01-26 13:21:27 +08:00
YishiMichael
e8205a5049 Some refactors for MTex 2022-01-26 13:03:14 +08:00
TonyCrane
6c8dd14adc some clean 2022-01-26 11:00:57 +08:00
Grant Sanderson
07f84e2676 Merge pull request #1712 from 3b1b/fix-svg
Improve handling of SVG transform and Some refactors
2022-01-25 13:26:40 -08:00
TonyCrane
8db1164ece some refactors 2022-01-25 21:48:04 +08:00
TonyCrane
790bf0a104 fix typo 2022-01-25 20:25:30 +08:00
TonyCrane
8205edcc4c fix a small bug 2022-01-25 20:13:20 +08:00
TonyCrane
05b3c9852e fix add_smooth_cubic_curve_to when have only one point 2022-01-25 20:06:00 +08:00
TonyCrane
925f2e123f add comments 2022-01-25 19:54:19 +08:00
TonyCrane
565763a2ff reconstruct path parser 2022-01-25 19:44:42 +08:00
TonyCrane
6a74c241b8 fix bug of node which is not an element 2022-01-25 16:28:23 +08:00
TonyCrane
416cc8e6d5 add warning for unsupported element type 2022-01-25 14:41:11 +08:00
TonyCrane
d694aed452 add support for skewX and skewY transform 2022-01-25 14:40:02 +08:00
TonyCrane
11379283aa add support for rotate transform 2022-01-25 14:29:47 +08:00
TonyCrane
dd13559b11 replace warnings.warn with log.warning 2022-01-25 14:09:05 +08:00
TonyCrane
1658438fef allow Mobject.scale receive iterable scale_factor 2022-01-25 14:05:32 +08:00
TonyCrane
f4eb2724c5 refactor SVGMobject.handle_transforms 2022-01-25 14:04:35 +08:00
TonyCrane
33f720c73a fix typo 2022-01-25 13:15:53 +08:00
TonyCrane
bbb4fa155c fix the depth of svg tag 2022-01-25 13:14:19 +08:00
Grant Sanderson
2318c9e716 Merge pull request #1709 from TurkeyBilly/patch-4
Fix "Code is unreachable Pylance" warning for NumberPlane
2022-01-17 08:56:08 -08:00
Bill Xi
e80dd243f1 Added abstract method decorator and override 2022-01-17 20:27:34 +08:00
Grant Sanderson
3ffe300f96 Merge pull request #1704 from TurkeyBilly/patch-2
Adding "label_buff" config parameter for Brace
2022-01-03 08:53:34 -08:00
Bill Xi
24e3caa072 fix no "import copy" bug
added import copy
2022-01-03 16:49:00 +08:00
Bill Xi
9efd02c500 Remove spelling mistake
I misspelled "label"
2022-01-03 16:37:26 +08:00
Bill Xi
0a318486c5 Adding "lable_buff" config parameter for Brace 2022-01-03 14:57:16 +08:00
鹤翔万里
919133c6bf Merge pull request #1702 from Suji04/patch-2
removed extra 'all' from comments
2021-12-31 18:18:50 +08:00
Sujan Dutta
066a2ed5dc removed extra 'all' from comments 2021-12-31 00:10:57 -05:00
TonyCrane
09ced7ce9a docs: update changelog for #1694 and #1697 2021-12-23 10:34:15 +08:00
Grant Sanderson
505b229117 Merge pull request #1697 from 3b1b/video-work
Video work
2021-12-21 10:59:50 -08:00
Grant Sanderson
5aa8d15d85 Use FFMPEG_BIN instead of "ffmpeg" for sound incorporation 2021-12-21 10:58:58 -08:00
Grant Sanderson
7aa05572ab Remove unnecessary import 2021-12-21 10:58:41 -08:00
Grant Sanderson
f1996f8479 Small hack for the lightbulb, needs to be fixed properly later 2021-12-21 10:58:33 -08:00
Grant Sanderson
37b63ca956 Merge pull request #1694 from DangGiaChi/BarChart_modified
Add option to add ticks on x-axis in BarChart()
2021-12-17 09:30:53 -08:00
DangGiaChi
84fd657d9b Change variables names: x_tick, x_ticks, y_tick, y_ticks 2021-12-17 15:02:10 +07:00
DangGiaChi
b489490f41 Fixed things as suggestions 2021-12-17 07:14:37 +07:00
DangGiaChi
bbf45f95c6 Add option to add ticks on x-axis in BarChart() 2021-12-16 22:03:29 +07:00
TonyCrane
b61f1473a5 release: ready to release v1.3.0 2021-12-14 13:41:44 +08:00
TonyCrane
e3d5b49a55 docs: remove deprecated config usage example 2021-12-14 13:35:50 +08:00
TonyCrane
4d6a0db1e1 docs: update changelog for #1691 and #1678 2021-12-14 13:31:44 +08:00
TonyCrane
0af46e149d add metavar LINENO for --embed option 2021-12-14 12:14:04 +08:00
TonyCrane
896b011d76 docs: update changelog for #1688 2021-12-14 12:11:25 +08:00
Grant Sanderson
3adaf8e325 Merge pull request #1678 from YishiMichael/master
Construct `MTex`
2021-12-13 16:09:55 -08:00
Grant Sanderson
8762177df5 Merge pull request #1691 from 3b1b/video-work
Video work
2021-12-13 16:07:42 -08:00
Grant Sanderson
a1d51474ea Add GlowDot 2021-12-13 16:03:57 -08:00
Grant Sanderson
83841ae415 Add Dodecahedron 2021-12-13 16:03:46 -08:00
Grant Sanderson
b81f244c3c Inserted "self.embed" line should match passed in line number 2021-12-13 16:03:36 -08:00
Grant Sanderson
7023548ec6 Fix TransformMatchingParts bug 2021-12-13 16:03:12 -08:00
Grant Sanderson
758f329a06 Use array copy when checking need for refreshing triangulation 2021-12-13 16:02:47 -08:00
Grant Sanderson
8f1dfabff0 VectorizedPoint should call __init__ for both super classes 2021-12-13 16:02:10 -08:00
Grant Sanderson
7fa01d5de8 Small formatting change 2021-12-13 16:01:54 -08:00
Michael W
0de303d5e0 Some refactors
- Split out `_TexParser` class
- Replace `math_mode` parameter with `tex_environment`
- Fix the bug that braces following even number of backslashes aren't matched
2021-12-13 21:01:27 +08:00
Michael W
155839bde9 Add unbreakable_commands parameter 2021-12-13 12:46:29 +08:00
Grant Sanderson
3a1e5e1bcf Remove old implementation for SurfaceMesh 2021-12-07 10:07:49 -08:00
Grant Sanderson
264f7b1172 Add Circle.get_radius 2021-12-07 10:07:25 -08:00
Grant Sanderson
85e90a1488 Don't print info for pre-run scene 2021-12-07 10:07:15 -08:00
Grant Sanderson
f8e6e7df3c Update progress display for full scene render 2021-12-07 10:06:48 -08:00
Grant Sanderson
5dd7cce67f Have Scene.wait only go through full progression during skipping when there are time-based updaters 2021-12-07 10:05:33 -08:00
Grant Sanderson
f21a4a4696 Only stop skipping if the scene wasn't originally meant to be 2021-12-07 10:04:28 -08:00
Grant Sanderson
98b0d266d2 Make sure skip_animations and start_at_animation_number play well together 2021-12-07 10:03:10 -08:00
Michael W
6821a7c20e Handle empty strings 2021-12-07 14:12:08 +08:00
Michael W
00f72da493 Some small refactor 2021-12-07 13:17:48 +08:00
Michael W
744916507c Add a debugging method 2021-12-07 12:55:52 +08:00
Michael W
88d863c1d7 Support get_tex() for submobjects of MTex 2021-12-07 00:34:07 +08:00
Michael W
d7dcc9d76f Recover file 2021-12-07 00:32:12 +08:00
Michael W
4631508b7d Add get_tex() method 2021-12-06 13:48:17 +08:00
Michael W
8803088121 Fix bugs concerned with child environments 2021-12-06 09:44:59 +08:00
Michael W
1d466cb299 Add Exception for indices_of_part() 2021-12-05 22:17:09 +08:00
Michael W
5a1f00b1cb Add TransformMatchingMTex 2021-12-05 11:46:15 +08:00
Michael W
17d31045b2 Add TransformMatchingMTex 2021-12-05 11:45:42 +08:00
Michael W
950466c1da Some refactors 2021-12-05 10:21:55 +08:00
Michael W
62151e52f1 Merge branch '3b1b:master' into master 2021-12-01 08:42:17 +08:00
Grant Sanderson
b4ce0b910c Merge pull request #1688 from 3b1b/video-work
Video work
2021-11-30 11:45:57 -08:00
Grant Sanderson
9dd1f47dab Create single progress display for full scene render
When a scene is written to file, it will now do a preliminary run of a copy of the scene with skip_animations turned on to count the total frames, which has the added benefit of catching runtime errors early, and allowing an quicker preview of the last frame to be sure everything will render as expected.

The Progress display bars for individual animations are replaced with a more global progress display bar showing the full render time for the scene.

This has the downside that all the non-rendering computations in a scene are run twice, so any scene with slow computations unrelated to rendering will take longer. But those are rarer, so the benefits seem worth it.
2021-11-30 11:41:33 -08:00
Grant Sanderson
49743daf32 Add Mobject.insert_submobject method 2021-11-30 11:30:50 -08:00
Grant Sanderson
ba23fbe71e Make sure Mobject.is_fixed_in_frame stays updated with uniforms 2021-11-30 11:30:34 -08:00
Grant Sanderson
ee1594a3cb Match fix_in_frame status for FlashAround mobject 2021-11-30 11:29:12 -08:00
Grant Sanderson
e9afb0ee33 Fix tiny PEP errors 2021-11-30 11:28:26 -08:00
Michael W
8b1715379d Some small refactors 2021-11-29 09:48:00 +08:00
Michael W
2501fac32f Some small refactors 2021-11-29 09:38:48 +08:00
Michael W
1aec0462ec Some small refactors 2021-11-29 01:43:48 +08:00
Michael W
83c70a59d8 Sort superscripts and subscripts in submobjects 2021-11-29 01:15:38 +08:00
Michael W
9b8a6e7ff8 Merge branch '3b1b:master' into master 2021-11-28 23:38:23 +08:00
Michael W
758f2ec236 Some small refactor 2021-11-28 23:38:12 +08:00
TonyCrane
d9cac38618 update changelog 2021-11-28 18:50:57 +08:00
Michael W
e8ebfa312b Prevent infinite loops from unexpected inputs 2021-11-28 13:26:54 +08:00
Michael W
dae24891fa Add get_all_isolated_substrings method 2021-11-28 13:03:33 +08:00
Michael W
a4f9de1ca1 Fix bugs concerned with coloring 2021-11-28 12:14:29 +08:00
Michael W
697028cd4c Add slicing and indexing methods 2021-11-27 23:07:46 +08:00
Michael W
c84acc0023 Remove disabled methods 2021-11-27 19:53:52 +08:00
Michael W
b1d869cd11 Update __init__.py to include mtex_mobject 2021-11-27 16:21:06 +08:00
Michael W
13a5f6d6ff Add MTex 2021-11-27 16:19:01 +08:00
Michael W
e3f87d835b Recover files 2021-11-27 16:17:22 +08:00
Michael W
7ffab788b7 Recover numbers.py 2021-11-27 16:16:18 +08:00
Grant Sanderson
bcd09906be Fix bug in ShowSubmobjectsOneByOne 2021-11-22 08:05:59 -08:00
Grant Sanderson
407c53f97c Have rotation_between_vectors handle identical/similar vectors 2021-11-18 17:52:48 -08:00
Grant Sanderson
eea3c6b294 Better align SurfaceMesh to the corresponding surface polygons 2021-11-18 17:52:17 -08:00
Grant Sanderson
d2182b9112 Make sure set_length returns self 2021-11-18 17:51:56 -08:00
Grant Sanderson
fbc329d7ce Small bug fix for angle_between_vectors 2021-11-17 12:49:53 -08:00
Grant Sanderson
25045143a1 Have mobject uniforms supercede camera uniforms 2021-11-17 12:49:08 -08:00
Grant Sanderson
e899604a2d Add getter methods for specific euler angles 2021-11-17 12:48:17 -08:00
Grant Sanderson
0b898a5594 Add always_sort_to_camera for surfaces 2021-11-16 17:38:43 -08:00
Grant Sanderson
ee2f68cd49 Exchange gloss for reflectiveness 2021-11-16 17:38:30 -08:00
Grant Sanderson
2cce4ccdd7 Exchange gloss for reflectiveness 2021-11-16 17:38:08 -08:00
Grant Sanderson
f3ecebee43 Remove unnecessary import 2021-11-16 17:37:45 -08:00
Grant Sanderson
e764da3c3a use quick_point_from_proportion for graph points 2021-11-16 17:37:27 -08:00
Grant Sanderson
fbbea47d11 Change temp embed file name 2021-11-16 17:37:01 -08:00
Grant Sanderson
781a9934fd Add shortcut for setting black background stroke 2021-11-16 17:29:24 -08:00
Grant Sanderson
a7173142bf Fix VMobject.fade 2021-11-16 17:29:10 -08:00
Grant Sanderson
0e78027186 Improve point_from_proportion to account for arc length 2021-11-16 17:28:48 -08:00
Grant Sanderson
82bd02d21f Fix angle_between_vectors, add rotation_between_vectors 2021-11-16 17:08:35 -08:00
Grant Sanderson
d065e1973d Add option to insert embed line from the command line (mildly hacky) 2021-11-14 12:31:56 -08:00
Grant Sanderson
7070777408 Tiny formatting change 2021-11-12 15:47:23 -08:00
TonyCrane
5c2a9f2129 style: change CRLF to LF
Change the line ending characters from CRLF to LF
2021-11-12 21:49:56 +08:00
Michael W
1b695e1c19 Refactor Tex 2021-11-12 21:22:42 +08:00
Michael W
da1cc44d90 Remove SingleStringTex 2021-11-12 21:21:44 +08:00
Grant Sanderson
3bbb759112 Merge branch 'master' of github.com:3b1b/manim into video-work 2021-11-09 09:18:56 -08:00
Grant Sanderson
41c6cbcb59 Merge pull request #1675 from YishiMichael/master
Add boolean operations for mobjects
2021-11-09 09:18:38 -08:00
Grant Sanderson
5930e6a176 Refresh unit normal when reversing points 2021-11-09 09:15:15 -08:00
Grant Sanderson
8f3ff91165 Add reflectiveness to style and default to fill for VMobject.get_color 2021-11-09 09:15:00 -08:00
Michael W
b12677bc1a Add files via upload 2021-11-10 00:35:09 +08:00
Michael W
cdec64e3f1 Add boolean operations for mobjects 2021-11-10 00:23:40 +08:00
Michael W
2dc8bc9b9c Add boolean operations for mobjects 2021-11-10 00:23:04 +08:00
Michael W
94f0bf557a Add skia-pathops package 2021-11-10 00:21:04 +08:00
Grant Sanderson
e20690b7c1 Don't necessarily remove anti_alias on ThreeDScene 2021-11-08 21:48:42 -08:00
Grant Sanderson
2c7689ed9e Enable glow_factor on dots 2021-11-08 21:47:48 -08:00
Grant Sanderson
c73d507c76 Fix SurfaceMesh to be evenly spaced 2021-11-08 21:47:26 -08:00
Grant Sanderson
317a5d6226 Make it possible to set full screen preview as a default 2021-11-08 21:47:02 -08:00
Grant Sanderson
4339f97c56 Small refactor and added functionality 2021-11-08 21:46:35 -08:00
Grant Sanderson
81c3ae3037 Have separate notions of gloss and reflectiveness 2021-11-08 21:46:09 -08:00
Grant Sanderson
61b04079f5 Merge branch 'master' of github.com:3b1b/manim into video-work 2021-11-01 13:18:09 -07:00
Grant Sanderson
5a0e5a16ea Merge pull request #1667 from TurkeyBilly/master
Overridden add operations for mobjects
2021-11-01 13:17:16 -07:00
Grant Sanderson
f0b5181694 Update manimlib/mobject/mobject.py
Small bug fix to Mobject.__add__
2021-11-01 13:16:50 -07:00
Grant Sanderson
185782a2e7 Remove stray brace 2021-11-01 13:05:13 -07:00
Grant Sanderson
8ab95ebe9d Change where unit_normal data gets updated 2021-11-01 13:04:53 -07:00
Bill Xi
77159eea2e Update mobject.py 2021-11-01 10:19:06 +08:00
Bill Xi
6766e459f2 Update vectorized_mobject.py 2021-10-31 20:03:04 +08:00
Bill Xi
01f4ef3e5d Create mobject.py 2021-10-31 20:02:30 +08:00
Bill Xi
b531c82bc4 Update mobject.py 2021-10-31 20:01:16 +08:00
Bill Xi
5d942d5ac0 Update vectorized_mobject.py 2021-10-31 18:42:14 +08:00
Bill Xi
b285ca7c22 Update vectorized_mobject.py 2021-10-31 18:38:23 +08:00
Bill Xi
82540edae9 Update mobject.py 2021-10-31 18:37:12 +08:00
Bill Xi
f9a6fa7036 Update mobject.py 2021-10-31 18:35:28 +08:00
Bill Xi
4eabaecfc8 Update mobject.py 2021-10-31 18:34:23 +08:00
Grant Sanderson
b881e55fca Merge branch 'master' of github.com:3b1b/manim into video-work 2021-10-24 09:48:56 -07:00
Grant Sanderson
f1c50640a3 Merge pull request #1662 from YishiMichael/master
Refactor command handling in `svg_mobject.py`
2021-10-24 09:47:54 -07:00
Grant Sanderson
deb1311e48 Fix VideoIcon 2021-10-24 09:28:52 -07:00
Grant Sanderson
82fa6ab125 Temporary hack to fix a bug I don't understand 2021-10-24 09:28:39 -07:00
Michael W
4d91ff3f2f Update balance_braces method 2021-10-24 23:21:49 +08:00
Michael W
b6f9da87d0 Refactor command handling in svg_mobject.py 2021-10-24 22:30:18 +08:00
BillyLikesHacking
c60e97ebf9 Update vectorized_mobject.py 2021-10-22 20:58:19 +08:00
BillyLikesHacking
b1ed16e81a Update mobject.py 2021-10-22 20:46:47 +08:00
BillyLikesHacking
c94ebaa260 Update vectorized_mobject.py 2021-10-22 20:03:58 +08:00
BillyLikesHacking
030fb52018 Update vectorized_mobject.py 2021-10-22 20:03:05 +08:00
BillyLikesHacking
487f582302 Update mobject.py 2021-10-22 20:02:05 +08:00
BillyLikesHacking
6d0c55d2ba Update mobject.py 2021-10-22 20:00:27 +08:00
鹤翔万里
c82f60e29e Merge pull request #1658 from 050644zf/master
Update the link of the Chinese Ver. Docs
2021-10-20 17:25:28 +08:00
Nightsky
c03279d626 Update the link of the Chinese Ver. Docs 2021-10-20 17:20:52 +08:00
Grant Sanderson
7b72fa8ca1 Merge branch 'master' of github.com:3b1b/manim into video-work 2021-10-18 07:12:10 -07:00
Grant Sanderson
8b454fbe93 Slight tweaks to how saturation_factor works on newton-fractal 2021-10-18 07:12:05 -07:00
Grant Sanderson
f77e25ff86 Merge pull request #1655 from widcardw/master
Fix the bug of rotating camera
2021-10-18 07:01:58 -07:00
widcardw
872ef67cf7 Fix bug of rotating camera 2021-10-18 21:00:25 +08:00
widcardw
305ca72ebe Fix the bug of rotating camera 2021-10-18 19:05:05 +08:00
TonyCrane
4d81d3678b update changelog 2021-10-16 21:07:53 +08:00
鹤翔万里
55e968e174 Merge pull request #1653 from YishiMichael/master
Fix parameter typo
2021-10-16 21:06:32 +08:00
TonyCrane
97d1609849 update changelog 2021-10-16 21:03:36 +08:00
TonyCrane
e10f850d0d add cli flag to specify log level 2021-10-16 21:01:39 +08:00
Michael W
b8584fe5ab Fix parameter typo 2021-10-16 20:59:31 +08:00
TonyCrane
b6c23a09e9 update version to v1.2.0 2021-10-16 13:07:26 +08:00
Michael W
0e574882b3 Refactor #1637 (#1650)
* Refactor #1637

* Refactor #1637

* Refactor #1637

* Refactor #1637

* Refactor #1637

* Refactor #1637

* Update config.py

Co-authored-by: 鹤翔万里 <tonycrane@foxmail.com>
2021-10-16 13:04:52 +08:00
TonyCrane
bee3470856 update changelog 2021-10-16 11:12:13 +08:00
Grant Sanderson
ed3d44120c Merge pull request #1637 from 3b1b/add_warnings
Add warnings and use rich to display log
2021-10-15 12:13:02 -07:00
Grant Sanderson
4466cfe727 Merge branch 'master' into add_warnings 2021-10-15 12:12:36 -07:00
Grant Sanderson
e9aba0b92c Merge pull request #1649 from 3b1b/quintic
Small tweaks
2021-10-15 12:10:18 -07:00
Grant Sanderson
6cdbe0d67a Have image mobject remember the filepath to the Image 2021-10-15 12:08:30 -07:00
Grant Sanderson
7732d2f0ee Fix ComplexPlane -i display bug 2021-10-15 12:07:47 -07:00
Grant Sanderson
f77482c864 Merge pull request #1648 from 3b1b/quintic
Newton fractals and Mandelbrot Fractals
2021-10-15 12:07:05 -07:00
Grant Sanderson
23ebbb2af1 Merge branch 'master' of github.com:3b1b/manim into quintic 2021-10-15 12:05:09 -07:00
Grant Sanderson
14fbed76da Consolidate and rename newton_fractal shader 2021-10-15 12:00:29 -07:00
Grant Sanderson
e10a752c00 Allow releasing of Textures 2021-10-15 08:52:37 -07:00
鹤翔万里
fde82e09c0 Merge pull request #1643 from BillyLikesHacking/patch-1
Fixed Simple typo
2021-10-12 12:21:06 +08:00
BillyLikesHacking
cfd362aa56 Update matrix.py 2021-10-12 09:04:30 +08:00
Grant Sanderson
329d2c6eae Make sure stroke width is always a float 2021-10-11 06:23:03 -07:00
Grant Sanderson
f22a341e84 Save state before each embed 2021-10-11 06:22:41 -07:00
Grant Sanderson
2d115a2c90 Small cleanup 2021-10-11 06:22:26 -07:00
Grant Sanderson
c726eb7a18 buf fix with get_lines_parallel_to_axis 2021-10-11 06:22:05 -07:00
Grant Sanderson
33fa76dfac Add more fractals and decompose slightly 2021-10-11 06:21:47 -07:00
TonyCrane
0021880fba update changelog 2021-10-07 23:37:33 +08:00
TonyCrane
ed99427a3b print version when start 2021-10-07 17:42:23 +08:00
TonyCrane
7425057d9f use rich to log 2021-10-07 17:37:10 +08:00
TonyCrane
ef5253f1bc add cli flag -v to show version info 2021-10-06 17:54:28 +08:00
TonyCrane
fbccb1ebf3 add tips for embed mode 2021-10-06 17:34:46 +08:00
TonyCrane
f626a1a1e2 add tips for interactive mode 2021-10-06 17:28:18 +08:00
TonyCrane
c1242d2dd5 add warning for empty 2021-10-06 17:21:56 +08:00
Grant Sanderson
719c81d72b Fix negative path_arc case 2021-10-05 14:17:41 -07:00
Grant Sanderson
ed1fc4d5f9 Add bounding box as exceptional key to point_cloud mobject 2021-10-05 14:17:24 -07:00
Grant Sanderson
3822b00bec Change how Julia set highlight works 2021-10-05 14:16:50 -07:00
Grant Sanderson
2753beb7bb Merge branch 'master' of github.com:3b1b/manim into quintic 2021-10-03 10:28:14 -07:00
Grant Sanderson
a4afbfd739 Small fixes to PMobject 2021-10-03 10:27:34 -07:00
Grant Sanderson
5f878a2c1a Fix match_style 2021-10-03 10:27:06 -07:00
Grant Sanderson
9483f26a3b Copy uniform arrays in Mobject.copy 2021-10-03 10:26:47 -07:00
Grant Sanderson
b4132e3d5e Bug fix for 0 arrow length case 2021-10-03 10:26:27 -07:00
Grant Sanderson
e9b404406d Updates to poly_fractal shaders 2021-10-01 12:34:06 -07:00
Grant Sanderson
b543cc0e32 Temporary fix for PMobject array resizing 2021-10-01 12:33:52 -07:00
Grant Sanderson
d45ea28dc1 Fix DotCloud.set_radii 2021-10-01 12:33:20 -07:00
Grant Sanderson
788775e419 Larger spacing between Text lines 2021-10-01 12:32:38 -07:00
Grant Sanderson
1bca0e63e9 Remove unnecessary import 2021-10-01 12:32:20 -07:00
Grant Sanderson
54ad3550ef Fix bug with SVG rectangles 2021-10-01 12:32:04 -07:00
Grant Sanderson
d19b386415 Fix dots 2021-10-01 12:31:16 -07:00
Grant Sanderson
e359f520bc Merge pull request #1625 from YishiMichael/master
Add Code mobject with syntax highlighting
2021-09-15 09:31:34 -07:00
TonyCrane
696fc85ff7 change CRLF to LF 2021-09-15 20:29:56 +08:00
TonyCrane
add1daf500 change CRLF to LF 2021-09-15 20:02:57 +08:00
Michael W
242e4a3471 Add pygments to support Code 2021-09-15 16:04:27 +08:00
Michael W
9e563ae3b4 Add Code mobject and rewrite Text.text2settings() 2021-09-15 15:55:19 +08:00
鹤翔万里
da909c0df8 Merge pull request #1624 from BillyLikesHacking/patch-1
Update comments in example.py
2021-09-11 23:17:41 -05:00
BillyLikesHacking
0239e12d8a Update comments in example.py
updated the cmd command line to "manimgl example_scenes.py OpeningManimExample" instead of "python -m manim", which the latter one was used for cairo-backend manim version instead of the current manimgl
2021-09-12 11:06:09 +08:00
鹤翔万里
0fd8fdc3ca Merge pull request #1620 from meadlai/patch-1
Fix the import
2021-09-04 08:50:55 -05:00
meadlai
762f1abef7 Fix the import
Fix the import statement
2021-09-04 21:31:57 +08:00
Grant Sanderson
17c2772b84 Add Mobject.replicate 2021-08-28 06:21:51 -07:00
Grant Sanderson
0d2d1b5c03 Add MAX_DEGREE to poly_fractal 2021-08-28 06:21:32 -07:00
Grant Sanderson
4ce123be44 (Maybe temporary?) upates to Tracers 2021-08-26 11:44:45 -07:00
Grant Sanderson
d5a88d0fa4 Pass tuples and not arrays to uniforms 2021-08-26 11:44:24 -07:00
Grant Sanderson
3b146636b4 Use isclose in place of of == 0 2021-08-26 11:43:44 -07:00
Grant Sanderson
b24ba19dec Add kwargs to set_length 2021-08-26 11:43:19 -07:00
Grant Sanderson
0dc096bf57 Fix bug for single-valued ValueTracker 2021-08-26 11:42:58 -07:00
Grant Sanderson
e40a2935b1 Remove redundant relic 2021-08-26 11:42:32 -07:00
Grant Sanderson
f84b8a66fe poly_fractal shader 2021-08-26 11:40:55 -07:00
鹤翔万里
952a598e3b Merge pull request #1613 from k1499/fix-example-scenes-doc-typo
Typo fix in UpdatersExample
2021-08-24 23:27:08 -05:00
Grant Sanderson
c635f19f2a Push pixel_coords_to_space_coords to Window 2021-08-24 11:26:43 -07:00
Grant Sanderson
8645894255 Fix CoordinateSystem init bug 2021-08-24 11:26:22 -07:00
Kausik SS
e712951f2d Typo fix in UpdatersExample 2021-08-24 10:44:24 +05:30
TonyCrane
1b24074369 update packaging method 2021-08-24 09:00:42 +08:00
Grant Sanderson
acba13f499 Add Scene.point_to_mobject 2021-08-22 14:57:32 -07:00
Grant Sanderson
61aec6051a Use generator in place of list 2021-08-21 17:08:28 -07:00
Grant Sanderson
9a78d13212 get_smooth_quadratic_bezier_handle_points edge case for 2 points 2021-08-21 17:07:49 -07:00
Grant Sanderson
0787c4f362 Make sure framerate is 30 for previewed scenes 2021-08-21 17:07:20 -07:00
Grant Sanderson
0b7b3f4f31 Improve NumberLine.p2n speed 2021-08-21 17:07:05 -07:00
Grant Sanderson
7356a36fa7 Only call self.throw_error_if_no_points once for get_start_and_end 2021-08-21 17:06:37 -07:00
Grant Sanderson
f3e3a7c56f Improve TracingTaill 2021-08-21 17:05:40 -07:00
Grant Sanderson
a35dd5a3cb Add TracingTail 2021-08-21 10:36:59 -07:00
Grant Sanderson
7b4199c674 Call _handle_scale_side_effects after scaling takes place 2021-08-21 10:36:18 -07:00
Grant Sanderson
d8378d8157 Use approximately_smooth by default 2021-08-21 10:35:50 -07:00
Grant Sanderson
8647a6429d Reimplement arrow to be stroke, not fill (which will break some past scenes) 2021-08-21 10:35:29 -07:00
Grant Sanderson
3bb8f3f042 Add set_max_width, set_max_height, etc. 2021-08-19 14:47:30 -07:00
Grant Sanderson
56df15453f Fix bug with common range array used for all coordinate systems 2021-08-19 14:47:10 -07:00
Grant Sanderson
d50717a3fc Merge pull request #1607 from 3b1b/perf
Perf
2021-08-19 10:33:47 -07:00
Grant Sanderson
ca9b70e218 Make sure triangulation is remembered correctly 2021-08-19 09:19:02 -07:00
Grant Sanderson
25c5aa2c65 Small stylistic cleanup 2021-08-19 09:18:48 -07:00
Grant Sanderson
c08ea4e645 Add FlashyFadeIn 2021-08-19 09:00:30 -07:00
Grant Sanderson
573d630e5b Merge branch 'master' of github.com:3b1b/manim 2021-08-19 08:38:03 -07:00
Grant Sanderson
6d72893382 Let ValueTracker track vectors 2021-08-19 08:37:57 -07:00
Grant Sanderson
40290ada83 Remove unused parameter 2021-08-19 08:37:40 -07:00
Grant Sanderson
bd356daa99 Add VCube 2021-08-19 08:37:01 -07:00
Grant Sanderson
b667db2d31 Simplify Square 2021-08-19 08:34:53 -07:00
Grant Sanderson
f92211b352 Merge pull request #1598 from YishiMichael/master
Support the elliptical arc command for SVGMobject
2021-08-09 16:19:15 -07:00
Grant Sanderson
1c2b52a128 Merge branch 'master' of github.com:3b1b/manim 2021-08-09 16:09:01 -07:00
Grant Sanderson
eb315daeda Merge pull request #1601 from 3b1b/revert-scale-changes
Revert scale changes
2021-08-09 16:07:33 -07:00
Grant Sanderson
e151334675 Alternate fix to Decimal scaling issue 2021-08-09 16:06:19 -07:00
Grant Sanderson
bbeba108bc Merge branch 'master' of github.com:3b1b/manim into revert-scale-changes 2021-08-09 15:42:41 -07:00
Grant Sanderson
77ce17679c Change back to simpler Mobject.scale implementation 2021-08-09 15:42:32 -07:00
Grant Sanderson
7fa2654d8a Revert changes to Mobject.scale 2021-08-09 15:37:03 -07:00
Michael W
ec620fa849 Support the elliptical arc command for SVGMobject 2021-08-08 20:53:50 +08:00
鹤翔万里
da53a6f808 Merge pull request #1594 from slowy07/minor-fixing
fix: fix typo spelling grammar
2021-08-07 10:57:08 -05:00
slowy07
1e621e8278 fix: fix typo spelling grammar 2021-08-07 22:25:26 +07:00
Grant Sanderson
31119b630e Merge pull request #1592 from AStarySky/patch-1
fix put_start_and_end_on
2021-08-06 10:25:46 -07:00
AStarySky
b0fd520382 Update mobject.py
emmm i forgot to swap those
2021-08-04 23:38:21 +08:00
AStarySky
c1e14ef5b6 Update mobject.py 2021-08-04 23:32:59 +08:00
AStarySky
e9470b6bde Update mobject.py 2021-08-04 23:04:35 +08:00
AStarySky
5c0a1e4b76 fix put_start_and_end_on 2021-08-04 22:52:13 +08:00
Grant Sanderson
121e6215f8 Merge pull request #1591 from TonyCrane/improve-scale
Improve `Mobject.scale`
2021-08-03 13:37:18 -07:00
TonyCrane
3d5642f3d7 little improvement to Mobject.scale 2021-08-03 15:25:13 +08:00
TonyCrane
9df58e4ddf change version 2021-07-28 23:18:24 +08:00
TonyCrane
f09092024f Merge branch 'master' of https://github.com/3b1b/manim 2021-07-28 23:15:03 +08:00
TonyCrane
4d65c97965 allow sound_file_name to be taken in without extensions 2021-07-28 23:13:15 +08:00
TonyCrane
76966064ce update docs 2021-07-28 23:12:45 +08:00
Grant Sanderson
152d03ed27 Merge pull request #1587 from 3b1b/some1-video-changes
Some1 video changes
2021-07-28 07:54:27 -07:00
Grant Sanderson
8624168ed9 Merge branch 'master' into some1-video-changes 2021-07-28 07:53:04 -07:00
Grant Sanderson
354db4423f Merge pull request #1578 from nutanstrek/patch-1
Minor fix for zooming
2021-07-28 07:50:42 -07:00
Grant Sanderson
27344249de Merge pull request #1566 from pdcxs/patch-2
Add frame to the scene when initialization
2021-07-28 07:48:02 -07:00
Grant Sanderson
0b3a1b271c Merge pull request #1565 from 3b1b/fix-package-versioning
Transition build method to PEP 517
2021-07-28 07:47:18 -07:00
Grant Sanderson
fd8904ec83 Merge pull request #1557 from naveen521kk/add-markuptext
Add MarkupText
2021-07-28 07:45:50 -07:00
Grant Sanderson
7da6179493 Merge pull request #1586 from Wallbreaker5th/master
Fix triangulation
2021-07-28 07:43:42 -07:00
Grant Sanderson
17452dcd10 Changing plane defaults 2021-07-28 07:32:45 -07:00
Grant Sanderson
2f5acc6a87 Small refactor 2021-07-28 07:32:16 -07:00
Grant Sanderson
71f018dfff Add TrueDot 2021-07-28 07:31:31 -07:00
Grant Sanderson
b3ae517a05 Take in u_range and v_range as arguments to ParametricSurface 2021-07-28 07:31:10 -07:00
Grant Sanderson
f7bb5c1b8c If there is multisampling, don't have an antialias width 2021-07-28 07:30:13 -07:00
Grant Sanderson
a3227dda67 Small formatting fix 2021-07-28 07:29:43 -07:00
Wallbreaker5th
2ed78c6e0f Rewrite earclip_triangulation 2021-07-28 17:06:43 +08:00
TonyCrane
8aa004b0b1 use jsdelivr cdn for assets in docs 2021-07-18 22:22:52 +08:00
鹤翔万里
45938dd76f Merge pull request #944 from Lalourche/fix-counting
Fixed execution of counting.py
2021-07-17 22:19:23 -05:00
Darylgolden
3fe4d6d2d4 Add clarification on versions (#1580)
* Clarification on versions

* Grammar

* add clarification on package names

Co-authored-by: 鹤翔万里 <tonycrane@foxmail.com>
2021-07-18 10:58:48 +08:00
鹤翔万里
a18600e8a4 Merge pull request #1579 from Darylgolden/patch-1
Update Discord link
2021-07-17 21:51:33 -05:00
Darylgolden
700418a79c Update Discord link 2021-07-17 13:50:54 +08:00
Paras Sharma
4940ccac7d Minor fix for zooming
It's weird that when you Scroll Up, the interactive shell zooms out.

So to fix this replace factor -> 1/factor .
2021-07-14 13:56:20 +05:30
Grant Sanderson
17d7f0b6f0 Update README.md 2021-07-04 09:22:25 -07:00
Eric Brown
275cf94b06 Add frame to the scene when initialization
If we add an updater to the frame of the camera, and have not added the frame into the scene before, the updater will not work. So, I suggest to add the frame to the objects of the scene at the initilization stage.
2021-06-29 23:03:08 +08:00
TonyCrane
54fff5523b change default font size of ControlsExample 2021-06-29 20:55:25 +08:00
TonyCrane
5707585d17 fix typo 2021-06-26 17:45:21 +08:00
TonyCrane
0305582e64 update GitHub workflow 2021-06-26 12:37:57 +08:00
TonyCrane
a4c3bb03d1 update packaging method 2021-06-26 12:23:14 +08:00
TonyCrane
b00d718431 Merge branch 'master' of https://github.com/3b1b/manim 2021-06-21 13:38:41 +08:00
TonyCrane
6da5d4c8f6 update manim-kindergarten's link 2021-06-21 13:34:10 +08:00
sahilmakhijani
01670cf823 Fix ControlsExample Scene (#1551) 2021-06-20 15:37:06 +08:00
Naveen M K
5986d0e7d2 Add MarkupText
This would use a Pango specific markup which looks like html.

There are some specific implementation here about `<color>`
and `<gradient>`
Pango doesn't support `<gradient>`  or `<color> ` instead it works
with `color` attribute and gradient isn't supported.
Since, `SVGMobject` doesn't know about parsing colors from SVG image
and implmentation of `<color>` and `<gradient>` is added.

Co-authored-by: Philipp Imhof <52650214+PhilippImhof@users.noreply.github.com>
Signed-off-by: Naveen M K <naveen@syrusdark.website>
2021-06-20 01:13:13 +05:30
Grant Sanderson
d384fc1e27 Merge pull request #1552 from Wallbreaker5th/master
Temporary hack for showing text correctly
2021-06-19 09:53:24 -07:00
Grant Sanderson
8aedb8f33e Merge branch 'master' into master 2021-06-19 09:48:53 -07:00
Grant Sanderson
bccc17a3ac Merge pull request #1555 from 3b1b/revert-1543-master
Scale `Text` correctly | Revert "Fixed the default size of Text"
2021-06-19 09:30:40 -07:00
TonyCrane
892df54c9f remove lsh in OpeningManimExample 2021-06-19 20:13:41 +08:00
TonyCrane
663c57ba74 a little fix to TEXT_MOB_SCALE_FACTOR 2021-06-19 19:33:53 +08:00
TonyCrane
26e9b9cd7c added the missing import line in mobject.py 2021-06-19 18:30:23 +08:00
Wallbreaker5th
a99ccea02c Add some comments about the temporary hack 2021-06-19 16:00:39 +08:00
TonyCrane
892ce2db09 update docs 2021-06-19 13:21:25 +08:00
鹤翔万里
d14f22c5ba Revert "Fixed the default size of Text" 2021-06-19 13:11:36 +08:00
Grant Sanderson
846c10a0ff Merge pull request #1543 from TonyCrane/master
Fixed the default size of Text
2021-06-18 12:28:33 -07:00
Grant Sanderson
128178b46e Merge branch 'master' into master 2021-06-18 12:25:00 -07:00
Grant Sanderson
b4f23e8d8e Merge pull request #1553 from naveen521kk/fix-text
Scale Text Correctly
2021-06-18 12:14:32 -07:00
Naveen M K
5765ab9055 Move 0.3 constant to DEFAULT_LINE_SPACING_SCALE 2021-06-19 00:43:01 +05:30
Naveen M K
6eb7edc664 Scale Text Correctly
Change TEXT_MOB_SCALE_FACTOR value
Also deprecate `size` parameter

Also, now text isn't scaled when increasing font size
instead it is passed to the underlying enging
for handling. Though always a Text object is scaled
with a default value so that it fits the screen.

Signed-off-by: Naveen M K <naveen@syrusdark.website>
2021-06-18 17:59:15 +05:30
Wallbreaker5th
e836c3bb42 Temporary hack for showing text correctly 2021-06-18 14:43:09 +08:00
Grant Sanderson
5ff8e28ba5 Change suspend_mobject_updating default 2021-06-16 10:33:06 -07:00
Grant Sanderson
6dc1ecb00a Merge branch 'master' of github.com:3b1b/manim 2021-06-15 21:45:25 -07:00
Grant Sanderson
be78f5257a Ensure images used for textures are RGBA 2021-06-15 21:45:13 -07:00
Grant Sanderson
798479536d Merge pull request #1545 from TonyCrane/fix-example-scenes
Fix example scenes
2021-06-15 11:16:37 -07:00
TonyCrane
226df63d0b update doc videos 2021-06-15 19:54:53 +08:00
TonyCrane
b8fb69773e fix example scenes 2021-06-15 19:20:19 +08:00
TonyCrane
fec2306f9a update docs 2021-06-15 19:16:30 +08:00
TonyCrane
17d75bd336 Fixed the size of Text on different machines 2021-06-15 18:14:06 +08:00
鹤翔万里
23662d093f Merge branch '3b1b:master' into master 2021-06-15 17:48:25 +08:00
Grant Sanderson
34d4689672 Merge pull request #1541 from 3b1b/quick-eigen-video
Quick eigen video
2021-06-14 09:57:57 -07:00
Grant Sanderson
607ef334e9 Fix Lightbulb 2021-06-14 09:56:35 -07:00
Grant Sanderson
b4b4d39ec5 Fixes issues #1436 2021-06-14 09:55:40 -07:00
Grant Sanderson
1c2942798e Merge branch 'master' of github.com:3b1b/manim into quick-eigen-video 2021-06-14 09:54:20 -07:00
Grant Sanderson
e9ea5fbea0 Merge pull request #1481 from libinglong/lbl-fix-tex
fix issue #1480
2021-06-14 09:50:20 -07:00
Grant Sanderson
7ecfc041b3 Merge pull request #1538 from manim-kindergarten/shaders
Added some features including --config_file CLI flag and tip_style
2021-06-14 09:47:50 -07:00
Grant Sanderson
44a9c6337e Merge pull request #1530 from Wallbreaker5th/master
Modified the shaders slightly
2021-06-14 09:44:01 -07:00
Grant Sanderson
d1a5089acc Merge pull request #1529 from calvinpelletier/window_size_bug_fix
fix issue #1509
2021-06-14 09:42:41 -07:00
TonyCrane
9e5f39a4a9 update docs 2021-06-14 16:36:16 +08:00
TonyCrane
6da93cde7b clean .gitignore 2021-06-14 16:25:30 +08:00
TonyCrane
6340db1076 small improvement to config_file 2021-06-14 16:21:38 +08:00
TonyCrane
f45d81be11 some improvement to tip
rename tip_look to tip_style
set the default of tip_style to 0
2021-06-14 16:13:53 +08:00
鹤翔万里
baa2adc128 Merge branch '3b1b:master' into shaders 2021-06-14 13:49:49 +08:00
TonyCrane
f16277f100 some fixes of doc 2021-06-14 13:30:37 +08:00
TonyCrane
876f06cc37 add window_position to config guide 2021-06-14 08:29:38 +08:00
TonyCrane
f682bf97e3 Merge branch 'master' of https://github.com/3b1b/manim 2021-06-14 07:55:24 +08:00
TonyCrane
025639f026 update doc 2021-06-14 07:55:17 +08:00
widcardw
e885ec6ecd Fix the color of tip 2021-06-13 21:07:25 +08:00
GZTime
3b3150c3c5 Merge branch 'shaders' of https://github.com/manim-kindergarten/manim into shaders 2021-06-12 22:05:26 +08:00
GZTime
33aa4e979a Merge remote-tracking branch 'upstream/master' into shaders 2021-06-12 22:04:28 +08:00
鹤翔万里
9de7a6477d Merge branch '3b1b:master' into shaders 2021-06-12 22:00:08 +08:00
鹤翔万里
19b8057136 Merge pull request #1521 from naveen521kk/patch-1
requirements.txt: manimpango v0.3.0
2021-06-12 20:29:52 +08:00
鹤翔万里
b6dd6fe16d Merge pull request #1499 from jamilgafur/patch-1
Update quickstart.rst
2021-06-12 19:28:41 +08:00
鹤翔万里
51b2984ee3 Merge pull request #1488 from libinglong/lbl-fix-document
Fix document. Fix the mismatch between code and video
2021-06-12 18:31:43 +08:00
鹤翔万里
957eedc32c Merge pull request #1477 from giacomo-b/readme-fix
Update README.md
2021-06-12 18:21:08 +08:00
鹤翔万里
2614b34d11 Merge branch 'master' into readme-fix 2021-06-12 18:20:41 +08:00
鹤翔万里
4ea1d6d64f Merge pull request #1475 from CodingPower472/master
Fix typo in README
2021-06-12 18:18:18 +08:00
鹤翔万里
fd67858bb0 Merge pull request #1467 from alessandro-gentilini/patch-1
Typo
2021-06-12 18:06:03 +08:00
Wallbreaker5th
442e7fc14d Use focal_distance as camera_distance in shaders. 2021-06-05 17:43:32 +08:00
Wallbreaker5th
bb27a78449 fix: checking whether normal is facing the camera. 2021-06-05 17:33:54 +08:00
Calvin Pelletier
a06d5613f4 fix issue #1509 2021-06-04 17:07:41 -07:00
Naveen M K
6605ab75e8 requirements.txt: manimpango v0.3.0 is supported
it should work as there are no breaking changes for the API used here
I should bring in MarkupText here...
2021-05-24 22:25:08 +05:30
GZTime
ed9a4bd9eb Merge remote-tracking branch 'upstream/master' into shaders 2021-05-14 16:42:07 +08:00
Grant Sanderson
d54b796154 Change default to non-flat stroke 2021-05-07 16:07:49 -07:00
Grant Sanderson
bb72718c3b Merge branch 'master' of github.com:3b1b/manim 2021-04-28 08:51:09 -07:00
Grant Sanderson
d279272762 Small cleanup for TexMobject, and remove {{ }} separation convention 2021-04-28 08:50:50 -07:00
jamilgafur
f2f652f85d Update quickstart.rst
Removed extra left side curly bracket in embed section
2021-04-25 09:58:04 -05:00
libinglong
bf9d797d84 fix the mismatch between code and video 2021-04-20 15:59:07 +08:00
libinglong
29e5a8bc90 fix issue #1480 2021-04-17 22:30:08 +08:00
giacomo-b
02bad81fc3 Update README.md 2021-04-17 10:37:20 +02:00
CodingPower472
2bfe7e08ff Fix typo in README 2021-04-16 09:21:28 -06:00
widcardw
e727faaccb Add a custom style to ArrowTip. 2021-04-13 17:40:48 +08:00
GZTime
6b911f5721 Merge remote-tracking branch 'upstream/master' into shaders 2021-04-12 00:35:54 +08:00
鹤翔万里
565ff09d58 Update chinese docs' link 2021-04-11 19:24:40 +08:00
鹤翔万里
4b4a973464 Re-run Action 2021-04-11 19:21:43 +08:00
鹤翔万里
8e2799a499 Merge pull request #1469 from naveen521kk/patch-1
CI: install pango so that manimpango install
2021-04-11 19:18:46 +08:00
Naveen M K
a44e230a07 CI: install pango so that manimpango install
https://github.com/ManimCommunity/ManimPango/issues/53
2021-04-11 16:45:03 +05:30
Alessandro Gentilini
f9fb68c011 Typo 2021-04-10 14:18:47 +02:00
GZTime
c1ad893030 Fix a wrong function name. 2021-04-09 22:06:20 +08:00
GZTime
65d0826b91 Update config.py to load config file manually. 2021-04-09 21:32:52 +08:00
GZTime
41120b096e Add support for debugger launch 2021-04-09 20:17:21 +08:00
GZTime
1f6e911d60 Merge remote-tracking branch 'upstream/master' into shaders 2021-04-09 20:09:43 +08:00
Grant Sanderson
c45ff910f0 Remove double brace convention, since it causes errors with a number of tex strings 2021-04-08 14:46:03 -07:00
Grant Sanderson
15760cf253 Merge branch 'master' of github.com:3b1b/manim 2021-04-08 14:32:07 -07:00
Grant Sanderson
f6291d7e82 Merge pull request #1421 from naveen521kk/patch-6
update docs for linux installation
2021-04-08 14:23:28 -07:00
Grant Sanderson
b5e6177afd Merge pull request #1408 from Eisenwave/patch-1
Fix typo in README.md
2021-04-08 14:23:02 -07:00
Grant Sanderson
22d9c57f60 Merge pull request #1419 from JWro/patch-1
Fix init of Elbow super class
2021-04-08 14:22:47 -07:00
Grant Sanderson
3a992e136d Merge pull request #1437 from williamclavier/patch-1
Fix typo in example_scenes.py
2021-04-08 14:22:25 -07:00
Grant Sanderson
12ef0a26d7 Fix chaining animation in example scenes 2021-04-08 14:20:37 -07:00
Grant Sanderson
7a11e3d20f Merge pull request #1464 from 3b1b/matrix-exp-development
Matrix exp development
2021-04-08 14:18:25 -07:00
Grant Sanderson
cf63dfddf9 Fix Lighthouse 2021-04-08 14:14:32 -07:00
Grant Sanderson
42d8888f8e Allow any VMobject to be passed into TransformMatchingTex, so that slicing into Tex works 2021-03-31 23:28:49 -07:00
Grant Sanderson
322f138490 Add CameraFrame.reorient for quicker changes to frame angle 2021-03-31 23:27:12 -07:00
Grant Sanderson
df657c06c2 Add (admitedly silly) RADIANS constant 2021-03-31 23:26:35 -07:00
Grant Sanderson
0c61c908b2 Small fixes to Axes defaults 2021-03-31 23:26:10 -07:00
Grant Sanderson
82658e1db3 Change default element alignment for integer matrices 2021-03-31 23:25:43 -07:00
Grant Sanderson
de9ecbd766 Remove unnecessary import 2021-03-31 23:24:55 -07:00
Grant Sanderson
ca9f4357fa Allow configuration in Brace.get_text 2021-03-31 23:23:34 -07:00
Grant Sanderson
e95aa69c4c Change arg_separator default 2021-03-31 23:22:54 -07:00
Grant Sanderson
6997cc9501 Have Mobject.match_points return self 2021-03-27 11:57:50 -07:00
Grant Sanderson
7f47815230 Change some defaults and add Matrix.get_rows method 2021-03-27 11:56:58 -07:00
Grant Sanderson
d3e61b962b Have DecimalNumber match full family style when setting a new value 2021-03-27 11:56:36 -07:00
Grant Sanderson
8999ebb556 Also look for jpegs 2021-03-27 11:55:58 -07:00
Grant Sanderson
88f0c24c69 Decompose ellipse manipulations 2021-03-24 14:00:46 -07:00
Grant Sanderson
09579fcd3e Not a great long-term fix, but flipping should always refresh the triangulation 2021-03-24 13:58:52 -07:00
Grant Sanderson
01d989ba23 Fix a bug for off-center vector fields 2021-03-24 13:58:18 -07:00
Grant Sanderson
6c3e4b94ea Add min_scale_factor to keep Mobjects from shrinking to 0, and hence losing all shape information, unless its purposeful 2021-03-23 08:50:10 -07:00
Grant Sanderson
52baf5b7c2 Change matrix entry alignment default 2021-03-23 08:46:13 -07:00
Grant Sanderson
fd18e4a21f Fixed missing arg in self.get_parts_by_text 2021-03-19 10:55:04 -07:00
Grant Sanderson
2a1b023442 Merge branch 'master' of github.com:3b1b/manim into matrix-exp-development 2021-03-18 17:44:21 -07:00
Grant Sanderson
288983e7b9 Make sure mobject data gets unlocked after animations 2021-03-18 17:43:15 -07:00
Grant Sanderson
f6ff070a8e Add FlashAround and FlashUnder 2021-03-18 17:42:47 -07:00
Grant Sanderson
5126dd1f52 New defaults for FullScreenRectangle 2021-03-18 17:42:19 -07:00
Grant Sanderson
8345ca6160 Small fixes to NumberLine 2021-03-18 17:37:12 -07:00
Grant Sanderson
611ac7f448 Update to Cross to make it default to variable stroke width 2021-03-18 17:36:46 -07:00
Grant Sanderson
933b7fd3da Use Text not TexText for Brace 2021-03-18 17:35:23 -07:00
Grant Sanderson
15f3b359ae Added Text.get_parts_by_text 2021-03-18 17:34:57 -07:00
Grant Sanderson
0e326c7ac5 Return stroke_width as 1d array 2021-03-18 17:34:36 -07:00
Grant Sanderson
ed2e3e80d9 Updates to VectorField 2021-03-18 17:34:16 -07:00
Grant Sanderson
3c240478b8 Tiny format change 2021-03-18 17:33:20 -07:00
Grant Sanderson
120d26defa If chosen monitor is not available, choose one that does exist 2021-03-18 17:32:45 -07:00
William Clavier
5c427ea287 Fixed typo in example_scenes.py 2021-03-07 22:19:01 -05:00
Naveen M K
503bd116a6 link to manimpango 2021-03-01 12:11:44 +05:30
Naveen M K
f5d5565af1 Update installation.rst 2021-03-01 12:08:36 +05:30
Naveen M K
aedf5633aa update docs for linux installation 2021-02-26 22:31:22 +05:30
JWro
63b497c352 Fix init of Elbow super class 2021-02-26 10:46:19 +01:00
Grant Sanderson
531a031b50 Merge pull request #1415 from 3b1b/matrix-exp-development
Matrix exp development
2021-02-25 08:52:29 -08:00
Grant Sanderson
b48ce3f1de Remove whitespace 2021-02-25 08:48:50 -08:00
Grant Sanderson
5636b41dfd bug fix for resize_with_interpolation in the case of length=0 2021-02-25 08:48:41 -08:00
Grant Sanderson
402c06c99a Allow 3b1b_colormap as an option for get_colormap_list 2021-02-25 08:48:22 -08:00
Grant Sanderson
eec396681c Updated VectorField and StreamLines 2021-02-25 08:47:29 -08:00
Grant Sanderson
d06b3769b8 Added Mobject.set_color_by_rgba_func 2021-02-25 08:46:56 -08:00
Grant Sanderson
8fcb069808 Added some methods to coordinate system to access all axes ranges 2021-02-25 08:45:49 -08:00
Grant Sanderson
9fb6280f1d Added colormap 2021-02-25 08:45:15 -08:00
Grant Sanderson
e35f8466be Added VShowPassingFlash 2021-02-25 08:45:03 -08:00
Eisenwave
44df81fd70 fix typo 2021-02-24 18:35:22 +01:00
Grant Sanderson
d1fc6c8ed7 Merge branch 'master' of github.com:3b1b/manim 2021-02-23 12:01:00 -08:00
Grant Sanderson
9d1c8df095 Merge pull request #1398 from casperdcl/tqdm-fixes
progress fixes
2021-02-23 12:00:31 -08:00
Grant Sanderson
1d0b864001 Merge pull request #1395 from naveen521kk/patch-6
register_font is available for macOS
2021-02-23 11:59:42 -08:00
Grant Sanderson
5008e20b8e Tiny PEP fix 2021-02-23 11:59:08 -08:00
Casper da Costa-Luis
c92b6dbd0b correct ascii fallback 2021-02-19 17:04:29 +00:00
Casper da Costa-Luis
9c23a5feef remove unused requirement 2021-02-19 17:04:00 +00:00
Naveen M K
ba3bb64bce register_font is available for macOS
https://github.com/ManimCommunity/ManimPango/pull/26
2021-02-19 00:49:50 +05:30
Tony031218
448d792473 unspecify the version in setup.cfg 2021-02-15 12:56:58 +08:00
Tony031218
2f202e26b2 update docs for pip install 2021-02-15 12:23:53 +08:00
Tony031218
f9b1167d14 remove cairo dependency in docs 2021-02-14 23:16:50 +08:00
Tony031218
4179c1c3e9 fix bug in example_scenes 2021-02-14 23:12:25 +08:00
鹤翔万里
0c25b56afe Update 2021-02-14 21:30:08 +08:00
Tony031218
0f95e80798 update docs workflow 2021-02-14 21:23:51 +08:00
鹤翔万里
b7e2abb801 Merge pull request #1386 from cigar666/patch-2
Update changing.py
2021-02-13 21:15:24 +08:00
cigar666
1543450a4f Update changing.py
To fix the error of "AttributeError: 'TracedPath' object has no attribute 'n_points_per_cubic_curve'" (because in the CONFIG dictionary of VMobject class, the n_points_per_cubic_curve dose not exist, and now 'n_points_per_curve' is used instead)
2021-02-13 21:07:00 +08:00
Tony031218
c9e223485c fix Text incorrect coloring 2021-02-13 17:51:43 +08:00
Grant Sanderson
9bf51bda02 Remove unnecessary import 2021-02-12 13:34:50 -08:00
Grant Sanderson
a46b7d6931 Fix window size issue 2021-02-12 13:34:33 -08:00
Grant Sanderson
8f502f2790 Small style changes 2021-02-12 13:34:16 -08:00
Grant Sanderson
c30b535504 Small tweak to Example scene 2021-02-12 13:33:55 -08:00
Grant Sanderson
a5d5e40f6a Merge pull request #1383 from naveen521kk/manimpango
Use ManimPango for Text rendering
2021-02-12 13:15:40 -08:00
Syrus Dark
ad332c5863 Use manimpango for Text rendering 2021-02-12 12:28:08 +05:30
Grant Sanderson
96d9a66faf Merge branch 'master' of github.com:3b1b/manim 2021-02-11 19:31:16 -08:00
Grant Sanderson
368a6c3d1c Include from manimlib.mobject.interactive import * 2021-02-11 19:31:00 -08:00
Tony031218
0c3b401d34 fix docs 2021-02-12 09:21:14 +08:00
Grant Sanderson
9df136c723 Remove color definition redundancy 2021-02-11 12:24:06 -08:00
Grant Sanderson
e1e7b1e6c1 Changes to make reduce the time of from manimlib import * 2021-02-11 12:22:37 -08:00
Grant Sanderson
e7240547fb Small reorderings 2021-02-11 12:20:17 -08:00
Grant Sanderson
9158b7a0c2 Include from manimlib.window import * 2021-02-11 11:01:36 -08:00
Grant Sanderson
dba0550da5 Merge branch 'TonyCrane-package-improve' 2021-02-11 10:54:30 -08:00
Grant Sanderson
5df4e68f1b Remove from manimlib.mobject.interactive import * 2021-02-11 10:15:28 -08:00
Grant Sanderson
787b3be357 Make sure VMobject.set_fill returns self 2021-02-10 16:57:41 -08:00
Grant Sanderson
c700a27cad Remove alignment_vect, as per #1353 2021-02-10 16:49:23 -08:00
Grant Sanderson
d7f3f5ad24 Buf fixes for #1378 2021-02-10 16:45:23 -08:00
Grant Sanderson
1798875396 Call Window.init_mgl_context and reorder Window.__init__ 2021-02-10 14:48:00 -08:00
Grant Sanderson
0cd0a56243 Merge branch 'package-improve' of https://github.com/TonyCrane/manim into TonyCrane-package-improve 2021-02-10 14:00:25 -08:00
Grant Sanderson
6e2dcae4d7 Fix InteractiveDevlopmentExample bug 2021-02-10 13:54:01 -08:00
Grant Sanderson
17b2efeb71 Move where the Mobject.animate method lives 2021-02-10 13:49:09 -08:00
Grant Sanderson
4ff876b536 Merge pull request #1379 from friedkeenan/3b1b-animate
Add .animate syntax
2021-02-10 13:43:08 -08:00
friedkeenan
cbe24daa98 Fix mistake 2021-02-10 15:38:31 -06:00
Grant Sanderson
fdb6673238 Merge branch 'master' of github.com:3b1b/manim 2021-02-10 13:37:51 -08:00
Grant Sanderson
156b83c38e Change window size if it's passed in 2021-02-10 13:37:09 -08:00
friedkeenan
2d83cccc0a Merge 3b1b/master 2021-02-10 09:40:16 -06:00
friedkeenan
cfd32c79b1 Switch old syntax for animating methods to .animate syntax 2021-02-10 09:10:31 -06:00
friedkeenan
d24ba30fde Add .animate syntax 2021-02-10 07:43:46 -06:00
Tony031218
558f2652a4 fix typo in docs 2021-02-10 11:15:48 +08:00
Tony031218
de3916424f fix x/y_range of CoordinateSystem 2021-02-10 11:03:07 +08:00
Tony031218
3bf956871b update docs 2021-02-10 11:02:18 +08:00
Grant Sanderson
84f032610f Also search for images where the extension is passed in 2021-02-09 16:56:47 -08:00
Grant Sanderson
36e8421395 Let the user specify which monitor the window should show up in 2021-02-09 10:53:26 -08:00
Grant Sanderson
3770fae6cf Small change for readability 2021-02-09 10:52:45 -08:00
鹤翔万里
ddda43e03e update 2021-02-09 09:21:29 +08:00
Grant Sanderson
cb4b67655b Merge branch 'package-improve' of https://github.com/TonyCrane/manim into TonyCrane-package-improve 2021-02-08 10:01:26 -08:00
Tony031218
7c683c8992 updte default universal_import_line 2021-02-08 12:25:26 +08:00
Tony031218
6331f76c12 import numpy in example_scenes 2021-02-08 12:22:34 +08:00
Tony031218
944128d9bf adjust the order of arguments in config 2021-02-08 12:16:57 +08:00
Grant Sanderson
b374a07d76 Merge branch 'package-improve' of https://github.com/TonyCrane/manim into TonyCrane-package-improve 2021-02-07 20:05:20 -08:00
Tony031218
24d9d9e45d update docs 2021-02-08 12:04:29 +08:00
Tony031218
f0cbc0571f Update README 2021-02-08 11:42:50 +08:00
Tony031218
608b2d9bce delete comment 2021-02-08 10:46:11 +08:00
Tony031218
47d4b0236e readd default_config and improve config guide 2021-02-08 10:29:18 +08:00
Grant Sanderson
41a02285bd Small cleanup 2021-02-07 18:14:35 -08:00
Grant Sanderson
00e9c426ff Fix Surface.pointwise_become_partial bug 2021-02-07 18:14:23 -08:00
Tony031218
69235f0a21 remove non-manim lib in __init__.py 2021-02-08 09:55:30 +08:00
Grant Sanderson
e8f288f753 Fix for ShowCreation on SGroups, like Cube 2021-02-07 17:52:56 -08:00
Grant Sanderson
1084dfb681 Partial fix for Surface.pointwise_become_partial, and hence for ShowCreation() on surfaces 2021-02-07 17:46:04 -08:00
Grant Sanderson
12e8506841 Added example scenes for graphing and using CoordinateSystems 2021-02-07 17:31:31 -08:00
Grant Sanderson
f984443ed5 CoordinateSystem updates 2021-02-07 17:31:14 -08:00
Grant Sanderson
479aac1988 Add Line.get_projection method 2021-02-07 17:30:49 -08:00
Grant Sanderson
97e7b0568e Add default font_size to NumberLine.add_numbers 2021-02-07 17:30:31 -08:00
Grant Sanderson
9a79043640 Change threshold for treating quadratic bezier curves as lines 2021-02-07 17:29:45 -08:00
Grant Sanderson
4d644538b1 Merge branch 'package-improve' of https://github.com/TonyCrane/manim into TonyCrane-package-improve 2021-02-07 10:00:46 -08:00
Grant Sanderson
95191325e8 Merge branch 'master' of github.com:3b1b/manim 2021-02-07 09:56:40 -08:00
Grant Sanderson
700d7c6def Axes.get_v_line_to_graph and Axes.get_h_line_to_graph 2021-02-07 09:56:28 -08:00
Tony031218
36107c28ef update README 2021-02-07 21:43:20 +08:00
Tony031218
00fe33957c rename custom_defaults -> custom_config defaults -> default_config 2021-02-07 21:38:19 +08:00
Tony031218
cbe016391b delete old entry point file and add __init__ for folders 2021-02-07 17:48:51 +08:00
Tony031218
3fa68ad60c add config file to .gitignore 2021-02-07 17:46:33 +08:00
Tony031218
e3d09d161c add auto config guide 2021-02-07 17:45:18 +08:00
Tony031218
2394bdc2e6 refactor __init__.py and __main__.py 2021-02-07 17:43:05 +08:00
鹤翔万里
634c3d672e Merge pull request #3 from 3b1b/master
Update
2021-02-07 10:53:58 +08:00
Tony031218
b558ae98cf rename pypi package and entry_points 2021-02-07 10:27:41 +08:00
Grant Sanderson
e6fc323b6d Some changes to get_graph_label defaults 2021-02-06 11:39:39 -08:00
Grant Sanderson
c3ccfbfa65 re-introduce make_smoothing option 2021-02-06 11:39:19 -08:00
Grant Sanderson
6f69902892 Changed how configuration for labels on a NumberLine, and hence also on Axes, so that it takes in DecimalNumber configuration directly rather than as a separte dict. 2021-02-06 11:06:38 -08:00
Grant Sanderson
1a5a59f40e Merge branch 'master' of github.com:3b1b/manim 2021-02-06 10:37:26 -08:00
Grant Sanderson
2493458e45 Merge pull request #1364 from abhi-6988/fix-3d_vectors
Fix Vector orientation in 3d
2021-02-06 09:08:19 -08:00
Grant Sanderson
1ab60f1c3e Merge pull request #1362 from abhi-6988/fix-unit_size
Fix NumberLine's unit_size
2021-02-06 09:05:21 -08:00
Abhijith Muthyala
e677f4027a Fix Vector orientation in 3d 2021-02-06 21:28:53 +05:30
Abhijith Muthyala
03bea8198c Fix NumberLine's unit_size 2021-02-06 15:05:18 +05:30
Grant Sanderson
28650b27dc Move reconfigurable_scene.py to once_useful_constructs 2021-02-05 21:34:15 -08:00
Grant Sanderson
2c55f93512 Move (some) functionality from GraphScene to CoordinateSystem 2021-02-05 21:32:28 -08:00
Grant Sanderson
567e62de03 Remove unused min_samples argument 2021-02-05 21:30:38 -08:00
Grant Sanderson
a2f201f59e Small changes to Homotopy animations 2021-02-05 19:58:29 -08:00
Grant Sanderson
514301e0af Allow make_smooth and other kwargs for VMobject.apply_function 2021-02-05 19:58:02 -08:00
Grant Sanderson
71f328c7ef Factor out approximate smoothing to VMobject.make_approximately_smooth function 2021-02-05 19:48:43 -08:00
Grant Sanderson
66817c4e2b Add alternate smoothing options 2021-02-05 16:29:07 -08:00
Grant Sanderson
f87b82a9e9 Merge pull request #1336 from TonyCrane/publish
Package manimlib and automatically publish to pypi
2021-02-05 16:17:32 -08:00
Grant Sanderson
2a3db89a2d merge 2021-02-05 15:29:18 -08:00
Grant Sanderson
a63dd119c1 Change OpeningManimExample 2021-02-05 15:27:48 -08:00
Grant Sanderson
f786eb68d1 Change default decimal_number_config for NumberLine 2021-02-05 15:27:29 -08:00
Grant Sanderson
25cd846356 Fix and simplify get_smooth_quadratic_bezier_handle_points so that VMobject.make_smooth works better 2021-02-05 15:25:17 -08:00
Grant Sanderson
7a44d66ebc Merge pull request #1355 from TonyCrane/fix-numberline
Fix GraphScene and NumberLine
2021-02-05 14:51:47 -08:00
Grant Sanderson
4de31aba7f Merge pull request #1356 from sahilmakhijani/master
Fixed prompt_user_for_choice and added number support
2021-02-05 14:49:35 -08:00
Grant Sanderson
43614394a4 Set mob.make_smooth_after_applying_functions to True when preparing for a nonlinear transformation 2021-02-05 13:06:00 -08:00
Grant Sanderson
ed0ac3bee4 Updated README 2021-02-05 11:02:28 -08:00
Grant Sanderson
94894c0fe3 Merge pull request #1357 from parmentelat/master
handle_play_like_call decorator to use functools.wraps
2021-02-05 10:12:14 -08:00
Thierry Parmentelat
f05f94fbf5 spreading the change onto 2 more decorators 2021-02-05 11:52:21 +01:00
Thierry Parmentelat
e7251bcc2f handle_play_like_call decorator to use functools.wraps
this way, decorated methods - typically Scene.play - have a decent docstring
so first-time users can use help()
2021-02-05 11:10:17 +01:00
Sahil Makhijani
c0f6e94545 Removed unused import that was added by IDE autocomplete!! 2021-02-05 13:11:26 +05:30
Sahil Makhijani
390bfac9df prompt_user_for_choice now prompts for Scene Name or Number 2021-02-05 13:09:03 +05:30
Tony031218
269128dfb6 fix NumberLine and GraphScene 2021-02-05 13:57:00 +08:00
Grant Sanderson
8f52c7bda8 - 2021-02-04 12:37:16 -08:00
Grant Sanderson
5eafed2c31 Make ParametricSurface a subclass of Surface, and reframe other 3d mobjects to subclass Surface instead of ParametricSurface 2021-02-04 12:36:35 -08:00
Grant Sanderson
4b6a3a2599 Code cleanup 2021-02-04 12:35:45 -08:00
鹤翔万里
0e5423807c Merge pull request #1351 from pedrommaiaa/master
Grammar correction
2021-02-04 22:47:08 +08:00
Pedro Maia
60605e8442 Merge pull request #1 from pedrommaiaa/pedrommaiaa-patch-1
Grammar correction
2021-02-04 11:31:52 -03:00
Pedro Maia
b1efee5088 Grammar correction
mulziple -> multiple, line 35.
2021-02-04 11:30:13 -03:00
鹤翔万里
820e1840d3 Merge pull request #2 from 3b1b/master
Update
2021-02-04 11:27:43 +08:00
Grant Sanderson
10c1f054ca merge 2021-02-03 17:52:27 -08:00
Grant Sanderson
1727d4b86a Small hacky tweak to fix more triangulation issues 2021-02-03 17:52:11 -08:00
鹤翔万里
2d4ffc989e Merge pull request #1175 from Suji04/patch-1
Update imports.py
2021-02-04 09:37:28 +08:00
鹤翔万里
a45e0afe0e Merge pull request #1116 from kcheng0222/patch-1
Fixed typo from "depricated" to "deprecated"
2021-02-04 09:31:27 +08:00
Grant Sanderson
f13c41bcbb DotCloud improvements 2021-02-03 15:58:27 -08:00
Grant Sanderson
65f4f4bd29 Factor out computing bounding box 2021-02-03 15:58:16 -08:00
Grant Sanderson
521e3ef143 Include wait in the embed shortcut commends 2021-02-03 14:19:20 -08:00
Grant Sanderson
7dffa24acd Only reorient points for triangulation if the normal vector is not OUT 2021-02-03 14:18:58 -08:00
Grant Sanderson
0726dccd0a Ensure get_height, etc. all return positive values 2021-02-03 14:18:21 -08:00
Grant Sanderson
003fafc20f Unlock mobject data after Write 2021-02-03 14:17:55 -08:00
Grant Sanderson
d981ee47e2 Shouldn't transform between Text and TexText 2021-02-03 14:17:39 -08:00
Grant Sanderson
46294a5fad Fix aliasing issue on filled VMobject by calling get_unit_normal on reduced control points 2021-02-03 13:41:02 -08:00
Grant Sanderson
d7e63d907a Merge pull request #1305 from diracdeltafunk/patch-1
Fix typo in value_tracker.py
2021-02-03 12:34:55 -08:00
Grant Sanderson
afd1ef65f2 Merge pull request #1333 from asutoshgha/asutoshgha-patch-2
updated installation of manim on macOS
2021-02-03 12:33:58 -08:00
Grant Sanderson
5b9672bb59 Merge pull request #1328 from abhi-6988/fix-redundant_key
Replace redundant CONFIG key in NumberLine
2021-02-03 12:10:02 -08:00
Grant Sanderson
c2b2cb3b7e Merge pull request #1327 from techdude/master
Add CONFIG parameter to allow disabling smoothing on ParametricCurve
2021-02-03 12:09:33 -08:00
Grant Sanderson
c040dba835 Merge pull request #1338 from sahilmakhijani/master
Changed manim downloads location from default to custom_default config
2021-02-03 11:59:09 -08:00
Grant Sanderson
0a5414553f Merge pull request #1343 from TonyCrane/remove-samples
Remove samples
2021-02-03 10:58:30 -08:00
Grant Sanderson
6fde779944 Merge 2021-02-03 10:07:36 -08:00
Grant Sanderson
c8f4c49720 Yet another triangulation fix 2021-02-03 10:07:00 -08:00
鹤翔万里
5e3ed6f860 Merge pull request #1345 from samipism/master
Converted 0 to 0.0 in sdf() and angle_between_vectors()
2021-02-03 20:07:52 +08:00
Samip Poudel
5a16e3a358 Converted 0 to 0.0 in sdf() and angle_between_vectors() 2021-02-03 17:22:28 +05:45
鹤翔万里
fc6953e102 remove samples=1 in window.py 2021-02-03 17:17:55 +08:00
Grant Sanderson
3938f81c1b Performance improvements for Write and DrawBorderWithFill 2021-02-02 16:44:04 -08:00
Grant Sanderson
0c6149c9dd Minor cleanup to triangulation 2021-02-02 16:43:24 -08:00
Grant Sanderson
ddcd052036 Performance improvements for triangulation 2021-02-02 16:26:25 -08:00
Grant Sanderson
2fbe0c6ee6 Performance improvement for triangulation 2021-02-02 16:19:45 -08:00
Grant Sanderson
1097f0df96 Small cleanups 2021-02-02 15:56:55 -08:00
Tony031218
04a259950f update logo image address for better display on pypi 2021-02-03 07:55:39 +08:00
鹤翔万里
37f1130de6 Merge pull request #1 from 3b1b/master 2021-02-03 07:48:13 +08:00
Grant Sanderson
dda9683fb7 merge 2021-02-02 15:36:39 -08:00
Grant Sanderson
729dae1376 Fix triangulation issue for polygons with many holes 2021-02-02 15:35:03 -08:00
Sahil Makhijani
32632367b6 Changed manim downloads location from default to custom_default config 2021-02-03 00:04:30 +05:30
Grant Sanderson
46309e26c7 Merge pull request #1334 from TonyCrane/templates
Update templates of issues and pull requests
2021-02-02 10:04:11 -08:00
Grant Sanderson
dcffbe21d5 Merge pull request #1335 from sahilmakhijani/master
Refactored Event Handling Mechanism
2021-02-02 09:57:55 -08:00
Tony031218
c5b0040166 remove samples to reduce error on some machines 2021-02-02 22:06:23 +08:00
Tony031218
5b6997aea9 add workflow for uploading package to pypi 2021-02-02 21:34:15 +08:00
Tony031218
7a6a8556b8 add global default.yml for packaging 2021-02-02 21:23:16 +08:00
Tony031218
e4df135bbe update setup.cfg 2021-02-02 21:02:28 +08:00
Tony031218
9916f56fb1 fix a bug after packaging 2021-02-02 21:00:36 +08:00
Sahil Makhijani
74365065fe Merge remote-tracking branch 'upstream/master' 2021-02-02 16:05:47 +05:30
Sahil Makhijani
7b614bc968 Refactored Event Dispatching Mechanism 2021-02-02 16:04:50 +05:30
Sahil Makhijani
a4dbd0881b Renamed event folder to event handler 2021-02-02 16:02:10 +05:30
Sahil Makhijani
e9ec5e0c93 Added Concept of Event Listners and Event Dispatcher 2021-02-02 15:59:27 +05:30
Tony031218
143634742b revert changes which is in #1329 2021-02-02 16:56:41 +08:00
Tony031218
c32104b7ca revert changes which is in #1329 2021-02-02 16:53:08 +08:00
Tony031218
2d19ee8264 update PULL_REQUEST_TEMPLATE 2021-02-02 16:45:57 +08:00
Tony031218
f4c82b62af create config.yml and delete old template 2021-02-02 16:39:02 +08:00
鹤翔万里
55e8d3bc55 Update issue templates 2021-02-02 16:31:57 +08:00
鹤翔万里
be5762ba9c Update README.md 2021-02-02 16:17:18 +08:00
ASUTOSH GHANTO
3ec8bb0d28 Update README.md 2021-02-02 13:29:56 +05:30
ASUTOSH GHANTO
98a25eaefe Update README.md
asked changes were made
2021-02-02 13:24:40 +05:30
ASUTOSH GHANTO
fc01239c7a Update README.md
corrected my mistakes in readme
2021-02-02 11:36:01 +05:30
ASUTOSH GHANTO
331e5a1c21 Merge pull request #1 from asutoshgha/asutoshgha-patch-1
Update README.md
2021-02-02 09:13:19 +05:30
ASUTOSH GHANTO
0e80799b1f Update README.md
added content for macOSX
2021-02-02 09:11:42 +05:30
Grant Sanderson
fbb0d76f4f Merge pull request #1326 from sahilmakhijani/master
Interactive Mobjects Performance Improvements
2021-02-01 09:30:04 -08:00
Sahil Makhijani
2061f95ef5 Fixed ControlMobject Typo 2021-02-01 22:55:36 +05:30
鹤翔万里
82eb0ae5be change 0 to 0.0 in quadratic_bezier_fill/frag.glsl 2021-02-01 22:56:03 +08:00
鹤翔万里
5cc30df2ac change 0 to 0.0 in quadratic_bezier_stroke/geom.glsl 2021-02-01 22:55:40 +08:00
Abhijith Muthyala
fb8280171b Replace redundant CONFIG key in NumberLine 2021-02-01 12:25:11 +05:30
techdude
fc482c107f Merge branch 'master' of https://github.com/techdude/manim 2021-01-31 18:52:17 -07:00
techdude
384304e92b Add CONFIG parameter to allow disabling smoothing 2021-01-31 18:48:48 -07:00
Sahil Makhijani
fdcac10861 Commented out self.embed in ControlsExample 2021-02-01 01:41:37 +05:30
Tony031218
fe85d4e02f update icon 2021-01-31 22:32:57 +08:00
Tony031218
8f9ce57de5 update custom_default doc and fix a list 2021-01-31 22:29:19 +08:00
Tony031218
1253c18c54 update example_scenes for AnimatingMethods 2021-01-31 22:03:53 +08:00
Tony031218
3dc0c7b0cb fix search 2021-01-31 21:38:14 +08:00
Tony031218
09ae714edb fix
add a link to Chinese version in home page

fix a list wrong display

fix color list
2021-01-31 21:37:53 +08:00
Sahil Makhijani
d6b23324a6 Interactive Mobjects Performance Improvements 2021-01-31 16:05:55 +05:30
Grant Sanderson
b63ba1c7a4 Merging master (to record a merge) 2021-01-30 23:30:37 -08:00
Grant Sanderson
b00c93dc88 Add AnimatingMethods examples 2021-01-30 22:51:34 -08:00
Grant Sanderson
5fb06e77b5 Don't save triangulations to file, as this introduces unwanted errors 2021-01-30 22:51:15 -08:00
Grant Sanderson
d5d13c3174 Updated TexTransformExample.mp4 and UpdatersExample.mp4 2021-01-30 22:22:35 -08:00
Grant Sanderson
9b3332ad02 Update changed example scenes in docs 2021-01-30 22:20:37 -08:00
Grant Sanderson
3c0f8abe5f Only display writing message when a new tex file is actually being written 2021-01-30 22:12:44 -08:00
Grant Sanderson
53cfbacab4 Improve how brace sets its width 2021-01-30 22:11:48 -08:00
Grant Sanderson
e3b74ffd7a Remove unecessary lines 2021-01-30 22:11:23 -08:00
Grant Sanderson
52dd06ce6f Allow always_redraw to take in arguments 2021-01-30 22:10:58 -08:00
Grant Sanderson
90293f3907 Refresh bounding box after Mobject.become 2021-01-30 22:10:32 -08:00
Grant Sanderson
32e5b2b4b1 Change updater example 2021-01-30 22:10:09 -08:00
Grant Sanderson
c292046913 Have DecimalMobject use Text instead of Tex 2021-01-30 18:13:38 -08:00
Grant Sanderson
73edeaa153 Fix TexTransformExample 2021-01-30 17:52:02 -08:00
Grant Sanderson
375bc2073d Include save_state and restore as shortcut methods during an embed 2021-01-30 17:51:40 -08:00
Grant Sanderson
b353c4f21c Change comment 2021-01-30 17:51:14 -08:00
Grant Sanderson
367e243066 Align families in a way that respects their family heirarchy depth 2021-01-30 17:50:59 -08:00
Grant Sanderson
5a2a363a87 Some cleanup for interactive mobjects 2021-01-28 12:26:05 -08:00
Grant Sanderson
baab9ddf02 Included fix for Text(%), though the underlying bug for rending these persists. 2021-01-28 12:01:49 -08:00
Grant Sanderson
c1ebb583c8 Merge pull request #1323 from sahilmakhijani/shaders
Interactive Mobjects in Manim
2021-01-28 11:59:12 -08:00
Grant Sanderson
696e952a3a Merge pull request #1320 from TonyCrane/shaders
Add documentation for shaders version
2021-01-28 11:53:03 -08:00
Sahil Makhijani
a3754fa606 Interactive Mobjects added 2021-01-28 14:02:43 +05:30
Tony031218
5de62edfb8 update workflow 2021-01-27 10:45:06 +08:00
Tony031218
c39d208ff0 update workflow 2021-01-26 23:13:22 +08:00
Tony031218
a47b7c6bae add icon 2021-01-26 23:06:29 +08:00
Tony031218
4aa6be6e55 add pycairo to env 2021-01-26 22:57:32 +08:00
Tony031218
f900669bc4 fix bugs and update README 2021-01-26 22:56:54 +08:00
Tony031218
06ba7031c7 finish example scenes 2021-01-26 20:52:17 +08:00
Tony031218
2fd4d7a2c4 finish config, structure, constants and custom_default 2021-01-26 14:57:05 +08:00
Tony031218
cd79151c10 finished Quick Start 2021-01-25 19:53:44 +08:00
Tony031218
a7697095d6 finish development category and improve style 2021-01-25 10:20:41 +08:00
Tony031218
42c59f80c8 create manim_example_ext 2021-01-24 23:22:11 +08:00
Tony031218
c68bf1c8f7 change theme 2021-01-24 19:44:48 +08:00
Tony031218
ddcfd01fa3 add manimlib to path 2021-01-24 16:03:18 +08:00
Tony031218
bb62ff4cd6 set up structure 2021-01-24 14:51:06 +08:00
鹤翔万里
c0852eae88 Fix Action Workflow (#5) 2021-01-24 14:06:44 +08:00
Tony031218
4494d80a4c fix path for sphinx-build 2021-01-24 11:44:39 +08:00
Tony031218
14cbfc0423 update structure 2021-01-24 11:33:49 +08:00
Tony031218
539f3b095a set up Action workflow to build up docs 2021-01-24 11:31:46 +08:00
Tony031218
5dbc7d807f set up docs 2021-01-24 09:49:29 +08:00
Grant Sanderson
d04d451c6a Allow alignment/interpolation/etc. between mobjects with different data keys 2021-01-23 16:19:16 -08:00
Grant Sanderson
a58772db87 Fix writing to gifs 2021-01-23 16:08:39 -08:00
Grant Sanderson
0ac155d150 Making writing to partial movies optional, and set the default to be False. 2021-01-23 11:02:22 -08:00
Grant Sanderson
090743aacb Fix how sound files are found 2021-01-23 11:02:02 -08:00
鹤翔万里
9bd4f6714f Merge pull request #4 from 3b1b/shaders
Update
2021-01-22 19:34:49 +08:00
Grant Sanderson
e4f888fbc4 Improved scrolling 2021-01-19 14:12:25 -08:00
Grant Sanderson
e08784400a Reduce the need to type 'self.' so much when embedding into a scene. 2021-01-19 13:52:57 -08:00
Grant Sanderson
20b787223b Rename get_position -> find_initial_position 2021-01-19 11:36:28 -08:00
Grant Sanderson
9a502cd83b Move window position logic into window 2021-01-19 11:35:25 -08:00
Grant Sanderson
78ac18496d Fix CameraFrame interpolation 2021-01-18 16:44:04 -08:00
Grant Sanderson
59af903f14 Reorganize the interaction between CameraFrame and shader perspective transforms, along with some keyboard interactions for panning 2021-01-18 16:39:29 -08:00
Grant Sanderson
e218105f73 Merge custom defaults recursively rather than overriding manim's with the local one 2021-01-18 10:58:33 -08:00
Grant Sanderson
f91c81dd6a Rename TexMobject -> Tex and TextMobject -> TexText 2021-01-18 08:20:14 -10:00
Grant Sanderson
3bd56bff07 Replace TextMobject with Text in opening example 2021-01-18 08:13:41 -10:00
Grant Sanderson
68a8114d7a Remove unused Rectangle import 2021-01-18 08:13:18 -10:00
Grant Sanderson
9c524fe3a7 Be sure Mobject.set_points and Mobject.set_data returns self 2021-01-18 08:06:33 -10:00
Grant Sanderson
b3c8940a18 Bug fix to Mobject.align_family and Mobject.add_n_more_submobjects 2021-01-18 08:06:12 -10:00
Grant Sanderson
1b1b138860 Merging #1316 2021-01-17 17:24:08 -10:00
Grant Sanderson
19e93454d9 Merge pull request #1316 from TonyCrane/shaders
Improve Text's handling of non-display characters in shaders and Add a feature
2021-01-17 19:22:11 -08:00
Grant Sanderson
86bfa4c39c Improvements to DotCloud 2021-01-17 13:40:52 -10:00
Tony031218
cfa8577454 add PyOpenGL packages in requirements.txt and environment.yml 2021-01-16 11:22:34 +08:00
Tony031218
b7bd40a6f6 make window_position changeable 2021-01-16 10:46:30 +08:00
Tony031218
453ccc2765 remove unnecessary comment 2021-01-16 10:23:11 +08:00
Tony031218
f6b5edede2 reduce annoying errors 2021-01-16 10:21:42 +08:00
Tony031218
3d118a5bb6 change the method of reset submobjects 2021-01-16 10:20:41 +08:00
Tony031218
314c847463 remove unused NOT_SETTING_FONT_MSG 2021-01-16 09:40:05 +08:00
Tony031218
7f27e926f2 replace single quotes with double quotes 2021-01-16 09:37:54 +08:00
Tony031218
5f6b653803 improve Text's handling of non-display characters 2021-01-16 09:35:13 +08:00
鹤翔万里
83a9217063 Merge pull request #3 from 3b1b/shaders
Update
2021-01-16 08:46:48 +08:00
Grant Sanderson
2daf62ecea Add notes to SurfaceExample 2021-01-15 11:11:07 -10:00
Grant Sanderson
c698c6ea44 Fix Point.set_location 2021-01-15 11:10:57 -10:00
Grant Sanderson
4e4a7b9886 Have background rectangle match background color by default 2021-01-15 10:20:50 -10:00
Grant Sanderson
b423a423b5 Make customization more accessible 2021-01-15 10:16:37 -10:00
Grant Sanderson
d37de184d2 Set gamma properly 2021-01-15 09:27:51 -10:00
Grant Sanderson
bec3ba70eb Merge pull request #1315 from Tony031218/shaders
Fix some bugs of the shaders branch
2021-01-15 11:13:33 -08:00
Grant Sanderson
08e22cf859 Bug fix to apply_points_function 2021-01-15 09:02:07 -10:00
Grant Sanderson
1f3b058aa9 Simplify Point.set_location 2021-01-15 08:55:40 -10:00
Grant Sanderson
d4c89e520f Reorganize methods and how triangulation gets refreshed 2021-01-15 08:55:19 -10:00
Tony031218
7c04edcced improve Text's size 2021-01-15 23:39:24 +08:00
Tony031218
97ecfcda9b remove media_dir.txt in scene/ 2021-01-15 22:57:22 +08:00
Tony031218
c6fcaa93bb remove stream_starter 2021-01-15 22:49:11 +08:00
Tony031218
fa3cad18e0 update requirements.txt and environment.yml 2021-01-15 21:47:19 +08:00
Tony031218
f696ba4100 add an example for Text 2021-01-15 21:11:17 +08:00
Tony031218
1d1706039e remove an unnecessary import 2021-01-15 20:25:17 +08:00
Tony031218
78848b971c fix a wrong usage of logging.log 2021-01-15 20:21:17 +08:00
Tony031218
79b8136330 fix Text in shaders 2021-01-15 20:21:17 +08:00
Grant Sanderson
f314054081 Small cleanup/reorganizing of Mobject methods 2021-01-14 15:07:35 -10:00
Grant Sanderson
7b67f4556b Reorganize Mobject methods and remove ones that are not longer needed 2021-01-14 14:15:58 -10:00
Grant Sanderson
8f6b006cc8 Speeds up Mobject.get_center and Mobject.get_corner 2021-01-14 09:31:41 -10:00
Grant Sanderson
281b38b860 Small fixes to make sure storing the bounding box works 2021-01-14 01:38:40 -10:00
Grant Sanderson
f90e4147b6 Save bounding box information, which speeds up most mobject manipulations 2021-01-14 01:01:43 -10:00
Grant Sanderson
d53dbba346 Always call super for init_data 2021-01-14 01:01:13 -10:00
Grant Sanderson
098b939ec0 Specify default about_edge for Rotate 2021-01-14 01:00:53 -10:00
Grant Sanderson
8b83c5e27d Performance improvement for Write 2021-01-13 11:55:45 -10:00
Grant Sanderson
2c27511556 Remove null_point_align 2021-01-13 11:55:26 -10:00
Grant Sanderson
9f5f682351 Factor out get_num_string 2021-01-13 11:11:25 -10:00
Grant Sanderson
39cdae0983 Match uniforms in Mobject.become 2021-01-13 10:23:42 -10:00
Grant Sanderson
b40a3b5710 Buf fix with Arrow 2021-01-13 09:28:52 -10:00
Grant Sanderson
38b305bb19 Fix issue with pointwise_become_partial 2021-01-13 09:21:22 -10:00
Grant Sanderson
8cc484943e Remove note 2021-01-13 09:21:00 -10:00
Grant Sanderson
d29cfd842f Iterations and indexing into mobject should only look at submobjects, none of this sometimes self is included and sometimes it isn't business 2021-01-13 09:20:47 -10:00
Grant Sanderson
2e3a112ff8 Treat Matrix.mob_matrix as list rather than numpy matrix, since it sometimes interprets mobjects as sequences 2021-01-13 09:20:11 -10:00
Grant Sanderson
d65a915e7b Initialize colors properly with new TexMobject structure 2021-01-13 08:18:24 -10:00
Grant Sanderson
5f69899e65 Fix bug where all members of a family pointed to the same rgba array 2021-01-13 08:17:43 -10:00
Grant Sanderson
5e09a80c5b Bug fix, call super().finish() 2021-01-13 00:35:57 -10:00
Grant Sanderson
f61dfe7948 Tiny change 2021-01-13 00:35:39 -10:00
Grant Sanderson
bf3571c103 Have DecimalMobject look to the same cache that TexMobjects do 2021-01-13 00:24:40 -10:00
Grant Sanderson
20593d8fa8 Change how DecimalNumber.set_value works so that it's not creating new instances each time 2021-01-13 00:12:08 -10:00
Grant Sanderson
6537258f24 Cache already computed TexMobjects 2021-01-13 00:11:27 -10:00
Grant Sanderson
fda7fff146 Allow caching of shader program code 2021-01-13 00:10:17 -10:00
Grant Sanderson
00333d0a4d Bug fix 2021-01-13 00:09:56 -10:00
Grant Sanderson
ad60b903d0 Allow configuration of VMobjectFromSVGPathstring from SVGMobject 2021-01-13 00:09:36 -10:00
Grant Sanderson
091cd355d4 Clean up trash from ChangingDecimal 2021-01-13 00:09:10 -10:00
Grant Sanderson
dd2a459eaa Refresh shader data before aligning new data 2021-01-13 00:08:40 -10:00
Grant Sanderson
c5aa330077 Small bug fix to Write 2021-01-13 00:07:58 -10:00
Grant Sanderson
bbe79e0026 Tiny comment 2021-01-12 16:08:35 -10:00
Grant Sanderson
7af100489b Include font_size in data 2021-01-12 13:08:24 -10:00
Grant Sanderson
f1c32b64cc Default to apply animations over family rather than family_members_with_points 2021-01-12 13:08:01 -10:00
Grant Sanderson
cc094dd479 Remove ZoomedScene 2021-01-12 12:35:45 -10:00
Grant Sanderson
ab0d5c58d4 Remove ZoomedScene 2021-01-12 12:35:16 -10:00
Grant Sanderson
4abf93e2aa Remove MovingCameraScene 2021-01-12 12:33:59 -10:00
Grant Sanderson
7c8162a6f7 Delete deprecated camera classes 2021-01-12 12:26:08 -10:00
Grant Sanderson
c4f190cfc4 Replace .points with ._points 2021-01-12 12:25:12 -10:00
Grant Sanderson
d60ec48591 Track/interpolate uniforms the same way data is 2021-01-12 12:15:32 -10:00
Grant Sanderson
ba8fb4a6b7 check_data_alignment by default 2021-01-12 11:21:57 -10:00
Grant Sanderson
ca1c2f7797 Return unit normal as 1d vector 2021-01-12 11:13:41 -10:00
Grant Sanderson
0d238417cb Allow locking data to speed up some animations 2021-01-12 11:09:53 -10:00
Grant Sanderson
ddfc3a6567 Replace lingering .points references 2021-01-12 07:27:32 -10:00
Grant Sanderson
6b29691e0e Allow setting of multiple colors/opacities/stroke_widths 2021-01-11 17:52:48 -10:00
Grant Sanderson
6b451dcc22 Allow Mobject.get_family(recurse) for common recursive methods 2021-01-11 17:03:12 -10:00
Grant Sanderson
4d9498322e Push more color functionality to Mobject 2021-01-11 16:37:51 -10:00
Grant Sanderson
d1b888958b Save triangulation along with points 2021-01-11 16:37:01 -10:00
Grant Sanderson
d6a00bc32d Don't call np.resize when length shouldn't change 2021-01-11 16:36:42 -10:00
Grant Sanderson
c408adeefa Rework DotCloud and PMobject for new data structure 2021-01-11 12:40:21 -10:00
Grant Sanderson
a5dd08cca7 Whoops, this shouldn't be here 2021-01-11 12:39:55 -10:00
Grant Sanderson
30dc8176ff Remove append_points from VMobject, as it's now up in Mobject 2021-01-11 12:39:45 -10:00
Grant Sanderson
96fbac85ad Setup Image/Surface for new data formatting 2021-01-11 12:39:14 -10:00
Grant Sanderson
9314dfd933 Reframe Mobject, VMobject and SurfaceMobject with a data map 2021-01-11 10:57:23 -10:00
Grant Sanderson
b3335c65fb Partial progress 2021-01-10 18:51:47 -08:00
Grant Sanderson
fb0de62ef4 Slight change to colormap 2021-01-10 14:12:15 -08:00
Grant Sanderson
bf73938fd1 Move joint type map to constants 2021-01-10 14:10:31 -08:00
Grant Sanderson
8d14b66583 Fix previous commit 2021-01-10 08:38:47 -08:00
Grant Sanderson
92b0953081 Move around where colormap code lives 2021-01-10 08:35:06 -08:00
Grant Sanderson
e98ebfe9e1 Rename add_light -> finalize_color and leave room for other color manipulations 2021-01-09 22:11:38 -08:00
Grant Sanderson
889acea380 Use matplotlib colormaps 2021-01-09 22:10:40 -08:00
Grant Sanderson
0b41457d4e Remove COLORMAPS 2021-01-09 22:09:02 -08:00
Grant Sanderson
fdcc8d4257 Add ability to manipulate a mobjects shader code from python, and in particular to give it a coloring function, e.g. with Mobject.set_color_by_xyz_func 2021-01-09 18:52:54 -08:00
Grant Sanderson
a7af5e72c6 Added Mobject.get_grid 2021-01-09 10:48:45 -08:00
Grant Sanderson
677d609870 Tiny chantges 2021-01-09 10:30:42 -08:00
Grant Sanderson
a429a146c7 Fix how stroke is scaled for perspective 2021-01-09 10:30:11 -08:00
Grant Sanderson
ac4755459a Clamp perspective_scale_factor 2021-01-09 10:29:45 -08:00
Grant Sanderson
ff37b589ff Remove import 2021-01-09 10:26:20 -08:00
Grant Sanderson
81e359d22e Tie focal distance to camera fram height 2021-01-09 10:25:59 -08:00
Grant Sanderson
632c35daef Fix bugs in stroke shader for 3d scenes 2021-01-08 22:28:34 -08:00
Grant Sanderson
f47f848236 Change default focal distance as positioning function changes 2021-01-08 22:28:13 -08:00
Grant Sanderson
cb87912203 Remove import 2021-01-08 22:27:15 -08:00
Grant Sanderson
9a1e103a7f Introduce flat_stroke uniform 2021-01-08 22:26:47 -08:00
Grant Sanderson
8c7e93f829 Change to pan by scrolling 2021-01-08 22:26:14 -08:00
Grant Sanderson
488387f1de Add to OpeningManimExample 2021-01-07 16:38:08 -08:00
Grant Sanderson
7db1f7786a Remove unused import 2021-01-07 16:37:35 -08:00
Grant Sanderson
067f25d4b8 Make it so you can pass in x_range and y_range to NumberPlane 2021-01-07 16:37:23 -08:00
Grant Sanderson
42a3c56898 Limit how much is shown in display_during_execution 2021-01-07 16:37:01 -08:00
Grant Sanderson
7b8677fd6c Push all mention of the #INSERT convention to a note in the insert file 2021-01-07 16:16:20 -08:00
Grant Sanderson
5eee39803f Rename get_tex_string -> get_tex 2021-01-07 12:14:51 -08:00
Grant Sanderson
6259d1c897 Update TexTransformExample 2021-01-07 12:11:58 -08:00
Grant Sanderson
60c03831fb Simplify split_string_to_isolate_substrings, even though it's currently not used anywhere 2021-01-07 12:11:44 -08:00
Grant Sanderson
9122aa2419 Cleaned up TexMobject.break_up_tex_strings 2021-01-07 12:07:27 -08:00
Grant Sanderson
007680a183 Rename substrings_to_isolate to simply isolate, and fix a bug associated with rendering sqrt{ 2021-01-07 11:50:15 -08:00
Grant Sanderson
c2b5595fae If replacing a null mobject, just scale by 0 2021-01-07 11:49:03 -08:00
Grant Sanderson
5939f24cd4 Added key_map option and made key methods static 2021-01-07 11:48:16 -08:00
Grant Sanderson
cfe61a35af Remove old 3d scene material and at stubs for potential new methods 2021-01-07 10:45:28 -08:00
Grant Sanderson
c1298bdffd Add some more explanation to TexTransformExample 2021-01-06 16:14:55 -08:00
Grant Sanderson
e187728f0c Add transform_mismatches option 2021-01-06 16:14:36 -08:00
Grant Sanderson
4a19c48667 strip tex strings so that they're easier to match 2021-01-06 16:14:16 -08:00
Grant Sanderson
63692ed59a Remove unused requirements 2021-01-06 14:24:17 -08:00
Grant Sanderson
4ba5e733fb Change example scene referenced in readme 2021-01-06 14:24:05 -08:00
Grant Sanderson
20f5ba409f A few improvements to mouse interactions 2021-01-06 12:48:58 -08:00
Grant Sanderson
c65a7fb340 Add Window.is_key_pressed method 2021-01-06 12:47:13 -08:00
Grant Sanderson
b13b94938a Remove no-longer-needed hack for pixel_coords_to_space_coords 2021-01-06 12:46:46 -08:00
Grant Sanderson
825d6bdc5c Add higher resolution earth texture 2021-01-06 12:46:16 -08:00
Ben Spitz
2451f024f6 Fix typo in value_tracker.py
"Note meant to be displayed" -> "Not meant to be displayed"
2021-01-06 12:21:49 -08:00
Grant Sanderson
62bb40a7df Change seek_full_path_from_defaults to find_file, and make it a more general function which will find and download urls if needed. This means for images/textures/etc. one can point online 2021-01-06 10:39:34 -08:00
Grant Sanderson
065df65cf1 Reorganize how shader files sit in the shaders folder 2021-01-05 23:14:16 -08:00
Grant Sanderson
6486938c59 Remove media_dir configuration, as that is covered by video_dir 2021-01-05 22:38:25 -08:00
Grant Sanderson
9d7b2873bb Correct resolution description 2021-01-05 22:38:09 -08:00
Grant Sanderson
3c1ab6ce25 Simple cleanup and removal of unused functions 2021-01-05 22:37:28 -08:00
Grant Sanderson
446a69f7c0 Remove import 2021-01-05 22:10:08 -08:00
Grant Sanderson
5b454a3ff7 Remove rotate_in_place and scale_in_place methods, as they had the same functionality as rotate and scale 2021-01-05 22:05:15 -08:00
Grant Sanderson
9ee1a526ed Added new example scenes and cleaned up the couple of old ones 2021-01-05 22:04:49 -08:00
Grant Sanderson
06f0374143 Fix typo bug and change default alignment for text 2021-01-05 22:04:16 -08:00
Grant Sanderson
dde085094f Refresh triangulation after general functions 2021-01-05 22:00:52 -08:00
Grant Sanderson
f07bd23235 Rename apply_points_function_about_point -> apply_points_function 2021-01-05 21:58:43 -08:00
Grant Sanderson
c0b90b398c Add TransformMatchingShapes and TransformMatchingTex 2021-01-05 18:03:06 -08:00
Grant Sanderson
92386f4e20 Cleanup how tex_strings are handled, introducing the ability to simply surround substrings of the input with {{ and }} in order to make sure they are separated 2021-01-05 18:02:32 -08:00
Grant Sanderson
38f9686d68 Ammend FadeInFromPoint and add FadeOutToPoint 2021-01-05 18:01:23 -08:00
Grant Sanderson
349a9c9cea Add VMobject.get_opacity 2021-01-05 18:00:55 -08:00
Grant Sanderson
556ffb192f In add_n_more_submobjects, for the benefit of align_submobjects, make it so that new copies are only ghosted out if there is some transparency at play 2021-01-05 18:00:34 -08:00
Grant Sanderson
bfa36a7659 Discard frag shader outside dot radius 2021-01-05 09:57:18 -08:00
Grant Sanderson
2d709758d0 Added TransformMatchingParts for smarter tex transforms 2021-01-04 23:09:29 -08:00
Grant Sanderson
509f3db371 Change so that lambda is not given a name 2021-01-04 23:09:03 -08:00
Grant Sanderson
bc95013ab4 Only need to align submobjects 2021-01-04 23:08:25 -08:00
Grant Sanderson
8644d71820 Improve defaults for Lines/Arrows pointing between two mobjects 2021-01-04 17:25:05 -08:00
Grant Sanderson
2cdebeda29 Add slice_by_tex method 2021-01-04 16:01:04 -08:00
Grant Sanderson
a6d484236c Add DotCloud to universal imports 2021-01-04 14:55:55 -08:00
Grant Sanderson
131794e53c Change DotCloud initialization 2021-01-04 14:55:42 -08:00
Grant Sanderson
a4ea4791e7 Added DotCloud type 2021-01-04 13:26:58 -08:00
Grant Sanderson
6c0f00b4a1 Reimplement stretch_array_to_length 2021-01-04 13:26:29 -08:00
Grant Sanderson
c87b2e272b Tiny change 2021-01-04 13:26:14 -08:00
Grant Sanderson
31e6aa2ae0 Use super() 2021-01-04 13:25:42 -08:00
Grant Sanderson
369a7fc455 Change it so that reset points is not necessarily called on mobject initialization 2021-01-04 13:25:04 -08:00
Grant Sanderson
e2fc0ab1aa Remove unnecessary import 2021-01-03 17:58:01 -08:00
Grant Sanderson
494f1899fd Make it so that FadeTransform returns moving mobject to its original state 2021-01-03 17:57:43 -08:00
Grant Sanderson
b22f1ab715 Remove reference to FILE_DIR 2021-01-03 17:25:37 -08:00
Grant Sanderson
156ea11537 Fix the but for transforming between VMobjects with different triangulations. Turns out this is all that's needed 2021-01-03 17:17:20 -08:00
Grant Sanderson
baff788217 Tiny line consolidation 2021-01-03 17:16:19 -08:00
Grant Sanderson
e43b8ef4e4 Remove prepare_for_animation 2021-01-03 17:16:08 -08:00
Grant Sanderson
b8b44f062c Added FadeTransform and FadeTransformPieces 2021-01-03 16:53:49 -08:00
Grant Sanderson
504f5c4329 Minor tweak to comment, etc. 2021-01-03 16:53:29 -08:00
Grant Sanderson
a4b8a8d88c Get rid of old fading classes 2021-01-03 14:39:45 -08:00
Grant Sanderson
afebc29440 Remove container 2021-01-03 12:29:05 -08:00
Grant Sanderson
148afc29aa Change default number of samples for 3d camera 2021-01-03 12:04:05 -08:00
Grant Sanderson
572383f541 Have buff between Decimal digits change with font size 2021-01-03 12:03:39 -08:00
Grant Sanderson
c2b16d768e Have decimal remember and match font size, not height 2021-01-03 11:44:53 -08:00
Grant Sanderson
e5c79cbb90 Directly cache svg file instead of tex, and don't store superfluous files associated with tex rendering 2021-01-03 11:29:09 -08:00
Grant Sanderson
16ea2fd9c1 include utils.directories in universal import list 2021-01-03 11:28:20 -08:00
Grant Sanderson
5541d55094 Remove camera quality information from constants 2021-01-02 23:02:39 -08:00
Grant Sanderson
05887d5039 Remove reference to UHD_CAMERA_QUALITY 2021-01-02 23:02:20 -08:00
Grant Sanderson
d1c6b80622 Tiny change 2021-01-02 23:02:02 -08:00
Grant Sanderson
3b26a6c260 Clean up colors, e.g. replacing LIGHT_GREY and DARK_GREY with GREY_B and GREY_D 2021-01-02 22:44:53 -08:00
Grant Sanderson
32b76bf448 Small move to DEFAULT_PIXEL_HEIGHT, etc. In theory these values shouldn't matter anymore, but it's nice to have some default there for the definition of Camera 2021-01-02 22:38:07 -08:00
Grant Sanderson
6da1836f02 Take scene finding messages out of constants 2021-01-02 22:26:49 -08:00
Grant Sanderson
e01496e8bd Rearrange how passing in no module or scenes is handled 2021-01-02 22:20:13 -08:00
Grant Sanderson
93fe783b80 Make it so that simply typing 'python -m manim' will embed you in a blank scene to work with 2021-01-02 22:03:00 -08:00
Grant Sanderson
7b3f4d08f5 Replace the progress bar with a simple display of what's being written which then gets deleted 2021-01-02 21:32:48 -08:00
Grant Sanderson
d2518df82c Add deprication warning 2021-01-02 21:32:07 -08:00
Grant Sanderson
f11ab03112 Remove unnecessary imports 2021-01-02 21:31:56 -08:00
Grant Sanderson
d4207540bb Removed files 2021-01-02 21:31:00 -08:00
Grant Sanderson
592432611b Remove all configuration from constants.py, and clean up the many files affected by this move 2021-01-02 20:47:51 -08:00
Grant Sanderson
cf01a215db Stop treating extract_scene like a script 2021-01-02 19:03:01 -08:00
Grant Sanderson
ba46164b49 Remove image showing methods from mobject 2021-01-02 19:02:22 -08:00
Grant Sanderson
525309f277 Small update to example_scenes.py description 2021-01-02 11:13:14 -08:00
Grant Sanderson
343253b787 Remove livestream related arguments 2021-01-02 11:12:43 -08:00
Grant Sanderson
123450c3f2 Merge pull request #1301 from Tony031218/shaders
Some cleanups and bug fixes for the shaders branch
2021-01-02 09:43:10 -08:00
Grant Sanderson
5424716877 Merge branch 'shaders' into shaders 2021-01-02 09:42:57 -08:00
Grant Sanderson
2a61360786 Merge license 2021-01-02 09:38:58 -08:00
Grant Sanderson
471eb8b0d9 Added .gitignore from https://www.toptal.com/developers/gitignore/ 2021-01-02 09:37:28 -08:00
Tony031218
d221073360 update README.md 2021-01-02 19:20:25 +08:00
Tony031218
8b2785fdc9 fix bugs in extract_scene.py 2021-01-02 19:17:11 +08:00
Tony031218
d28f30dc4a fix bugs of window position on Windows 2021-01-02 19:16:35 +08:00
Tony031218
23af9c6c9c fix bugs on Windows and ctex 2021-01-02 19:15:30 +08:00
Tony031218
38b293c204 remove versions from requirements.txt and update environment.yml 2021-01-02 19:14:00 +08:00
Tony031218
b54e9efccf delete docs/ travis and docker 2021-01-02 19:12:54 +08:00
Grant Sanderson
e3acb920f4 Remove MoveCar 2021-01-01 21:11:17 -08:00
Grant Sanderson
915b7ea3ad Removed some drawings specific to 3b1b videos 2021-01-01 20:20:48 -08:00
Grant Sanderson
23f7bce427 Bug fix to add_smooth_curve_to 2021-01-01 20:12:34 -08:00
Grant Sanderson
5a238f1551 Removed Logo from drawings 2021-01-01 20:12:02 -08:00
Grant Sanderson
3821dd358a Added sympy to requirements 2021-01-01 20:11:30 -08:00
Grant Sanderson
68e47c839b Added sympy to the list of default imports 2021-01-01 20:11:19 -08:00
Grant Sanderson
e59d839806 Update LICENSE.md 2020-12-31 13:49:32 -08:00
Grant Sanderson
e737ace268 Updated README and LICENSE after moving 3b1b content to another project 2020-12-31 13:47:50 -08:00
Grant Sanderson
3a1f07492c Moved 3b1b specific content out of this project 2020-12-31 13:04:13 -08:00
Grant Sanderson
58dbec76da Changed monster thumbnail 2020-12-29 16:45:32 -08:00
Grant Sanderson
c3643cf4e3 Some finishing tweaks to the med_test video 2020-12-24 16:26:03 -08:00
Grant Sanderson
917ff685bd Update Monster thumbnail 2020-12-24 16:24:49 -08:00
Grant Sanderson
1d5cee6f43 Make the manim window show up in the upper right quadrant of the monitor window 2020-12-24 16:24:06 -08:00
Grant Sanderson
27cd86fde7 Final animations for first med_test video 2020-12-21 14:29:45 -08:00
Grant Sanderson
cc73075d63 More med_test animations 2020-12-18 21:02:36 -08:00
Grant Sanderson
607e918ab1 More med test animations, doing a rewrite 2020-12-17 15:59:29 -08:00
Grant Sanderson
1237ecc8f0 More percent sign exceptions 2020-12-17 15:59:14 -08:00
Grant Sanderson
df6ea06f89 Have DecimalNumber take in a font size 2020-12-17 15:59:02 -08:00
Grant Sanderson
2461248ef6 Allow Line to take in 2d arrays as arguments 2020-12-08 09:27:20 -08:00
Grant Sanderson
9dc4551685 discrete fourier transform animation 2020-12-08 09:26:45 -08:00
Grant Sanderson
d650cfd3e7 DFT animation 2020-12-04 14:42:54 -08:00
Grant Sanderson
c71eddb9d3 First half medical test animations 2020-12-04 08:26:12 -08:00
Grant Sanderson
6f81ec383c Name sub 2020-12-04 08:25:44 -08:00
Grant Sanderson
af0948ea15 Address percent bug a better way, but still witha patch that shouldn't be permanent 2020-12-04 08:25:23 -08:00
Grant Sanderson
d702396d87 Rename what was an overloaded term 'width' on Arrow to thickness 2020-12-04 08:20:59 -08:00
Grant Sanderson
b2f09dbdb1 Account for new Fade behavior 2020-12-04 08:20:32 -08:00
Grant Sanderson
bbfce0f5be Change window position defaults 2020-12-04 08:20:06 -08:00
Grant Sanderson
c65dfb85d2 Change arguments for Fading so that you can pass in shift and/or scale to FadeIn and FadeOut, aimed at increased readibility and flexibility 2020-12-04 08:14:15 -08:00
Grant Sanderson
b64875fd55 Typo fix for primitive 2020-12-04 08:12:53 -08:00
Grant Sanderson
6ead1ceca6 Updated requirements 2020-12-04 08:09:29 -08:00
Grant Sanderson
f08003fcb2 Typo fix for primitive 2020-12-04 08:09:02 -08:00
Grant Sanderson
102af22182 Typo fix for primitive 2020-12-04 08:08:38 -08:00
Grant Sanderson
171042b8d7 Animations for some 18S191 lectures 2020-11-24 13:31:50 -08:00
Grant Sanderson
25bab8c10e Final edits to hamming video 2020-11-24 13:31:32 -08:00
Grant Sanderson
da972edfca Change when camera shift happens 2020-11-24 13:31:21 -08:00
Grant Sanderson
32c5534099 Change banner defaults 2020-11-24 13:30:37 -08:00
Grant Sanderson
1f36e83c9d Delete defunct functionality 2020-11-24 13:29:44 -08:00
Grant Sanderson
4e54c6de54 Fix rgb_to_hex bug 2020-11-24 13:29:27 -08:00
Grant Sanderson
3bc4416655 Updated requirements 2020-11-24 13:29:04 -08:00
Grant Sanderson
169e99b69e Thumbnail change 2020-09-02 09:53:28 -07:00
Grant Sanderson
34b4d90b11 End of Hamming project 2020-08-30 16:01:32 -07:00
Grant Sanderson
f89676d53f Allow arrange_in_grid to specify v_buff and h_buff 2020-08-30 16:01:22 -07:00
Grant Sanderson
821857afa8 Fixed braces on Matrix 2020-08-30 16:00:59 -07:00
Grant Sanderson
35a2ade954 Added final_alpha_value parameter to Animation for things like FadeOut 2020-08-30 16:00:42 -07:00
Grant Sanderson
852e840523 End of monster video 2020-08-20 17:16:55 -07:00
Grant Sanderson
054b828396 Clean up TeacherStudentScene.teacher_holds_up 2020-08-20 17:16:47 -07:00
Grant Sanderson
2dac041006 Change default smoothing algorithm 2020-08-20 17:16:15 -07:00
Grant Sanderson
2708ecfd47 Fix Arrow.get_start 2020-08-20 17:13:24 -07:00
Grant Sanderson
9084ddbd06 Should not pollute repo with my ignores 2020-08-20 17:12:56 -07:00
Grant Sanderson
fc153bb49a First half of monster video 2020-08-16 09:46:49 -07:00
Grant Sanderson
537a2c74aa Return self on unlock_triangulation 2020-08-16 09:46:33 -07:00
Grant Sanderson
dd6e99ab2e Make it possible to set a prefered direction for ShowCreation on surfaces 2020-08-16 09:46:08 -07:00
Grant Sanderson
26834178e7 Bug fix to Bubble 2020-08-16 09:45:48 -07:00
Grant Sanderson
fd17e42c23 Add about_point arg to Line.set_angle 2020-08-16 09:45:34 -07:00
Grant Sanderson
c1143c875d Don't show bottom most number on axes 2020-08-16 09:45:13 -07:00
Grant Sanderson
a822c93019 Add added_anims arg to PiCreatureScene.look_at 2020-08-16 09:44:54 -07:00
Grant Sanderson
caca6d0c0e Fix Eyes 2020-08-16 09:44:28 -07:00
Grant Sanderson
c1a1b0f145 Hamming code video scenes 2020-08-12 13:24:40 -07:00
Grant Sanderson
33d4dd7729 Fix svg polygon command 2020-08-12 13:24:16 -07:00
Grant Sanderson
0c37d91af3 This is just a temporary hack, but percent signs don't behave well atm 2020-08-12 13:23:54 -07:00
Grant Sanderson
ae590e7fde Add point_to_rgb 2020-08-12 13:23:21 -07:00
Grant Sanderson
150b03427d Change default window location 2020-08-12 13:23:04 -07:00
Grant Sanderson
960e4e13eb Updated arrange_in_grid 2020-07-23 11:57:18 -07:00
Grant Sanderson
e7a60c6c85 Updated arrange_in_grid 2020-07-23 11:56:06 -07:00
Grant Sanderson
72472c5836 Refactor in terms of a ShaderWrapper object 2020-07-22 18:21:42 -07:00
Grant Sanderson
ae8e8040d7 New implementation of smooth 2020-07-22 18:19:07 -07:00
Grant Sanderson
5ee4b94ec3 Not great, but adding an alternate implementation of make_smooth in as a comment just because it's unclear what's best right now 2020-07-22 18:18:29 -07:00
Grant Sanderson
93f7671732 Fixes to Arrow 2020-07-22 18:17:08 -07:00
Grant Sanderson
cf0afb0259 New name in name_map (which really should exist not in source code) 2020-07-22 18:16:59 -07:00
Grant Sanderson
dbe33f9382 Change axis defaults 2020-07-22 18:16:34 -07:00
Grant Sanderson
f31cf2e30f Changes to Fourier series for name animations 2020-07-22 18:16:09 -07:00
Grant Sanderson
81715adb05 End of chess 2020-07-22 18:15:48 -07:00
Sujan Dutta
25f672cc55 Update imports.py
corrected the linking word.
2020-07-17 10:47:55 +05:30
Grant Sanderson
9a44794dc9 Removes default color for polygon 2020-06-29 22:53:44 -07:00
Grant Sanderson
46b52a1bbc Small fix to VMobject.pointwise_become_partial for cases when points array sizes dont' match 2020-06-29 22:53:23 -07:00
Grant Sanderson
5e7913fdd4 Implemented pointwise_become_partial for parametric surfaces 2020-06-29 22:52:27 -07:00
Grant Sanderson
61424dbfec Factor out get_render_group_list 2020-06-29 18:25:56 -07:00
Grant Sanderson
2671817ae9 Refactor away from treating shader_info as a dictionary, and make it a proper type as ShaderWrapper. This also includes some cleanup in hos Camera renders 2020-06-29 18:17:18 -07:00
Grant Sanderson
165bf2fe6e Small bug fix 2020-06-29 18:15:54 -07:00
Grant Sanderson
feb6a33135 Account for fixed_in_frame in set_value 2020-06-29 18:15:40 -07:00
Grant Sanderson
cd371dc207 Add Mobject.has_updaters which is distinct from Mobject.suspend_updating 2020-06-29 11:23:01 -07:00
Grant Sanderson
2b3bd2bfce Use an index buffer for shaders to save memory 2020-06-29 11:05:09 -07:00
Grant Sanderson
978137b143 Use super() 2020-06-29 11:04:48 -07:00
Grant Sanderson
f11cb5a498 Small cleanups to arrow 2020-06-29 11:04:23 -07:00
Grant Sanderson
0b58572f41 Removes magic number 2020-06-28 12:15:55 -07:00
Grant Sanderson
439e83f40e set_array_by_interpolation 2020-06-28 12:15:01 -07:00
Grant Sanderson
279f66ceaf A little refactoring and performance improvement 2020-06-28 12:14:46 -07:00
Grant Sanderson
8af879236e Make gloss and shadow uniforms 2020-06-28 12:13:25 -07:00
Grant Sanderson
1cab58ac49 Change how arrow is implemented to be all fill no stroke 2020-06-28 10:05:49 -07:00
Grant Sanderson
41fd6d4f4b Simply reorders where some methods are defined 2020-06-28 10:05:27 -07:00
Grant Sanderson
13bcd723cf Adds a small todo 2020-06-28 10:05:00 -07:00
Grant Sanderson
14cac5ce71 Make stroke width array a float 2020-06-28 10:04:40 -07:00
Grant Sanderson
6a735e49b8 Refresh rotation matrix after interpolation 2020-06-27 12:17:53 -07:00
Grant Sanderson
b443c9e764 Fixed bug at a = 1 for partial_bezier 2020-06-27 12:17:41 -07:00
Grant Sanderson
90db32ee55 Have camera_frame remember rotation matrix by default 2020-06-27 12:10:51 -07:00
Grant Sanderson
54bde86c7b Some small performance improvements to VMobject 2020-06-27 12:10:22 -07:00
Grant Sanderson
10c6bfe3ad Add refresh_shader_info_id insetead of having create_shader_info_id called all the time 2020-06-27 00:01:45 -07:00
Grant Sanderson
26ce1d86ab Remove unlock_shader_data calls 2020-06-27 00:01:04 -07:00
Grant Sanderson
6ba1eae8f6 Use ctx.vertex_array instead of ctx.simple_vertex_array 2020-06-27 00:00:50 -07:00
Grant Sanderson
60e1c88eb4 Slight tweaks to how shader_info id is found and stored 2020-06-26 23:05:25 -07:00
Grant Sanderson
661b81ab17 By default, don't recursively check for updaters unless there's something to find 2020-06-26 22:16:04 -07:00
Grant Sanderson
5d371bfec9 Fix broken import 2020-06-26 21:53:54 -07:00
Grant Sanderson
4910501ee0 Clean up end scroll 2020-06-26 21:53:39 -07:00
Grant Sanderson
9a2b2ecd9e Small repositioning 2020-06-26 21:53:26 -07:00
Grant Sanderson
9d03f40be2 Keep tex mobject from calling itself twice 2020-06-26 21:53:06 -07:00
Grant Sanderson
9795beba89 Removes locked_shader_data notion 2020-06-26 21:52:50 -07:00
Grant Sanderson
212cdbb4d2 Speed improvements. Camera saves vbo for static mobjects, data in shader_data_info is saved and concatenated in raw form 2020-06-26 19:29:34 -07:00
Grant Sanderson
72bfb0047e Prep for antipode animations 2020-06-26 15:36:51 -07:00
Grant Sanderson
9b9dca7bed Final(?) Chessbaord animations 2020-06-26 15:36:38 -07:00
Grant Sanderson
a05621e857 Changes to end scroll 2020-06-26 15:35:50 -07:00
Grant Sanderson
c2feb6fff1 Add shorted method for setting background stroke 2020-06-26 15:35:37 -07:00
Grant Sanderson
21bf3c3e3a VMobject was not correctly incorporating background stroke on init 2020-06-26 15:31:24 -07:00
Grant Sanderson
6451371a75 Final(?) animations for chessbaord puzzle part 1 2020-06-23 14:26:30 -07:00
Grant Sanderson
5b1ce542d7 Update ending scroll 2020-06-23 14:26:13 -07:00
Grant Sanderson
1f6308577b Only remove null curves for tex mobjects 2020-06-23 14:26:02 -07:00
Grant Sanderson
c8195f72a1 New chessboard scenes 2020-06-22 15:22:41 -07:00
Grant Sanderson
c653610215 Add Checkmark and Exmark 2020-06-22 15:22:29 -07:00
Grant Sanderson
09df42a755 Acutually uses Arrow.preserve_tip_size_when_scaling 2020-06-22 15:22:05 -07:00
Grant Sanderson
687d70e9b6 Changes default int_func on ShowIncreasingSubsets to np.round 2020-06-22 15:21:25 -07:00
Grant Sanderson
fd1f4313ec Lock shader data during interaction 2020-06-18 16:30:38 -07:00
Grant Sanderson
81f6063736 Change string format style 2020-06-18 16:26:04 -07:00
Grant Sanderson
4fdd655564 changes default Line3D resolution 2020-06-18 16:25:48 -07:00
Grant Sanderson
bb66a7c977 Releases moderngl buffers after use 2020-06-18 16:25:26 -07:00
Grant Sanderson
d4635ab165 Chessbaord scenes up to ShowCube 2020-06-17 17:13:26 -07:00
Grant Sanderson
48801f2892 Don't give arrow tip stroke width by default 2020-06-17 17:13:07 -07:00
Grant Sanderson
0a89a775a2 Clean up some family matters 2020-06-17 17:12:48 -07:00
Grant Sanderson
a0006426cc Fix Line3D 2020-06-17 17:12:23 -07:00
Grant Sanderson
eee4054da8 Cleaup how colors are updated 2020-06-17 17:11:57 -07:00
Grant Sanderson
b16b107f3e Add depth test update when fill and stroke shader info are created 2020-06-17 17:11:31 -07:00
Grant Sanderson
138c48c739 Remove old commented out window timing code 2020-06-17 17:10:56 -07:00
Grant Sanderson
5ce8d08e0f Go back to recomputing shader id 2020-06-17 17:10:35 -07:00
Grant Sanderson
d1f1ed6a1a Adds DiagramOfProgression 2020-06-15 12:03:23 -07:00
Grant Sanderson
8c9ea90d50 Remove triangulation lock after animation 2020-06-15 12:02:59 -07:00
Grant Sanderson
e6f73073fe Remember triangle indices, rather than recomputing each frame 2020-06-15 12:02:24 -07:00
Grant Sanderson
c45fe52a70 Rather than calling get_shader_info a bunch, remember a tempalte 2020-06-15 12:01:54 -07:00
Grant Sanderson
6a458547c3 Bug fix 2020-06-15 12:01:05 -07:00
Grant Sanderson
739667f8a9 Turn on depth test for SurfaceMesh 2020-06-15 12:00:37 -07:00
Grant Sanderson
edec91e1e4 Unfactor internals of batch_by_property for easier readibility, and slight performnace improvement 2020-06-15 12:00:03 -07:00
Grant Sanderson
1e6eef89ec Have shader_info remember its own id 2020-06-15 11:59:24 -07:00
Grant Sanderson
9d772496dd Removes the need to be able to recover shader_info from shader_id 2020-06-14 19:01:04 -07:00
Grant Sanderson
7a152fed1c Some TODO stubs. Honestly, this whole file should probably be deleted 2020-06-14 17:42:59 -07:00
Grant Sanderson
00ad9d7f95 Cleanup to square and rectangle init 2020-06-14 17:42:25 -07:00
Grant Sanderson
222b6d1220 Push depth test decision to the mobject level, as opposed to the camera 2020-06-14 17:41:47 -07:00
Grant Sanderson
145c6a7e78 Remove already commented out alternate pix_fmt 2020-06-13 15:22:44 -07:00
Grant Sanderson
f5b4a86801 Add get_color function 2020-06-13 15:22:11 -07:00
Grant Sanderson
46bcf938ed Stretch to fit should apply to all 3 dimensions 2020-06-13 15:21:47 -07:00
Grant Sanderson
81cedfbfda Cleanup to the __init__ functions on a few geometry objects 2020-06-13 15:21:19 -07:00
Grant Sanderson
61a3bd8102 Small change to make the ctx enable flag a little clearer 2020-06-13 15:20:17 -07:00
Grant Sanderson
9d5282b74f New scene for chessboard video 2020-06-13 15:19:42 -07:00
Grant Sanderson
512c42f4df CoinFlip animation 2020-06-10 07:28:43 -07:00
Grant Sanderson
62e5efe87b SGroups should be considered to have resolution (0, 0) 2020-06-10 07:28:06 -07:00
Grant Sanderson
429d63eebf Add special methods for setting angles 2020-06-09 21:25:00 -07:00
Grant Sanderson
2317a7d982 Torus 2020-06-09 21:24:42 -07:00
Grant Sanderson
8a060dfa3f Add axis_normalized option to quaternion_from_angle_axis 2020-06-09 20:40:36 -07:00
Grant Sanderson
a4d4ae9b47 Don't get rid of null curves each frame, instead do it once for SVG mobjects. 2020-06-09 20:39:32 -07:00
Grant Sanderson
cf8790eefa switched to get_triangle_indices 2020-06-09 20:13:25 -07:00
Grant Sanderson
2208b51f1b Lock triangulation and unit normal by default 2020-06-09 17:59:33 -07:00
Grant Sanderson
5584521fb0 Change default focal distance 2020-06-09 17:59:03 -07:00
Grant Sanderson
7c4874bdad Changed how focal_distance works 2020-06-09 17:12:52 -07:00
Grant Sanderson
3e913b6649 Have make_smooth work directly from the quadratic bezier curves, without going via cubics and doubling the size of the points list 2020-06-09 16:58:16 -07:00
Grant Sanderson
1f129f4a23 Clean up parametric function 2020-06-09 16:57:44 -07:00
Grant Sanderson
c7a50ac7a5 Tried, but failed, to write a better smooth bezier function 2020-06-09 12:38:37 -07:00
Grant Sanderson
940432e320 Remove unneeded import 2020-06-09 12:34:57 -07:00
Grant Sanderson
ee7218745e Fixed FunctionGraph bug 2020-06-09 12:34:43 -07:00
Grant Sanderson
b91284b4aa Small shader fixes 2020-06-09 12:34:00 -07:00
Grant Sanderson
f0a36329b1 Changed get_quadratic_approximation_of_cubic 2020-06-08 20:40:39 -07:00
Grant Sanderson
ccefbc0dea Add is_fixed_in_frame uniform which allows mobjects to not get rotated by the camera 2020-06-08 20:27:07 -07:00
Grant Sanderson
5d34cee014 Move frame resizing to get_gl_Position so that the screen rotation matrix remains det 1 2020-06-08 17:55:41 -07:00
Grant Sanderson
be904774dd Treat joint_type as a uniform 2020-06-08 16:03:08 -07:00
Grant Sanderson
bab809b9a6 Allow for passing shader uniforms from mobjects 2020-06-08 15:57:12 -07:00
Grant Sanderson
39230a805c Better handling of textures, now letting multiple get passed in to a textured surface 2020-06-08 15:06:22 -07:00
Grant Sanderson
596b7c0112 Get rid of unneeded import 2020-06-08 14:09:48 -07:00
Grant Sanderson
97304d9d86 Added multisampling to camera 2020-06-08 14:09:31 -07:00
Grant Sanderson
2d19d76675 Replace all FadeInFrom with simple FadeIn, and likewise for FadeOutFrom -> FadeOut 2020-06-07 12:35:20 -07:00
Grant Sanderson
919f267f7f Create Chessboard and Coin types 2020-06-07 12:26:31 -07:00
Grant Sanderson
7e0566cc12 Honestly, this file should be killed 2020-06-07 12:26:20 -07:00
Grant Sanderson
046caa7632 Bug fixes 2020-06-07 12:24:54 -07:00
Grant Sanderson
4968c7a8a1 Small note 2020-06-07 12:24:31 -07:00
Grant Sanderson
4a3e4df2bd Change cube face order 2020-06-07 12:24:14 -07:00
Grant Sanderson
3a111cf3af Get rid of this color nonsense 2020-06-07 12:23:35 -07:00
Grant Sanderson
58df38f74e Let FadeIn and FadeOut take in directions 2020-06-07 12:23:08 -07:00
Grant Sanderson
a5f16f0c52 Make sure light styling is interpolated properly 2020-06-06 17:01:54 -07:00
Grant Sanderson
ba7a51931d Add shadow, and pull out lighting information to Mobject 2020-06-06 16:55:56 -07:00
Grant Sanderson
b32c2937ae Added SurfaceMesh 2020-06-06 13:23:30 -07:00
Grant Sanderson
017961e892 Changed min_samples 2020-06-06 13:22:48 -07:00
Grant Sanderson
b8a1853692 Change meaning of resolution for surfaces to be the number of posts, not fences 2020-06-06 13:22:23 -07:00
Grant Sanderson
58fe0c79d8 Reconfigured ParametricCurve 2020-06-06 11:43:59 -07:00
Grant Sanderson
7cec2e50d5 Rename: ParametricFunction -> ParametricCurve 2020-06-06 11:03:23 -07:00
Grant Sanderson
7c1f560ae2 Change fallback unit normal to be in negative y-direction 2020-06-06 10:57:07 -07:00
Grant Sanderson
98ac6a06f2 Small cleanup 2020-06-06 10:56:46 -07:00
Grant Sanderson
4385fc75d0 Change TipableVMobject to take in all tip_config at one spot 2020-06-06 10:56:23 -07:00
Grant Sanderson
274ebe7a52 Change stroke shader to effectively project down to a flat plane before drawing, but to remember z information via gl_Position and lighting. 2020-06-06 09:26:18 -07:00
Grant Sanderson
1a5fb207ae Reconfigured how to initialize axes and number planes. Hopefully much more sensible this way 2020-06-05 19:24:35 -07:00
Grant Sanderson
fbe917d461 Add height to DecimalNumber config 2020-06-05 17:57:44 -07:00
Grant Sanderson
5c23e93547 Reconfigure NumberLine, the whole interface felt very weird 2020-06-05 17:57:21 -07:00
Grant Sanderson
cbc5bff1c0 Setup for new project 2020-06-05 16:33:30 -07:00
Grant Sanderson
d89bf9b635 Added SGroups 2020-06-05 13:37:06 -07:00
Grant Sanderson
83b2932e02 A few more surface types 2020-06-05 13:24:26 -07:00
Grant Sanderson
51eb9de9d0 A little cleaning up of 3d axes. More to come 2020-06-05 13:24:14 -07:00
Grant Sanderson
a204e422a5 Get rid of do-nothing self.ctx.multisample line 2020-06-05 13:23:38 -07:00
Grant Sanderson
e5a215cbd6 Have rectangles drawn in ccw order 2020-06-05 13:23:15 -07:00
Grant Sanderson
a3e76334a6 Nix shade_in_3d stuff 2020-06-05 13:22:53 -07:00
Grant Sanderson
b4fb0955a6 Get rid of sheen factor 2020-06-05 13:21:59 -07:00
Grant Sanderson
b2137f2746 Fixed z_to_vector for vectors on z-axis 2020-06-05 13:21:35 -07:00
Grant Sanderson
cacfe67fe1 ParametricSurface replaces the role of SurfaceMobject, and instead of tracking normals infinitesimal nudges are tracked 2020-06-05 11:12:52 -07:00
Grant Sanderson
efe15cf2f0 normalize_along_axis 2020-06-05 11:12:11 -07:00
Grant Sanderson
a62a4ae02b Make sure Point has points of type float 2020-06-05 11:11:46 -07:00
Grant Sanderson
54598f92c7 Remove unnecessary import 2020-06-05 11:11:11 -07:00
鹤翔万里
0f998615ad Merge pull request #6 from 3b1b/shaders
update shaders branch
2020-06-05 08:20:26 +08:00
Grant Sanderson
2b931dc7a2 Improvements to surfaces, with textured surfaces available 2020-06-04 17:17:38 -07:00
Grant Sanderson
4c33b99d39 Very rudimentary 3dSurface type 2020-06-04 15:41:20 -07:00
Grant Sanderson
e4419204cb Got stroke shaders working in 3d 2020-06-04 11:29:36 -07:00
Grant Sanderson
23bbdc63ba Fix up fill shaders to work when being viewed from different orientations, along with several other little bugs 2020-06-03 17:10:33 -07:00
Grant Sanderson
adac5690b7 Have banner remember pis 2020-06-03 17:09:39 -07:00
Grant Sanderson
a232c32756 Changed camera frame from working in quaternions to working in Euler angles. For shame. 2020-06-03 10:38:57 -07:00
Grant Sanderson
38cc0a7174 Added glossiness to VMobjects 2020-06-02 16:18:44 -07:00
Grant Sanderson
725a7e3121 Enable 3d rotations 2020-06-01 16:21:18 -07:00
Grant Sanderson
e882356264 Small cleanups to the shader files 2020-05-31 17:31:03 -07:00
Grant Sanderson
00dcc14df1 Fixed the random-dimples-on-zeros bug while fixing up the fill shaders 2020-05-31 17:02:05 -07:00
Kyle Cheng
435a2631c9 Fixed typo from "depricated" to "deprecated" 2020-05-31 09:44:39 -07:00
Grant Sanderson
270e93f6f0 Merge 2020-05-30 16:53:53 -07:00
Grant Sanderson
9a8323cbb7 Changes for recent videos 2020-05-30 16:49:57 -07:00
Grant Sanderson
593c249bbd Tiny comment 2020-05-30 16:49:27 -07:00
Grant Sanderson
ccb47db3bb fix pixel_coords_to_space_coords 2020-05-30 16:48:01 -07:00
鹤翔万里
d83fa90606 Fix Text Class's bugs in shaders branch (the same as #1030) (#1031)
* fix: remove the last M tag in svg files to make Text run in shaders branch

* fix: close the svg path manually to fix the bug of wrong stroke

* fix: remove Space mobjects in Text to fix the bug of TransformText

* feat: make Text and TextMobject equal in size

* this will lead to more bugs of setting color, so I delete it

* fix typo in text_mobject.py

* fix conflict of default size and height
2020-05-07 01:21:43 -07:00
Devin Neal
ec4a70ad35 Merge pull request #950 from kolibril13/patch-1
Changed -1 to -1.0 for broader GPU suppot.
2020-04-15 22:17:07 -07:00
Grant Sanderson
965564853b Published pdf video 2020-04-12 09:54:20 -07:00
Grant Sanderson
6e523ed960 Clearer defaults 2020-04-12 09:54:13 -07:00
Grant Sanderson
2d0257562f End scenes after embed 2020-04-12 09:53:29 -07:00
Grant Sanderson
0b8cb3b6e1 Leaving a note for the better color-preserving encoding 2020-04-12 09:53:14 -07:00
Grant Sanderson
50e00a3a89 Updates to scenes before early release of (the actual) beta2 2020-04-09 12:52:13 -07:00
Grant Sanderson
1525d5ff16 Make patron screen scroll time a variable 2020-04-09 12:51:49 -07:00
Grant Sanderson
427ad698fe Animation for reworked beta2 2020-04-07 12:36:32 -07:00
Grant Sanderson
94c121bcf7 Default arrange_in_grid should have it draw rows first 2020-04-07 12:36:17 -07:00
Grant Sanderson
13f0ef30c0 Small video-specific tweaks 2020-04-06 11:57:35 -07:00
鹤翔万里
abc018e0d8 Merge pull request #2 from chenxijun/patch-1
Make "shaders" branch work
2020-04-06 11:48:40 +08:00
尘息
abe1ea78d0 It's too old 2020-04-03 14:32:08 +08:00
尘息
229c809a4b Fix a bug in extract_scene.py 2020-04-01 13:45:24 +08:00
kolibril13
6eabbe943b Changed -1 to -1.0 for broader GPU suppot.
Some GLSL compilers are more sensitive to types than others. With this fix, my Intel HD Graphics 5500 (Broadwell GT2) gives no error on this script anymore.
2020-03-30 20:26:06 +02:00
Lalourche
1b125df572 Fixed execution of counting.py 2020-03-28 22:02:13 +01:00
Grant Sanderson
2ce0b72c44 Final scenes for SIR video 2020-03-27 12:04:42 -07:00
Grant Sanderson
8384b8b46b Fix bug with clock 2020-03-27 12:04:30 -07:00
Grant Sanderson
7c0bf2c015 Add args to VMobject.flip 2020-03-27 12:04:16 -07:00
Grant Sanderson
6fee2f5a0d Simulations for an SIR epidemic model 2020-03-19 10:47:05 -07:00
Grant Sanderson
f7ad9e71e0 Separate time_based_updaters and non_time_updaters 2020-03-19 10:46:50 -07:00
Grant Sanderson
6880ebcbc2 Finishing touches before beta1 public and beta2 private releases 2020-03-17 10:33:02 -07:00
Grant Sanderson
04459ae68d Most animations for second beta video 2020-03-14 16:53:21 -07:00
Grant Sanderson
23440d020f Add pfp as abreviation for point_from_proportion 2020-03-14 16:53:02 -07:00
Grant Sanderson
ab817c0962 Fix blink 2020-03-14 16:52:33 -07:00
Grant Sanderson
6c391a7580 Changes to beta before early release of beta1 2020-03-13 14:06:39 -07:00
Grant Sanderson
0c9447a94a Final edits for covid video 2020-03-13 14:06:22 -07:00
Grant Sanderson
b0aacda655 Add count in from 2020-03-13 14:06:08 -07:00
Grant Sanderson
d5b2160c64 Updating end screen 2020-03-13 14:05:53 -07:00
Grant Sanderson
627f122b3f Remove VMobject.set_fill defaulting 2020-03-13 14:05:34 -07:00
Grant Sanderson
85bfde68a1 All animations for the covid video, done in a frantic fugue state 2020-03-07 21:04:00 -08:00
Grant Sanderson
3e84a2f30f Latest beta animations 2020-03-07 21:03:11 -08:00
Grant Sanderson
aa016bf1ac Dumb 2020-03-07 20:54:19 -08:00
Grant Sanderson
e8b0ecfede Fix endscreen 2020-03-07 20:53:58 -08:00
Grant Sanderson
5a780dfde3 Flash did not use stroke_width 2020-03-07 20:53:48 -08:00
Grant Sanderson
2c80b6f62d Latest scenes from beta 2020-03-06 06:17:21 -08:00
Grant Sanderson
0ad64329f6 Fix to NumberPlane 2020-03-06 06:17:12 -08:00
Grant Sanderson
ace2b7fea4 Don't deepcopy parents 2020-03-06 06:16:52 -08:00
Grant Sanderson
f83cfc42b1 Fix set_fill 2020-03-06 06:16:28 -08:00
Grant Sanderson
7785a06441 Move where refreshing shader uniforms happens 2020-03-06 06:16:09 -08:00
Grant Sanderson
cfe72922ca Have rotate_vector return same type as input 2020-03-06 06:15:28 -08:00
Grant Sanderson
8fc6c8107a Latest beta animations 2020-02-27 17:20:31 +00:00
Grant Sanderson
06123f956a Don't deepcopy Arrow by default 2020-02-27 17:19:50 +00:00
Grant Sanderson
ed1cbe32ff Don't copy a mobject's parents 2020-02-27 17:19:15 +00:00
Grant Sanderson
6593eab9a0 Change default stroke width of number line 2020-02-27 17:18:10 +00:00
Grant Sanderson
6e0ae83685 Small fixes 2020-02-27 17:17:53 +00:00
Grant Sanderson
40b651d661 Reformat 2020-02-27 17:17:33 +00:00
Grant Sanderson
3cc9bf7052 Bug fix to refresh_triangulation 2020-02-27 17:17:10 +00:00
Grant Sanderson
f4776626e4 Shorten name to index_labels 2020-02-27 17:16:10 +00:00
Grant Sanderson
1b497d31ff New scenes for beta 2020-02-23 23:00:03 +00:00
Grant Sanderson
d4790beb24 Adding pi_font 2020-02-23 22:59:53 +00:00
Grant Sanderson
60b1e284f3 Don't embed when writing to file with no preview 2020-02-23 22:59:29 +00:00
Grant Sanderson
8485ff8c76 Have vmob.set_opacity default to opacity 1 if it's not specified 2020-02-23 22:59:11 +00:00
Grant Sanderson
8159f701f4 Typo fix 2020-02-23 22:58:47 +00:00
Grant Sanderson
d794ff8bc9 Revert last change 2020-02-23 22:58:34 +00:00
Grant Sanderson
26dccfe9a7 Make input_to_graph_point always use a binary search, since graph's have uneven density now 2020-02-23 22:56:50 +00:00
Grant Sanderson
da8dc4ea03 Unlock pi creature triangulation 2020-02-23 22:56:26 +00:00
Grant Sanderson
b0c80a7a91 More scenes for beta 2020-02-22 13:21:15 -08:00
Grant Sanderson
34ae76ab7f Have restructure_list_to_exclude_certain_family_members work with the full family of to_remove 2020-02-22 13:20:59 -08:00
Grant Sanderson
f4a33c5bfb Small fix 2020-02-22 13:20:37 -08:00
Grant Sanderson
7b198545bb Get rid of old methods 2020-02-22 13:20:22 -08:00
Grant Sanderson
ed6085d07c Add replace_submobject 2020-02-22 13:19:51 -08:00
Grant Sanderson
11a4d7696e Change implementation of pointwise_become_partial not to change the number of points 2020-02-22 13:19:26 -08:00
Grant Sanderson
c8befa5b9a Fix bug with eyes 2020-02-22 13:18:50 -08:00
Grant Sanderson
0b0dbcb5d8 Replace np.tan with math.tan...because why not 2020-02-21 12:01:39 -08:00
Grant Sanderson
2ca0726cd7 Add self.shader_data_is_locked condition to get_shader_info_list 2020-02-21 12:01:17 -08:00
Grant Sanderson
41e2fd76d1 Make Rotate a subclass of Rotation, not Transform 2020-02-21 12:00:50 -08:00
Grant Sanderson
68ac16e5fb Move rendering back to camera 2020-02-21 12:00:34 -08:00
Grant Sanderson
fa7f340cd3 Replace np.<trig> with math.<trig> 2020-02-21 10:57:10 -08:00
Grant Sanderson
ea59950b2c Have mobjects track family and parents more directly 2020-02-21 10:56:40 -08:00
Grant Sanderson
b825b36b60 Slight fix to triangulation 2020-02-20 16:50:34 -08:00
Grant Sanderson
6be41fec6d Add simple function to measure runtime 2020-02-20 16:50:13 -08:00
Grant Sanderson
bafc8c88d5 subdivide_sharp_curves -> should_subdivide_sharp_curves 2020-02-20 16:49:56 -08:00
Grant Sanderson
8d3ec1afd0 Don't worry about aligning points of vmobjects with same number of points 2020-02-20 16:49:36 -08:00
Grant Sanderson
306344e9c1 Add possibility for add_line to add more points...makes for better svg alignment 2020-02-20 15:52:57 -08:00
Grant Sanderson
eb121c922b Small edits 2020-02-20 15:52:23 -08:00
Grant Sanderson
ec017bd1ae Insignificant style edit 2020-02-20 15:51:26 -08:00
Grant Sanderson
16ea2a0104 Fix bug with pi creature 2020-02-20 15:51:04 -08:00
Grant Sanderson
c88bcc1a3c Get rid of get_point_mobject 2020-02-20 10:03:47 -08:00
Grant Sanderson
57b1523d96 Various bits of cleanup and micro speedups 2020-02-20 10:03:36 -08:00
Grant Sanderson
c794039b9d Replacing apply_along_axis 2020-02-19 23:43:33 -08:00
Grant Sanderson
0176bda584 Replace np.apply_along_axis with arr.min 2020-02-19 23:32:35 -08:00
Grant Sanderson
b7f9257b3c New small beta scene 2020-02-19 23:27:11 -08:00
Grant Sanderson
ad1caca45e Remove get_moving_mobjects 2020-02-19 23:26:54 -08:00
Grant Sanderson
51167e19fe Rename and move around lock_static_mobject_data 2020-02-19 23:21:41 -08:00
Grant Sanderson
b373b7936a Move rendering to Mobject, and be smarter about caching data and vbo 2020-02-19 23:13:29 -08:00
Grant Sanderson
07cda695bb Finally, some work on the beta video 2020-02-18 22:43:23 -08:00
Grant Sanderson
671042cd20 Replace np.clip with clip, and other small changes 2020-02-18 22:43:06 -08:00
Grant Sanderson
d24a757609 Have LaggedStartMap remember group 2020-02-18 22:41:55 -08:00
Grant Sanderson
0be5abceb9 Small bug fix 2020-02-18 22:40:12 -08:00
Grant Sanderson
f1475463fc Just moving things around 2020-02-18 22:34:22 -08:00
Grant Sanderson
0ed5acd6c6 Adding directory for mobject_points 2020-02-18 22:33:58 -08:00
Grant Sanderson
dd7f8aac8d Default unlock triangulation for pi creature 2020-02-18 22:33:35 -08:00
Grant Sanderson
ba0d677c15 Small fixes 2020-02-18 22:33:22 -08:00
Grant Sanderson
b504899714 Replace np.clip with clip 2020-02-18 22:32:57 -08:00
Grant Sanderson
065979e2e1 A few small formatting changes 2020-02-18 22:32:43 -08:00
Grant Sanderson
8f8119509d Replace np.clip with clip 2020-02-18 22:32:15 -08:00
Grant Sanderson
6b69ed2174 Add a small todo 2020-02-18 22:32:02 -08:00
Grant Sanderson
01cda8a130 Fix a few problems with PlayingCard 2020-02-18 22:31:49 -08:00
Grant Sanderson
8ad1c58f9e Fix bug with recursive paths 2020-02-18 22:31:29 -08:00
Grant Sanderson
e9504b7010 A few small cleanups 2020-02-18 22:31:18 -08:00
Grant Sanderson
9f3551f43b Change how play/wait timing works with the window 2020-02-18 22:30:43 -08:00
Grant Sanderson
26a872be94 Replace rotation_matrix with rotation_matrix_transpose 2020-02-18 22:29:56 -08:00
Grant Sanderson
54067db386 Replace np.clip with clip 2020-02-18 22:27:28 -08:00
Grant Sanderson
34a1896ea8 Add custom clip function, since np.clip is evidently super slow 2020-02-18 22:27:13 -08:00
Grant Sanderson
67d9762773 Use quaternions to find rotation matrix 2020-02-18 22:25:54 -08:00
Grant Sanderson
6e932a24d2 Change defaults on when triangulation is locked...again 2020-02-17 14:01:46 -08:00
Grant Sanderson
47daf8e7f7 Have mobject.get_shader_info_list handle all of its submobjects 2020-02-17 12:15:53 -08:00
Grant Sanderson
9d4b16d03f Moved around where batching mobjects by shader type occurs, while also pulling out some of the shader_id helper functions 2020-02-17 12:14:40 -08:00
Grant Sanderson
673b85f129 Prep quadratic bezier shaders to work in 3d 2020-02-16 10:53:16 -08:00
Grant Sanderson
da7864b28c Remove ANTI_ALIAS_WIDTH 2020-02-14 17:00:36 -08:00
Grant Sanderson
6fe68dbc7a Record locked traingulation even on vmobs without points 2020-02-14 17:00:17 -08:00
Grant Sanderson
d03b32d249 Bug fix 2020-02-14 16:59:24 -08:00
Grant Sanderson
3982303fcc Default to locked triangulation for texmobjects, not all svgs 2020-02-14 16:59:12 -08:00
Grant Sanderson
aa06a3c111 Make it so that changing stroke, when there is background stroke, won't default it back to foreground 2020-02-14 16:27:23 -08:00
Grant Sanderson
dc8eb317dd Improving embed 2020-02-14 16:26:49 -08:00
Grant Sanderson
8402b9ea53 Add mouse points, embed, and move mobject updating to update_frame 2020-02-14 15:30:44 -08:00
Grant Sanderson
9186fa5551 Have vectorized point inherit from point 2020-02-14 15:30:04 -08:00
Grant Sanderson
d061bafaa2 Add Point mobject 2020-02-14 15:29:52 -08:00
Grant Sanderson
ba89ad7450 Forget about using remove_list_redundancies 2020-02-14 15:29:35 -08:00
Grant Sanderson
b73ebb9cf5 Go back to scene recomputing mobject families on each frame, and fix a bug with skipping 2020-02-14 11:55:07 -08:00
Grant Sanderson
49d84fccde Fixed edge case in inserting n curves for null curves 2020-02-14 10:54:46 -08:00
Grant Sanderson
b0b71910a5 Couple notes on the problems with Mobject.show 2020-02-14 10:53:52 -08:00
Grant Sanderson
bf83aed43b Have ANTI_ALIAS_WIDTH scale with frame size 2020-02-14 10:53:05 -08:00
Grant Sanderson
1a0b0e748c Fixed pixel_coords_to_space_coords 2020-02-14 10:52:39 -08:00
Grant Sanderson
0912043248 get_shader_data_array -> get_blank_shader_data_array 2020-02-13 15:51:16 -08:00
Grant Sanderson
cfbcd9faa8 Remove distinction between moving mobjects and static mobjects...computations to figure this out may now outweigh the actual render times they save 2020-02-13 15:42:53 -08:00
Grant Sanderson
5df2d3db33 Have mobjects keep track of a consistent shader data array to avoid unneeded numpy initializing 2020-02-13 15:41:57 -08:00
Grant Sanderson
c654ca4506 Remove usage of np.append 2020-02-13 12:03:54 -08:00
Grant Sanderson
c780a7471b Default SVG paths and dots to have locked triangulation 2020-02-13 11:56:39 -08:00
Grant Sanderson
095a3ef28c Change how bounding box points are calculated, in anticipation of a time when these are more intelligently cached 2020-02-13 11:43:59 -08:00
Grant Sanderson
574b464a3c get_critical_point -> get_bounding_box_point 2020-02-13 10:54:09 -08:00
Grant Sanderson
176079b678 Note that ZoomedScene is broken 2020-02-13 10:50:56 -08:00
Grant Sanderson
8db7756d2e A little more window initialization 2020-02-13 10:50:38 -08:00
Grant Sanderson
7789038409 Fix bug with fbo initialization 2020-02-13 10:49:43 -08:00
Grant Sanderson
53abf506fc Change config defaults 2020-02-13 10:49:25 -08:00
Grant Sanderson
183bae0825 Move window operations to Scene 2020-02-13 10:42:07 -08:00
Grant Sanderson
c591954fc3 Small formatting change 2020-02-13 10:41:55 -08:00
Grant Sanderson
65828e0e36 Have mobjects pass texture data to camera, and change pixel_shape to come from the fbo viewport 2020-02-13 10:40:21 -08:00
Grant Sanderson
e5d8f83dbf Implemented ImageMobject with shaders 2020-02-13 10:39:26 -08:00
Grant Sanderson
3f0cc56665 Separate out the point_to_gl_Position function, which needs to be updated later 2020-02-12 18:05:22 -08:00
Grant Sanderson
50c7dd7d48 Don't have fill shader use quick (flawed) sdf 2020-02-12 13:24:15 -08:00
Grant Sanderson
eb89d45937 Have get_quadratic_approximation_of_cubic default to midpoint when there is no inflection 2020-02-12 12:53:21 -08:00
Grant Sanderson
cb31ce3049 Temporarily(?) allow stroke shader to sometimes cross triangles so as to avoid other artifacts 2020-02-12 12:51:36 -08:00
Grant Sanderson
ec90bb2e8a Change step size defaults on ParametricFunction 2020-02-12 12:49:46 -08:00
Grant Sanderson
5cfae1ea75 Remove unneeded import 2020-02-12 11:50:05 -08:00
Grant Sanderson
4b827adfee Rewrite insert_n_curves_to_point_list to be faster and more even. And honestly much less confusing 2020-02-12 11:49:51 -08:00
Grant Sanderson
c0a29c4c74 Have partial_bezier_points return list, not numpy array 2020-02-12 11:49:16 -08:00
Grant Sanderson
9835813679 Rename generate_points to init_points 2020-02-11 19:55:00 -08:00
Grant Sanderson
c7a99769ce Change order of camera.reset_pixel_shape args 2020-02-11 19:53:15 -08:00
Grant Sanderson
19814ecf87 Allow mobject to prepare and cleanup from animations 2020-02-11 19:52:41 -08:00
Grant Sanderson
ebd4016fb3 Small refactor of extract_scene et. al. 2020-02-11 19:52:14 -08:00
Grant Sanderson
960e918e61 Basic preview window 2020-02-11 19:51:19 -08:00
Grant Sanderson
2cf21fd0ad Add file opening operations to SceneFileWriter 2020-02-11 19:50:36 -08:00
Grant Sanderson
15e3178721 Incorporate frame_center in translation to gl_Position 2020-02-11 19:49:54 -08:00
Grant Sanderson
052aa8afe2 Changed angle methods 2020-02-11 19:48:50 -08:00
Grant Sanderson
699b886d68 Have svg paths subdivide sharper curves 2020-02-10 14:48:53 -08:00
Grant Sanderson
3634cb712d Fix triangulation 2020-02-10 14:48:28 -08:00
Grant Sanderson
f98513dfc2 Remove unneeded import 2020-02-10 14:48:07 -08:00
Grant Sanderson
7ce75bdb52 Added wrapper around mapbox triangulation to make it work for polygons with holes 2020-02-10 14:47:36 -08:00
Grant Sanderson
b243c522b1 Have Mobject pass their own render primative 2020-02-07 09:37:21 -08:00
Grant Sanderson
1018cca4eb Remove unneeded import 2020-02-07 09:36:56 -08:00
Grant Sanderson
1e0c701733 Change behavior of Z in svg commands 2020-02-07 09:35:57 -08:00
Grant Sanderson
247f3ac2c4 Change behavior of Z command in svgs 2020-02-07 09:35:28 -08:00
Grant Sanderson
050ed718e5 Small todo stubs as a reminder to relpace 3d VMobject material 2020-02-07 09:32:38 -08:00
Grant Sanderson
9b3d294464 Change fill shaders to compute orientation inside 2020-02-07 09:31:57 -08:00
Grant Sanderson
db0029c32b Fix error in get_quadratic_approximation_of_cubic 2020-02-07 09:31:06 -08:00
Grant Sanderson
1a13d32452 Get rid of join_structured_arrays 2020-02-07 09:30:47 -08:00
Grant Sanderson
6892e511fe Trying a smaller anti_alias width 2020-02-06 10:03:42 -08:00
Grant Sanderson
10b9f2224f Change fallback directory for pi creature 2020-02-06 10:03:04 -08:00
Grant Sanderson
ccef2485b2 Refactor svg reading 2020-02-06 10:02:42 -08:00
Grant Sanderson
8c07fcca24 Various add_smooth_curve_to functions 2020-02-06 10:02:13 -08:00
Grant Sanderson
cf2d8d47e6 Fixed get_quadratic_approximation_of_cubic to account for cubics with an inflection point between 0 and 1 2020-02-06 10:01:19 -08:00
Grant Sanderson
7685fd03c6 Whoops, let an accidental deletion slip through 2020-02-06 10:00:55 -08:00
Grant Sanderson
6db6e858c4 Change tuplify to listify 2020-02-05 14:47:14 -08:00
Grant Sanderson
661bf33982 Change CubicBezier parameters 2020-02-05 14:46:45 -08:00
Grant Sanderson
f8d7daa14f Change geometry mobjects to work with quadratic bezier curves 2020-02-05 14:46:25 -08:00
Grant Sanderson
f8d293493f Change VMobject to operate with quadratic bezier curves 2020-02-05 14:46:04 -08:00
Grant Sanderson
0a82229ac1 Have stroke/fill vert shaders take in 3d points 2020-02-05 14:45:42 -08:00
Grant Sanderson
025f6d9524 Tiny stylistic change to rgb_to_hex 2020-02-05 14:44:35 -08:00
Grant Sanderson
c34bb7912c Added stretch_array_to_length_with_interpolation 2020-02-05 14:44:16 -08:00
Grant Sanderson
9da5ef4743 Changing patron name default 2020-02-04 15:29:05 -08:00
Grant Sanderson
0fe05ce07d Starting to chase scene to account for a shader-based camera 2020-02-04 15:28:50 -08:00
Grant Sanderson
1549998a19 Adding ANTI_ALIAS_WIDTH and SHADER_DIR, removing DEFAULT_POINT_DENSITY_* 2020-02-04 15:28:29 -08:00
Grant Sanderson
e185b87195 Moving some functions away from MovingCamera. Soon, all that should be default behavior of Camera 2020-02-04 15:27:50 -08:00
Grant Sanderson
63e5f343a3 Begin setting up Camera to work with shaders, not yet done 2020-02-04 15:27:21 -08:00
Grant Sanderson
81dde53f5a Get rid of various PMobject types 2020-02-04 15:26:39 -08:00
Grant Sanderson
8488b9053d Removed live_streaming conditions, as those don't work anyway and will be replaced in functionality soon. Also have the ffmpeg pipe take in raw bytes directly, rather than going through the intermediary of a numpy array 2020-02-04 15:26:09 -08:00
Grant Sanderson
ed376e475d Added get_quadratic_approximation_of_cubic 2020-02-04 15:25:08 -08:00
Grant Sanderson
24d3ba8680 Added join_structured_arrays 2020-02-04 15:24:40 -08:00
Grant Sanderson
13b69a14d8 Added find_intersection 2020-02-04 15:24:16 -08:00
Grant Sanderson
8638f7303a Added quadratic bezier shader files 2020-02-03 10:52:39 -08:00
Grant Sanderson
3c57c461b5 Merge 2020-02-03 09:17:35 -08:00
Grant Sanderson
edd447527d Added small todo stub 2020-02-03 09:11:51 -08:00
Grant Sanderson
40c8b7db76 Removed the option for displaying to excluse submobjects 2020-01-16 11:04:11 -08:00
Grant Sanderson
1609be6d49 Created and moved extract_mobject_family_members and restructure_list_to_exclude_certain_family_members functions 2020-01-15 18:30:58 -08:00
Grant Sanderson
1917349c4a Removed foreground mobjects 2020-01-15 18:01:28 -08:00
Grant Sanderson
cd14dea021 Beginning beta project 2020-01-15 18:00:43 -08:00
455 changed files with 17427 additions and 286959 deletions

View File

@@ -1,14 +0,0 @@
### If this is a support request:
**Please attempt to solve the problem on your own before opening an issue.**
Between old issues, StackOverflow, and Google, you should be able to find
solutions to most of the common problems.
Include at least:
1. Steps to reproduce the issue (e.g. the command you ran)
2. The unexpected behavior that occurred (e.g. error messages or screenshots)
3. The environment (e.g. operating system and version of manim)
### If this is a feature request:
Include the motivation for making this change.

20
.github/ISSUE_TEMPLATE/bug_report.md vendored Normal file
View File

@@ -0,0 +1,20 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: bug
assignees: ''
---
### Describe the bug
<!-- A clear and concise description of what the bug is. -->
**Code**:
<!-- The code you run which reflect the bug. -->
**Wrong display or Error traceback**:
<!-- the wrong display result of the code you run, or the error Traceback -->
### Additional context
<!-- Add any other context about the problem here. -->

5
.github/ISSUE_TEMPLATE/config.yml vendored Normal file
View File

@@ -0,0 +1,5 @@
blank_issues_enabled: true
contact_links:
- name: Ask A Question
url: https://github.com/3b1b/manim/discussions/categories/q-a
about: Please ask questions you encountered here.

View File

@@ -0,0 +1,23 @@
---
name: Error when using
about: The error you encountered while using manim
title: ''
labels: ''
assignees: ''
---
### Describe the error
<!-- A clear and concise description of what you want to make. -->
### Code and Error
**Code**:
<!-- The code you run -->
**Error**:
<!-- The error traceback you get when run your code -->
### Environment
**OS System**:
**manim version**: master <!-- make sure you are using the latest version of master branch -->
**python version**:

View File

@@ -1,9 +1,18 @@
Thanks for contributing to manim!
<!-- Thanks for contributing to manim!
Please ensure that your pull request works with the latest version of manim.
-->
**Please ensure that your pull request works with the latest version of manim.**
You should also include:
## Motivation
<!-- Outline your motivation: In what way do your changes improve the library? -->
1. The motivation for making this change (or link the relevant issues)
2. How you tested the new behavior (e.g. a minimal working example, before/after
screenshots, gifs, commands, etc.) This is rather informal at the moment, but
the goal is to show us how you know the pull request works as intended.
## Proposed changes
<!-- What you changed in those files -->
-
-
-
## Test
<!-- How do you test your changes -->
**Code**:
**Result**:

40
.github/workflows/docs.yml vendored Normal file
View File

@@ -0,0 +1,40 @@
name: docs
on:
push:
paths:
- 'docs/**'
pull_request:
paths:
- 'docs/**'
jobs:
docs:
runs-on: ubuntu-latest
name: build up document and deploy
steps:
- name: Checkout
uses: actions/checkout@master
- name: Install sphinx and manim env
run: |
pip3 install --upgrade pip
sudo apt install python3-setuptools libpango1.0-dev
pip3 install -r docs/requirements.txt
pip3 install -r requirements.txt
- name: Build document with Sphinx
run: |
cd docs
export PATH="$PATH:/home/runner/.local/bin"
export SPHINXBUILD="python3 -m sphinx"
make html
- name: Deploy to GitHub pages
if: ${{ github.event_name == 'push' }}
uses: JamesIves/github-pages-deploy-action@3.7.1
with:
ACCESS_TOKEN: ${{ secrets.DOC_DEPLOY_TOKEN }}
BRANCH: gh-pages
FOLDER: docs/build/html

37
.github/workflows/publish.yml vendored Normal file
View File

@@ -0,0 +1,37 @@
name: Upload Python Package
on:
release:
types: [created]
jobs:
deploy:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python: ["py37", "py38", "py39", "py310"]
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.8'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine build
- name: Build wheels
run: python setup.py bdist_wheel --python-tag ${{ matrix.python }}
- name: Upload wheels
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
twine upload dist/*

178
.gitignore vendored
View File

@@ -1,28 +1,152 @@
*.pyc
*.bak
.DS_Store
homeless.py
playground.py
cairo_test.py
mayavi_test.py
random_scenes/
files/
assets/
ben_playground.py
ben_cairo_test.py
.floo
.flooignore
.vscode
.vs
*.xml
*.iml
media
manim.sublime-project
manim.sublime-workspace
.eggs/
build/
dist/
manim.egg-info/
# Created by https://www.toptal.com/developers/gitignore/api/python
# Edit at https://www.toptal.com/developers/gitignore?templates=python
primes.py
/media_dir.txt
### Python ###
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
manimlib.egg-info/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
pytestdebug.log
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
doc/_build/
# PyBuilder
target/
# Jupyter Notebook
.ipynb_checkpoints
# IPython
profile_default/
ipython_config.py
# pyenv
.python-version
# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/
# Celery stuff
celerybeat-schedule
celerybeat.pid
# SageMath parsed files
*.sage.py
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
pythonenv*
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
.dmypy.json
dmypy.json
# Pyre type checker
.pyre/
# pytype static type analyzer
.pytype/
# profiling data
.prof
# End of https://www.toptal.com/developers/gitignore/api/python
# Custom exclusions:
.DS_Store
# For manim
/videos
/custom_config.yml

View File

@@ -1,30 +0,0 @@
language: python
dist: bionic
python: "3.7"
cache: pip
addons:
apt:
packages:
- python3-sphinx
install:
- pip install --upgrade pip
- pip install -r requirements.txt
- pip install flake8
before_script:
# stop the build if there are Python syntax errors or undefined names
- flake8 manimlib/ --count --select=E9,F63,F72,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
- flake8 manimlib/ --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
script:
- python setup.py test
- python setup.py bdist_wheel
after_success:
- test $TRAVIS_BRANCH = "master" && test $TRAVIS_PULL_REQUEST = "false" && travis/build_docs.sh
deploy:
provider: pypi
user: eulertour
on:
tags: true
password:
secure: j5M2hiJo9kDWJhl0/iSuIQmfd2G2O1Qoc455AkUPMCheAcALnX9xJgFsYBmqfgOXTCtUCQf52XGdOIG4o4s5TY340NZ9eLKI9cWae+sTeSrDCkdwChUilm3D0jQf1FWPUf9ywScwGi20m0sRtzxEJyTuX+JMFd7PIa8bFoDXWPtEjoFOOJrfBusMsANzrI+j+vIMdJ48lc1J8UsQdZapwusTrYU9s12JLhKBPLavmaDKf0HDAJdEhFQ9SaINdkiW/QY8qbfJ/MVu5jHai168zXjD/IaswxoKqCO1G+fWlOq3KwVhG7gI7rwhnnuF+wcA7yLAaMdo0CjO2V7z15S6cG721V2Il2IIh1jq0F8irSH1ZOLOkv/fFk9hkSUQyEU0i8k4m1wE9L47a6GP/66+b+gI91PGfxBOqq4gE/1BdZJqceh0qc13KpcehtYrQwR05bSw0Ye5OoTkqAnCeON0B0Ur4ejfHd3TzkjgB06fw76cZtjAK8f/YjB3KyNCvysOixgzE4tRxlY92yX/tAKZ3iX3yD0MjsinSfwo52N5sIEaCS/FmPRMhJOQBa6ftkfbcUNQBTG9G3b134XXF/LbC4vBloCaTm5VSXagta+oY3SFKQxPAZXx7X+wcFGjqxDjZXG1e66QnA2JJH4aBDsRfSXmUtD8MblwFYdcCJWz+Ck=

View File

@@ -1,19 +0,0 @@
FROM python:3.7
RUN apt-get update \
&& apt-get install -qqy --no-install-recommends \
apt-utils \
ffmpeg \
sox \
libcairo2-dev \
texlive \
texlive-fonts-extra \
texlive-latex-extra \
texlive-latex-recommended \
texlive-science \
tipa \
&& rm -rf /var/lib/apt/lists/*
COPY . /manim
RUN cd /manim \
&& python setup.py sdist \
&& python -m pip install dist/manimlib*
ENTRYPOINT ["/bin/bash"]

View File

@@ -1,10 +1,6 @@
All files of this project under the directory "from_3b1b" are copyright 3Blue1Brown LLC and used by permission for this project only.
Any other file of this project is available under the MIT license as follow:
MIT License
Copyright (c) 2018 3Blue1Brown LLC
Copyright (c) 2020 3Blue1Brown LLC
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

2
MANIFEST.in Normal file
View File

@@ -0,0 +1,2 @@
graft manimlib
recursive-exclude manimlib *.pyc *.DS_Store

157
README.md
View File

@@ -1,138 +1,117 @@
![logo](logo/cropped.png)
<p align="center">
<a href="https://github.com/3b1b/manim">
<img src="https://raw.githubusercontent.com/3b1b/manim/master/logo/cropped.png">
</a>
</p>
[![Build Status](https://travis-ci.org/3b1b/manim.svg?branch=master)](https://travis-ci.org/3b1b/manim)
[![Documentation](https://img.shields.io/badge/docs-EulerTour-blue.svg)](https://www.eulertour.com/docs)
[![pypi version](https://img.shields.io/pypi/v/manimgl?logo=pypi)](https://pypi.org/project/manimgl/)
[![MIT License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat)](http://choosealicense.com/licenses/mit/)
[![Manim Subreddit](https://img.shields.io/reddit/subreddit-subscribers/manim.svg?color=ff4301&label=reddit)](https://www.reddit.com/r/manim/)
[![Manim Discord](https://img.shields.io/discord/581738731934056449.svg?label=discord)](https://discord.gg/mMRrZQW)
[![Manim Subreddit](https://img.shields.io/reddit/subreddit-subscribers/manim.svg?color=ff4301&label=reddit&logo=reddit)](https://www.reddit.com/r/manim/)
[![Manim Discord](https://img.shields.io/discord/581738731934056449.svg?label=discord&logo=discord)](https://discord.com/invite/bYCyhM9Kz2)
[![docs](https://github.com/3b1b/manim/workflows/docs/badge.svg)](https://3b1b.github.io/manim/)
Manim is an animation engine for explanatory math videos. It's used to create precise animations programmatically, as seen in the videos at [3Blue1Brown](https://www.3blue1brown.com/).
Manim is an engine for precise programmatic animations, designed for creating explanatory math videos.
This repository contains the version of manim used by 3Blue1Brown. There is also a community maintained version at https://github.com/ManimCommunity/manim/.
To get help or to join the development effort, please join the [discord](https://discord.gg/mMRrZQW).
Note, there are two versions of manim. This repository began as a personal project by the author of [3Blue1Brown](https://www.3blue1brown.com/) for the purpose of animating those videos, with video-specific code available [here](https://github.com/3b1b/videos). In 2020 a group of developers forked it into what is now the [community edition](https://github.com/ManimCommunity/manim/), with a goal of being more stable, better tested, quicker to respond to community contributions, and all around friendlier to get started with. See [this page](https://docs.manim.community/en/stable/installation/versions.html?highlight=OpenGL#which-version-to-use) for more details.
## Installation
Manim runs on Python 3.6 or higher version. You can install it from PyPI via pip:
> **WARNING:** These instructions are for ManimGL _only_. Trying to use these instructions to install [ManimCommunity/manim](https://github.com/ManimCommunity/manim) or instructions there to install this version will cause problems. You should first decide which version you wish to install, then only follow the instructions for your desired version.
>
> **Note**: To install manim directly through pip, please pay attention to the name of the installed package. This repository is ManimGL of 3b1b. The package name is `manimgl` instead of `manim` or `manimlib`. Please use `pip install manimgl` to install the version in this repository.
Manim runs on Python 3.7 or higher.
System requirements are [FFmpeg](https://ffmpeg.org/), [OpenGL](https://www.opengl.org/) and [LaTeX](https://www.latex-project.org) (optional, if you want to use LaTeX).
For Linux, [Pango](https://pango.gnome.org) along with its development headers are required. See instruction [here](https://github.com/ManimCommunity/ManimPango#building).
### Directly
```sh
pip3 install manimlib
```
# Install manimgl
pip install manimgl
System requirements are [cairo](https://www.cairographics.org), [ffmpeg](https://www.ffmpeg.org), [sox](http://sox.sourceforge.net) (optional, if you want to play the prompt tone after running), [latex](https://www.latex-project.org) (optional, if you want to use LaTeX).
You can now use it via the `manim` command. For example:
```sh
manim my_project.py MyScene
# Try it out
manimgl
```
For more options, take a look at the [Using manim](#using-manim) sections further below.
### Directly
If you want to hack on manimlib itself, clone this repository and in that directory execute:
```sh
# Install python requirements
python3 -m pip install -r requirements.txt
# Install manimgl
pip install -e .
# Try it out
python3 ./manim.py example_scenes.py SquareToCircle -pl
manimgl example_scenes.py OpeningManimExample
# or
manim-render example_scenes.py OpeningManimExample
```
### Directly (Windows)
1. [Install FFmpeg](https://www.wikihow.com/Install-FFmpeg-on-Windows).
2. [Install Cairo](https://www.lfd.uci.edu/~gohlke/pythonlibs/#pycairo). For most users, ``pycairo1.18.0cp37cp37mwin32.whl`` will do fine (you can download it or other versions from [here](https://www.lfd.uci.edu/~gohlke/pythonlibs/#pycairo)).
```sh
pip3 install C:\path\to\wheel\pycairo1.18.0cp37cp37mwin32.whl
```
3. Install a LaTeX distribution. [MiKTeX](https://miktex.org/download) is recommended.
4. [Install SoX](https://sourceforge.net/projects/sox/files/sox/).
5. Install the remaining Python packages.
2. Install a LaTeX distribution. [MiKTeX](https://miktex.org/download) is recommended.
3. Install the remaining Python packages.
```sh
git clone https://github.com/3b1b/manim.git
cd manim
pip3 install -r requirements.txt
python3 manim.py example_scenes.py SquareToCircle -pl
pip install -e .
manimgl example_scenes.py OpeningManimExample
```
### Mac OSX
1. Install FFmpeg, LaTeX in terminal using homebrew.
```sh
brew install ffmpeg mactex
```
2. Install latest version of manim using these command.
```sh
git clone https://github.com/3b1b/manim.git
cd manim
pip install -e .
manimgl example_scenes.py OpeningManimExample
```
## Anaconda Install
* Install sox and latex as above.
* Create a conda environment using `conda env create -f environment.yml`
* **WINDOWS ONLY** Install `pyreadline` via `pip install pyreadline`.
1. Install LaTeX as above.
2. Create a conda environment using `conda create -n manim python=3.8`.
3. Activate the environment using `conda activate manim`.
4. Install manimgl using `pip install -e .`.
### Using `virtualenv` and `virtualenvwrapper`
After installing `virtualenv` and `virtualenvwrapper`
```sh
git clone https://github.com/3b1b/manim.git
mkvirtualenv -a manim -r requirements.txt manim
python3 -m manim example_scenes.py SquareToCircle -pl
```
### Using Docker
Since it's a bit tricky to get all the dependencies set up just right, there is a Dockerfile and Compose file provided in this repo as well as [a premade image on Docker Hub](https://hub.docker.com/r/eulertour/manim/tags/). The Dockerfile contains instructions on how to build a manim image, while the Compose file contains instructions on how to run the image.
The prebuilt container image has manim repository included.
`INPUT_PATH` is where the container looks for scene files. You must set the `INPUT_PATH`
environment variable to the absolute path containing your scene file and the
`OUTPUT_PATH` environment variable to the directory where you want media to be written.
1. [Install Docker](https://docs.docker.com)
2. [Install Docker Compose](https://docs.docker.com/compose/install/)
3. Render an animation:
```sh
INPUT_PATH=/path/to/dir/containing/source/code \
OUTPUT_PATH=/path/to/output/ \
docker-compose run manim example_scenes.py SquareToCircle -l
```
The command needs to be run as root if your username is not in the docker group.
You can replace `example.scenes.py` with any relative path from your `INPUT_PATH`.
![docker diagram](./manim_docker_diagram.png)
After running the output will say files ready at `/tmp/output/`, which refers to path inside the container. Your `OUTPUT_PATH` is bind mounted to this `/tmp/output` so any changes made by the container to `/tmp/output` will be mirrored on your `OUTPUT_PATH`. `/media/` will be created in `OUTPUT_PATH`.
`-p` won't work as manim would look for video player in the container system, which it does not have.
The first time you execute the above command, Docker will pull the image from Docker Hub and cache it. Any subsequent runs until the image is evicted will use the cached image.
Note that the image doesn't have any development tools installed and can't preview animations. Its purpose is building and testing only.
## Using manim
Try running the following:
```sh
python3 -m manim example_scenes.py SquareToCircle -pl
manimgl example_scenes.py OpeningManimExample
```
The `-p` flag in the command above is for previewing, meaning the video file will automatically open when it is done rendering. The `-l` flag is for a faster rendering at a lower quality.
This should pop up a window playing a simple scene.
Some other useful flags include:
Some useful flags include:
* `-w` to write the scene to a file
* `-o` to write the scene to a file and open the result
* `-s` to skip to the end and just show the final frame.
* `-so` will save the final frame to an image and show it
* `-n <number>` to skip ahead to the `n`'th animation of a scene.
* `-f` to show the file in finder (for OSX).
* `-f` to make the playback window fullscreen
Set `MEDIA_DIR` environment variable to specify where the image and animation files will be written.
Take a look at custom_config.yml for further configuration. To add your customization, you can either edit this file, or add another file by the same name "custom_config.yml" to whatever directory you are running manim from. For example [this is the one](https://github.com/3b1b/videos/blob/master/custom_config.yml) for 3blue1brown videos. There you can specify where videos should be output to, where manim should look for image files and sounds you want to read in, and other defaults regarding style and video quality.
Look through the `old_projects` folder to see the code for previous 3b1b videos. Note, however, that developments are often made to the library without considering backwards compatibility with those old projects. To run an old project with a guarantee that it will work, you will have to go back to the commit which completed that project.
While developing a scene, the `-sp` flags are helpful to just see what things look like at the end without having to generate the full animation. It can also be helpful to use the `-n` flag to skip over some number of animations.
Look through the [example scenes](https://3b1b.github.io/manim/getting_started/example_scenes.html) to get a sense of how it is used, and feel free to look through the code behind [3blue1brown videos](https://github.com/3b1b/videos) for a much larger set of example. Note, however, that developments are often made to the library without considering backwards compatibility with those old videos. To run an old project with a guarantee that it will work, you will have to go back to the commit which completed that project.
### Documentation
Documentation is in progress at [eulertour.com/docs](https://www.eulertour.com/docs/). And there is also an all-in-one documentation and tutorials maintained by **@manim-kindergarten**: [manim.ml](https://manim.ml/) (in Chinese).
### Walkthrough
Todd Zimmerman put together a [tutorial](https://talkingphysics.wordpress.com/2019/01/08/getting-started-animating-with-manim-and-python-3-7/) on getting started with manim, which has been updated to run on Python 3.7.
Documentation is in progress at [3b1b.github.io/manim](https://3b1b.github.io/manim/). And there is also a Chinese version maintained by [**@manim-kindergarten**](https://manim.org.cn): [docs.manim.org.cn](https://docs.manim.org.cn/) (in Chinese).
[manim-kindergarten](https://github.com/manim-kindergarten/) wrote and collected some useful extra classes and some codes of videos in [manim_sandbox repo](https://github.com/manim-kindergarten/manim_sandbox).
## Contributing
Only accepts pull requests that fixes bugs / fixes typos / improves existing content (for more information, see [#1243](https://github.com/3b1b/manim/issues/1243)). Most pull requests should be directed to the [community version](https://github.com/ManimCommunity/manim/).
Is always welcome. As mentioned above, the [community edition](https://github.com/ManimCommunity/manim) has the most active ecosystem for contributions, with testing and continuous integration, but pull requests are welcome here too. Please explain the motivation for a given change and examples of its effect.
## License
All files in the directory `from_3b1b`, which by and large generate the visuals for 3b1b videos, are copyright 3Blue1Brown.
The general purpose animation code found in the remainder of the repository, on the other hand, is under the MIT license.
This project falls under the MIT license.

View File

@@ -1,16 +0,0 @@
version: '3.1'
services:
manim:
# comment this line if you build the image to prevent overwriting the tag
image: eulertour/manim:latest
# uncomment this line to build rather than pull the image
# build: .
entrypoint:
- manim
- --media_dir=/tmp/output
volumes:
- ${INPUT_PATH:?INPUT_PATH environment variable isn't set}:/tmp/input
- ${OUTPUT_PATH:?OUTPUT_PATH environment variable isn't set}:/tmp/output
working_dir: /tmp/input
network_mode: "none"

View File

@@ -1,9 +1,10 @@
# Minimal makefile for Sphinx documentation
#
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = source
BUILDDIR = build
@@ -16,4 +17,4 @@ help:
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

37
docs/example.py Normal file
View File

@@ -0,0 +1,37 @@
from manimlib import *
class SquareToCircle(Scene):
def construct(self):
circle = Circle()
circle.set_fill(BLUE, opacity=0.5)
circle.set_stroke(BLUE_E, width=4)
square = Square()
self.play(ShowCreation(square))
self.wait()
self.play(ReplacementTransform(square, circle))
self.wait()
# Try typing the following lines
# self.play(circle.animate.stretch(4, dim=0))
# self.play(Rotate(circle, TAU / 4))
# self.play(circle.animate.shift(2 * RIGHT), circle.animate.scale(0.25))
# circle.insert_n_curves(10)
# self.play(circle.animate.apply_complex_function(lambda z: z**2))
class SquareToCircleEmbed(Scene):
def construct(self):
circle = Circle()
circle.set_fill(BLUE, opacity=0.5)
circle.set_stroke(BLUE_E, width=4)
self.add(circle)
self.wait()
self.play(circle.animate.stretch(4, dim=0))
self.wait(1.5)
self.play(Rotate(circle, TAU / 4))
self.wait(1.5)
self.play(circle.animate.shift(2 * RIGHT), circle.animate.scale(0.25))
self.wait(1.5)
circle.insert_n_curves(10)
self.play(circle.animate.apply_complex_function(lambda z: z**2))
self.wait(2)

View File

@@ -1,35 +1,35 @@
@ECHO OFF
pushd %~dp0
REM Command file for Sphinx documentation
if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=source
set BUILDDIR=build
if "%1" == "" goto help
%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.http://sphinx-doc.org/
exit /b 1
)
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
goto end
:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
:end
popd
@ECHO OFF
pushd %~dp0
REM Command file for Sphinx documentation
if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=source
set BUILDDIR=build
if "%1" == "" goto help
%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.http://sphinx-doc.org/
exit /b 1
)
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end
:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
:end
popd

4
docs/requirements.txt Normal file
View File

@@ -0,0 +1,4 @@
Sphinx==3.0.3
sphinx-copybutton
furo==2020.10.5b9
Jinja2

Binary file not shown.

After

Width:  |  Height:  |  Size: 184 KiB

View File

@@ -1,11 +0,0 @@
About
=====
Animating technical concepts is traditionally pretty tedious, since it can be
difficult to make the animations precise enough to convey them accurately.
``Manim`` uses Python to generate animations programmatically, which makes it
possible to specify exactly how each one should run.
This project is still very much a work in progress, but I hope that the
information here will make it easier for newcomers to get started using
``Manim``.

View File

@@ -1,210 +0,0 @@
Animation
=========
The simplest of which is ``Scene.add``. The object appears on the first frame
without any animation::
class NoAnimation(Scene):
def construct(self):
square = Square()
self.add(square))
Animation are used in conjunction with ``scene.Play``
Fade
----
.. raw:: html
<video width="560" height="315" controls>
<source src="_static/AnimationFadeIn.mp4" type="video/mp4">
</video>
.. code-block:: python
class AnimationFadeIn(Scene):
def construct(self):
square = Square()
anno = TextMobject("Fade In")
anno.shift(2 * DOWN)
self.add(anno)
self.play(FadeIn(square))
.. raw:: html
<video width="560" height="315" controls>
<source src="_static/AnimationFadeOut.mp4" type="video/mp4">
</video>
.. code-block:: python
class AnimationFadeOut(Scene):
def construct(self):
square = Square()
anno = TextMobject("Fade Out")
anno.shift(2 * DOWN)
self.add(anno)
self.add(square)
self.play(FadeOut(square))
.. raw:: html
<video width="560" height="315" controls>
<source src="_static/AnimationFadeInFrom.mp4" type="video/mp4">
</video>
.. code-block:: python
class AnimationFadeInFrom(Scene):
def construct(self):
square = Square()
for label, edge in zip(
["LEFT", "RIGHT", "UP", "DOWN"], [LEFT, RIGHT, UP, DOWN]
):
anno = TextMobject(f"Fade In from {label}")
anno.shift(2 * DOWN)
self.add(anno)
self.play(FadeInFrom(square, edge))
self.remove(anno, square)
.. raw:: html
<video width="560" height="315" controls>
<source src="_static/AnimationFadeOutAndShift.mp4" type="video/mp4">
</video>
.. code-block:: python
class AnimationFadeOutAndShift(Scene):
def construct(self):
square = Square()
for label, edge in zip(
["LEFT", "RIGHT", "UP", "DOWN"], [LEFT, RIGHT, UP, DOWN]
):
anno = TextMobject(f"Fade Out and shift {label}")
anno.shift(2 * DOWN)
self.add(anno)
self.play(FadeOutAndShift(square, edge))
self.remove(anno, square)
.. raw:: html
<video width="560" height="315" controls>
<source src="_static/AnimationFadeInFromLarge.mp4" type="video/mp4">
</video>
.. code-block:: python
class AnimationFadeInFromLarge(Scene):
def construct(self):
square = Square()
for factor in [0.1, 0.5, 0.8, 1, 2, 5]:
anno = TextMobject(f"Fade In from large scale\_factor={factor}")
anno.shift(2 * DOWN)
self.add(anno)
self.play(FadeInFromLarge(square, scale_factor=factor))
self.remove(anno, square)
.. raw:: html
<video width="560" height="315" controls>
<source src="_static/AnimationFadeInFromPoint.mp4" type="video/mp4">
</video>
.. code-block:: python
class AnimationFadeInFromPoint(Scene):
def construct(self):
square = Square()
for i in range(-6, 7, 2):
anno = TextMobject(f"Fade In from point {i}")
anno.shift(2 * DOWN)
self.add(anno)
self.play(FadeInFromPoint(square, point=i))
self.remove(anno, square)
Grow
----
.. raw:: html
<video width="560" height="315" controls>
<source src="_static/AnimationGrowFromEdge.mp4" type="video/mp4">
</video>
.. code-block:: python
class AnimationGrowFromEdge(Scene):
def construct(self):
for label, edge in zip(
["LEFT", "RIGHT", "UP", "DOWN"], [LEFT, RIGHT, UP, DOWN]
):
anno = TextMobject(f"Grow from {label} edge")
anno.shift(2 * DOWN)
self.add(anno)
square = Square()
self.play(GrowFromEdge(square, edge))
self.remove(anno, square)
.. raw:: html
<video width="560" height="315" controls>
<source src="_static/AnimationGrowFromCenter.mp4" type="video/mp4">
</video>
.. code-block:: python
class AnimationGrowFromCenter(Scene):
def construct(self):
square = Square()
anno = TextMobject("Grow from center")
anno.shift(2 * DOWN)
self.add(anno)
self.play(GrowFromCenter(square))
Diagonal Directions
-------------------
You can combine cardinal directions to form diagonal animations
.. raw:: html
<video width="560" height="315" controls>
<source src="_static/AnimationFadeInFromDiagonal.mp4" type="video/mp4">
</video>
.. code-block:: python
class AnimationFadeInFromDiagonal(Scene):
def construct(self):
square = Square()
for diag in [UP + LEFT, UP + RIGHT, DOWN + LEFT, DOWN + RIGHT]:
self.play(FadeInFrom(square, diag))
.. note::
You can also use the abbreviated forms like ``UL, UR, DL, DR``.
See :ref:`ref-directions`.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

View File

@@ -1,53 +1,43 @@
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup --------------------------------------------------------------
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
# import os
# import sys
# sys.path.insert(0, os.path.abspath('.'))
import os
import sys
sys.path.insert(0, os.path.abspath("."))
sys.path.insert(0, os.path.abspath('../../'))
# -- Project information -----------------------------------------------------
project = 'manim'
copyright = '- This document has been placed in the public domain.'
author = 'TonyCrane'
project = 'Manim'
copyright = '2019, EulerTour'
author = 'EulerTour'
release = ''
# -- General configuration ---------------------------------------------------
master_doc = 'index'
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.todo',
'sphinx.ext.githubpages',
'sphinx.ext.mathjax',
'sphinx.ext.intersphinx',
'sphinx.ext.autodoc',
'sphinx.ext.coverage',
'sphinx.ext.napoleon',
'sphinx_copybutton',
'manim_example_ext'
]
# Add any paths that contain templates here, relative to this directory.
autoclass_content = 'both'
mathjax_path = "https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"
templates_path = ['_templates']
source_suffix = '.rst'
master_doc = 'index'
pygments_style = 'default'
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = []
# -- Options for HTML output -------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'sphinx_rtd_theme'
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['assets']
html_static_path = ["_static"]
html_css_files = [
"https://cdn.jsdelivr.net/gh/manim-kindergarten/CDN@master/manimgl_assets/custom.css",
"https://cdn.jsdelivr.net/gh/manim-kindergarten/CDN@master/manimgl_assets/colors.css"
]
html_theme = 'furo' # pip install furo==2020.10.5b9
html_favicon = '_static/icon.png'
html_logo = '../../logo/transparent_graph.png'
html_theme_options = {
"sidebar_hide_name": True,
}

View File

@@ -1,94 +0,0 @@
Manim Constants
===============
The ``constants.py`` under ``manimlib/`` contains variables that are used
during setup and running manim. Some variables are not documented here as they are
only used internally by manim.
Directories
-----------
MEDIA_DIR
The directory where ``VIDEO_DIR`` and ``TEX_DIR`` will be created,
if they aren't specified via flags.
VIDEO_DIR
Used to store the scenes rendered by Manim. When a scene is
finished rendering, it will be stored under
``VIDEO_DIR/module_name/scene_name/quality/scene_name.mp4``.
Created under ``MEDIA_DIR`` by default.
TEX_DIR
Files written by Latex are stored here. It also acts as a cache
so that the files aren't rewritten each time Latex is needed.
Those directories are created if they don't exist.
Tex
---
TEX_USE_CTEX
A boolean value. Change it to True if you need to use Chinese typesetting.
TEX_TEXT_TO_REPLACE
Placeholder text used by manim when generating tex files
TEMPLATE_TEX_FILE
By default ``manimlib/tex_template.tex`` is used. If ``TEX_USE_CTEX``
is set to True then ``manimlib/ctex_template.tex`` is used.
Numerical Constants
-------------------
PI
alias to ``numpy.pi``
TAU
PI * 2
DEGREES
TAU / 360
Camera Configuration
--------------------
Render setting presets
PRODUCTION_QUALITY_CAMERA_CONFIG
2560x1440 @ 60fps # This is the default when rendering a scene
HIGH_QUALITY_CAMERA_CONFIG
1920x1080 @ 60fps. # Used when the ``-h`` or ``--high_quality`` flag
is passed.
MEDIUM_QUALITY_CAMERA_CONFIG
1280x720 @ 30fps. # Used when the ``-m`` or ``--medium_quality``
flag is passed.
LOW_QUALITY_CAMERA_CONFIG
854x480 @ 15fps. # Used when the ``-l`` or ``--low_quality`` flag is
passed.
.. _ref-directions:
Coordinates
-----------
Used for 2d/3d animations and placements::
ORIGIN
UP
DOWN
RIGHT
LEFT
IN # 3d camera only, away from camera
OUT # 3d camera only, close to camera
UL = UP + LEFT # diagonal abbreviations. You can use either one
UR = UP + RIGHT
DL = DOWN + LEFT
DR = DOWN + RIGHT
TOP
BOTTOM
LEFT_SIDE
RIGHT_SIDE``
Colors
------
COLOR_MAP
A predefined color maps
PALETTE
A list of color hex strings, derived from COLOR_MAP

View File

@@ -1,178 +0,0 @@
Coordinate
==========
By default, the scene in manim is made up by 8 x 14 grid. The grid is addressed using a numpy
array in the form of [x, y, z]. For 2D animations only the x and y axes are used.
.. code-block:: python
class DotMap(Scene):
def construct(self):
dots = dict()
annos = dict()
var_index = 0
for x in range(-7, 8):
for y in range(-4, 5):
annos[f"{x}{y}"] = TexMobject(f"({x}, {y})")
dots[f"{var_index}"] = Dot(np.array([x, y, 0]))
var_index = var_index + 1
for anno, dot in zip(annos.values(), dots.values()):
self.add(anno)
self.add(dot)
self.wait(0.2)
self.remove(anno)
.. raw:: html
<video width="700" height="394" controls>
<source src="_static/coordinate/DotMap.mp4" type="video/mp4">
</video>
.. note::
You can place objects outside this boundary, but it won't show up in the render.
Using Coordinates
-----------------
Coordinates are used for creating geometries (`VMobject` in manim) and animations.
Here coordinates are used to create this Polygon
.. code-block:: python
class CoorPolygon(Scene):
def construct(self):
for x in range(-7, 8):
for y in range(-4, 5):
self.add(Dot(np.array([x, y, 0]), color=DARK_GREY))
polygon = Polygon(
np.array([3, 2, 0]),
np.array([1, -1, 0]),
np.array([-5, -4, 0]),
np.array([-4, 4, 0]))
self.add(polygon)
.. Image:: assets/coordinate/CoorPolygon.png
:width: 700px
Coordinate Aliasing
-------------------
From some animations typing a ``np.array`` everytime you need a coordinate can be tedious.
Manim provides aliases to the most common coordinates::
UP == np.array([0, 1, 0])
DOWN == np.array([0, -1, 0])
LEFT == np.array([-1, 0, 0])
RIGHT == np.array([1, 0, 0])
UL == np.array([-1, 1, 0])
DL == np.array([-1, -1, 0])
UR == np.array([1, 1, 0])
DR == np.array([1, -1, 0])
Here coordinates are used for animations
.. code-block:: python
class CoorAlias(Scene):
def construct(self):
for x in range(-7, 8):
for y in range(-4, 5):
self.add(Dot(np.array([x, y, 0]), color=DARK_GREY))
aliases = {
"UP": UP,
"np.array([0,1,0])": np.array([0, 1, 0]),
"DOWN": DOWN,
"np.array([0,-1,0])": np.array([0, -1, 0]),
"LEFT": LEFT,
"np.array([-1,0,0])": np.array([-1, 0, 0]),
"RIGHT": RIGHT,
"np.array([1,0,0])": np.array([1, 0, 0]),
"UL": UL,
"np.array([-1,1,0])": np.array([-1, 1, 0]),
"DL": DL,
"np.array([-1,-1,0])": np.array([-1, -1, 0]),
"UR": UR,
"np.array([1,1,0])": np.array([1, 1, 0]),
"DR": DR,
"np.array([1,-1,0])": np.array([1, -1, 0])}
circle = Circle(color=RED, radius=0.5)
self.add(circle)
self.wait(0.5)
for text, aliase in aliases.items():
anno = TexMobject(f"\\texttt{{{text}}}")
self.play(Write(anno, run_time=0.2))
self.play(ApplyMethod(circle.shift, aliase))
self.wait(0.2)
self.play(FadeOut(anno, run_time=0.2))
.. raw:: html
<video width="700" height="394" controls>
<source src="_static/coordinate/CoorAlias.mp4" type="video/mp4">
</video>
Coordinate Arithmetic
---------------------
Numpy array allows arithmetic operations::
>>> numpy.array([2,2,0]) + 4
array([6, 6, 4])
>>> np.array([1, -3, 0]) + np.array([-4, 2, 0])
array([-3, -1, 0])
>>> np.array([2, 2, 0]) - np.array([3,6, 0])
array([-1, -4, 0])
>>> numpy.array([2,2,0]) - 3
array([-1, -1, -3])
>>> np.array([1, -3, 0]) * 3
array([ 3, -9, 0])
>>> numpy.array([2,2,0]) / 2
array([1., 1., 0.])
>>> numpy.array([2,2,0]) / numpy.array([1, 4, 0])
__main__:1: RuntimeWarning: invalid value encountered in true_divide
array([2. , 0.5, nan])
.. code-block:: python
class CoorArithmetic(Scene):
def construct(self):
for x in range(-7, 8):
for y in range(-4, 5):
self.add(Dot(np.array([x, y, 0]), color=DARK_GREY))
circle = Circle(color=RED, radius=0.5)
self.add(circle)
self.wait(0.5)
aliases = {
"LEFT * 3": LEFT * 3,
"UP + RIGHT / 2": UP + RIGHT / 2,
"DOWN + LEFT * 2": DOWN + LEFT * 2,
"RIGHT * 3.75 * DOWN": RIGHT * 3.75 * DOWN,
# certain arithmetic won't work as you expected
# In [4]: RIGHT * 3.75 * DOWN
# Out[4]: array([ 0., -0., 0.])
"RIGHT * 3.75 + DOWN": RIGHT * 3.75 + DOWN}
for text, aliase in aliases.items():
anno = TexMobject(f"\\texttt{{{text}}}")
self.play(Write(anno, run_time=0.2))
self.play(ApplyMethod(circle.shift, aliase))
self.wait(0.2)
self.play(FadeOut(anno, run_time=0.2))
.. raw:: html
<video width="700" height="394" controls>
<source src="_static/coordinate/CoorArithmetic.mp4" type="video/mp4">
</video>

View File

@@ -0,0 +1,31 @@
About
=====
About Manim
-----------
Manim is an animation engine for explanatory math videos.
You can use it to make math videos (or other fields) like 3Blue1Brown.
There are mainly two versions here:
- `3b1b/manim <https://github.com/3b1b/manim>`_ : Maintained by Grant Sanderson of 3Blue1Brown.
Using OpenGL and its GLSL language to use GPU for rendering. It has higher efficiency,
faster rendering speed, and supports real-time rendering and interaction.
- `ManimCommunity/manim <https://github.com/ManimCommunity/manim>`_ : Maintained by Manim Community Dev Team.
Using multiple backend rendering. There is better documentation and
a more open contribution community.
About this documentation
------------------------
This documentation is based on the version in `3b1b/manim <https://github.com/3b1b/manim>`_.
Created by `TonyCrane <https://github.com/TonyCrane>`_ ("鹤翔万里" in Chinese) and in production.
Among them, the ``manim_example_ext`` extension for Sphinx refers to
`the documentation of ManimCommunity <https://docs.manim.community/>`_.
If you want to contribute to manim or this document, please see: :doc:`contributing`

View File

@@ -0,0 +1,307 @@
Changelog
=========
v1.6.0
------
Breaking changes
^^^^^^^^^^^^^^^^
- **Python 3.6 is no longer supported** (`#1736 <https://github.com/3b1b/manim/pull/1736>`__)
Fixed bugs
^^^^^^^^^^
- Fixed the width of riemann rectangles (`#1762 <https://github.com/3b1b/manim/pull/1762>`__)
- Bug fixed in cases where empty array is passed to shader (`#1764 <https://github.com/3b1b/manim/pull/1764/commits/fa38b56fd87f713657c7f778f39dca7faf15baa8>`__)
- Fixed ``AddTextWordByWord`` (`#1772 <https://github.com/3b1b/manim/pull/1772>`__)
- Fixed ``ControlsExample`` (`#1781 <https://github.com/3b1b/manim/pull/1781>`__)
New features
^^^^^^^^^^^^
- Added more functions to ``Text`` (details: `#1751 <https://github.com/3b1b/manim/pull/1751>`__)
- Allowed ``interpolate`` to work on an array of alpha values (`#1764 <https://github.com/3b1b/manim/pull/1764/commits/bf2d9edfe67c7e63ac0107d1d713df7ae7c3fb8f>`__)
- Allowed ``Numberline.number_to_point`` and ``CoordinateSystem.coords_to_point`` to work on an array of inputs (`#1764 <https://github.com/3b1b/manim/pull/1764/commits/c3e13fff0587d3bb007e71923af7eaf9e4926560>`__)
- Added a basic ``Prismify`` to turn a flat ``VMobject`` into something with depth (`#1764 <https://github.com/3b1b/manim/pull/1764/commits/f249da95fb65ed5495cd1db1f12ece7e90061af6>`__)
- Added ``GlowDots``, analogous to ``GlowDot`` (`#1764 <https://github.com/3b1b/manim/pull/1764/commits/e19f35585d817e74b40bc30b1ab7cee84b24da05>`__)
- Added ``TransformMatchingStrings`` which is compatible with ``Text`` and ``MTex`` (`#1772 <https://github.com/3b1b/manim/pull/1772>`__)
- Added support for ``substring`` and ``case_sensitive`` parameters for ``LabelledString.get_parts_by_string`` (`#1780 <https://github.com/3b1b/manim/pull/1780>`__)
Refactor
^^^^^^^^
- Added type hints (`#1736 <https://github.com/3b1b/manim/pull/1736>`__)
- Specifid UTF-8 encoding for tex files (`#1748 <https://github.com/3b1b/manim/pull/1748>`__)
- Refactored ``Text`` with the latest manimpango (`#1751 <https://github.com/3b1b/manim/pull/1751>`__)
- Reorganized getters for ``ParametricCurve`` (`#1757 <https://github.com/3b1b/manim/pull/1757>`__)
- Refactored ``CameraFrame`` to use ``scipy.spatial.transform.Rotation`` (`#1764 <https://github.com/3b1b/manim/pull/1764/commits/625460467fdc01fc1b6621cbb3d2612195daedb9>`__)
- Refactored rotation methods to use ``scipy.spatial.transform.Rotation`` (`#1764 <https://github.com/3b1b/manim/pull/1764/commits/7bf3615bb15cc6d15506d48ac800a23313054c8e>`__)
- Used ``stroke_color`` to init ``Arrow`` (`#1764 <https://github.com/3b1b/manim/pull/1764/commits/c0b7b55e49f06b75ae133b5a810bebc28c212cd6>`__)
- Refactored ``Mobject.set_rgba_array_by_color`` (`#1764 <https://github.com/3b1b/manim/pull/1764/commits/8b1f0a8749d91eeda4b674ed156cbc7f8e1e48a8>`__)
- Made panning more sensitive to mouse movements (`#1764 <https://github.com/3b1b/manim/pull/1764/commits/9d0cc810c5fcb4252990e706c6bf880d571cb1a2>`__)
- Added loading progress for large SVGs (`#1766 <https://github.com/3b1b/manim/pull/1766>`__)
- Added getter/setter of ``field_of_view`` for ``CameraFrame`` (`#1770 <https://github.com/3b1b/manim/pull/1770/commits/0610f331a4f7a126a3aae34f8a2a86eabcb692f4>`__)
- Renamed ``focal_distance`` to ``focal_dist_to_height`` and added getter/setter (`#1770 <https://github.com/3b1b/manim/pull/1770/commits/0610f331a4f7a126a3aae34f8a2a86eabcb692f4>`__)
- Added getter and setter for ``VMobject.joint_type`` (`#1770 <https://github.com/3b1b/manim/pull/1770/commits/2a7a7ac5189a14170f883533137e8a2ae09aac41>`__)
- Refactored ``VCube`` (`#1770 <https://github.com/3b1b/manim/pull/1770/commits/0f8d7ed59751d42d5011813ba5694ecb506082f7>`__)
- Refactored ``Prism`` to receive ``width height depth`` instead of ``dimensions`` (`#1770 <https://github.com/3b1b/manim/pull/1770/commits/0f8d7ed59751d42d5011813ba5694ecb506082f7>`__)
- Refactored ``Text``, ``MarkupText`` and ``MTex`` based on ``LabelledString`` (`#1772 <https://github.com/3b1b/manim/pull/1772>`__)
- Refactored ``LabelledString`` and relevant classes (`#1779 <https://github.com/3b1b/manim/pull/1779>`__)
v1.5.0
------
Fixed bugs
^^^^^^^^^^
- Bug fix for the case of calling ``Write`` on a null object (`#1740 <https://github.com/3b1b/manim/pull/1740>`__)
New features
^^^^^^^^^^^^
- Added ``TransformMatchingMTex`` (`#1725 <https://github.com/3b1b/manim/pull/1725>`__)
- Added ``ImplicitFunction`` (`#1727 <https://github.com/3b1b/manim/pull/1727>`__)
- Added ``Polyline`` (`#1731 <https://github.com/3b1b/manim/pull/1731>`__)
- Allowed ``Mobject.set_points`` to take in an empty list, and added ``Mobject.add_point`` (`#1739 <https://github.com/3b1b/manim/pull/1739/commits/a64259158538eae6043566aaf3d3329ff4ac394b>`__)
- Added ``Scene.refresh_locked_data`` (`#1739 <https://github.com/3b1b/manim/pull/1739/commits/33d2894c167c577a15fdadbaf26488ff1f5bff87>`__)
- Added presenter mode to scenes with ``-p`` option (`#1739 <https://github.com/3b1b/manim/pull/1739/commits/9a9cc8bdacb7541b7cd4a52ad705abc21f3e27fe>`__ and `#1742 <https://github.com/3b1b/manim/pull/1742>`__)
- Allowed for an embed by hitting ``ctrl+shift+e`` during interaction (`#1739 <https://github.com/3b1b/manim/pull/1739/commits/9df12fcb7d8360e51cd7021d6877ca1a5c31835e>`__ and `#1746 <https://github.com/3b1b/manim/pull/1746>`__)
- Added ``Mobject.set_min_width/height/depth`` (`#1739 <https://github.com/3b1b/manim/pull/1739/commits/2798d15591a0375ae6bb9135473e6f5328267323>`__)
- Allowed ``Mobject.match_coord/x/y/z`` to take in a point (`#1739 <https://github.com/3b1b/manim/pull/1739/commits/29a4d3e82ba94c007c996b2d1d0f923941452698>`__)
- Added ``text_config`` to ``DecimalNumber`` (`#1744 <https://github.com/3b1b/manim/pull/1744>`__)
Refactor
^^^^^^^^
- Refactored ``MTex`` (`#1725 <https://github.com/3b1b/manim/pull/1725>`__)
- Refactored ``SVGMobject`` with svgelements (`#1731 <https://github.com/3b1b/manim/pull/1731>`__)
- Made sure ``ParametricCurve`` has at least one point (`#1739 <https://github.com/3b1b/manim/pull/1739/commits/2488b9e866fb1ecb842a27dd9f4956ec167e3dee>`__)
- Set default to no tips on ``Axes`` (`#1739 <https://github.com/3b1b/manim/pull/1739/commits/6c6d387a210756c38feca7d34838aa9ac99bb58a>`__)
- Stopped displaying when writing tex string is happening (`#1739 <https://github.com/3b1b/manim/pull/1739/commits/58e06e8f6b7c5059ff315d51fd0018fec5cfbb05>`__)
- Reorganize inheriting order and refactor SVGMobject (`#1745 <https://github.com/3b1b/manim/pull/1745>`__)
Dependencies
^^^^^^^^^^^^
- Added dependency on ``isosurfaces`` (`#1727 <https://github.com/3b1b/manim/pull/1727>`__)
- Removed dependency on ``argparse`` since it's a built-in module (`#1728 <https://github.com/3b1b/manim/pull/1728>`__)
- Removed dependency on ``pyreadline`` (`#1728 <https://github.com/3b1b/manim/pull/1728>`__)
- Removed dependency on ``cssselect2`` (`#1731 <https://github.com/3b1b/manim/pull/1731>`__)
- Added dependency on ``svgelements`` (`#1731 <https://github.com/3b1b/manim/pull/1731>`__)
v1.4.1
------
Fixed bugs
^^^^^^^^^^
- Temporarily fixed boolean operations' bug (`#1724 <https://github.com/3b1b/manim/pull/1724>`__)
- Import ``Iterable`` from ``collections.abc`` instead of ``collections`` which is deprecated since python 3.9 (`d2e0811 <https://github.com/3b1b/manim/commit/d2e0811285f7908e71a65e664fec88b1af1c6144>`__)
v1.4.0
------
Fixed bugs
^^^^^^^^^^
- Temporarily fixed ``Lightbulb`` (`f1996f8 <https://github.com/3b1b/manim/pull/1697/commits/f1996f8479f9e33d626b3b66e9eb6995ce231d86>`__)
- Fixed some bugs of ``SVGMobject`` (`#1712 <https://github.com/3b1b/manim/pull/1712>`__)
- Fixed some bugs of SVG path string parser (`#1717 <https://github.com/3b1b/manim/pull/1717>`__)
- Fixed some bugs of ``MTex`` (`#1720 <https://github.com/3b1b/manim/pull/1720>`__)
New features
^^^^^^^^^^^^
- Added option to add ticks on x-axis in ``BarChart`` (`#1694 <https://github.com/3b1b/manim/pull/1694>`__)
- Added ``lable_buff`` config parameter for ``Brace`` (`#1704 <https://github.com/3b1b/manim/pull/1704>`__)
- Added support for ``rotate skewX skewY`` transform in SVG (`#1712 <https://github.com/3b1b/manim/pull/1712>`__)
- Added style support to ``SVGMobject`` (`#1717 <https://github.com/3b1b/manim/pull/1717>`__)
- Added parser to <style> element of SVG (`#1719 <https://github.com/3b1b/manim/pull/1719>`__)
- Added support for <line> element in ``SVGMobject`` (`#1719 <https://github.com/3b1b/manim/pull/1719>`__)
Refactor
^^^^^^^^
- Used ``FFMPEG_BIN`` instead of ``"ffmpeg"`` for sound incorporation (`5aa8d15 <https://github.com/3b1b/manim/pull/1697/commits/5aa8d15d85797f68a8f169ca69fd90d441a3abbe>`__)
- Decorated ``CoordinateSystem.get_axes`` and ``.get_all_ranges`` as abstract method (`#1709 <https://github.com/3b1b/manim/pull/1709>`__)
- Refactored SVG path string parser (`#1712 <https://github.com/3b1b/manim/pull/1712>`__)
- Allowed ``Mobject.scale`` to receive iterable ``scale_factor`` (`#1712 <https://github.com/3b1b/manim/pull/1712>`__)
- Refactored ``MTex`` (`#1716 <https://github.com/3b1b/manim/pull/1716>`__)
- Improved config helper (``manimgl --config``) (`#1721 <https://github.com/3b1b/manim/pull/1721>`__)
- Refactored ``MTex`` (`#1723 <https://github.com/3b1b/manim/pull/1723>`__)
Dependencies
^^^^^^^^^^^^
- Added dependency on python package `cssselect2 <https://github.com/Kozea/cssselect2>`__ (`#1719 <https://github.com/3b1b/manim/pull/1719>`__)
v1.3.0
------
Fixed bugs
^^^^^^^^^^
- Fixed ``Mobject.stretch_to_fit_depth`` (`#1653 <https://github.com/3b1b/manim/pull/1653>`__)
- Fixed the bug of rotating camera (`#1655 <https://github.com/3b1b/manim/pull/1655>`__)
- Fixed ``SurfaceMesh`` to be evenly spaced (`c73d507 <https://github.com/3b1b/manim/pull/1688/commits/c73d507c76af5c8602d4118bc7538ba04c03ebae>`__)
- Fixed ``angle_between_vectors`` add ``rotation_between_vectors`` (`82bd02d <https://github.com/3b1b/manim/pull/1688/commits/82bd02d21fbd89b71baa21e077e143f440df9014>`__)
- Fixed ``VMobject.fade`` (`a717314 <https://github.com/3b1b/manim/pull/1688/commits/a7173142bf93fd309def0cc10f3c56f5e6972332>`__)
- Fixed ``angle_between_vectors`` (`fbc329d <https://github.com/3b1b/manim/pull/1688/commits/fbc329d7ce3b11821d47adf6052d932f7eff724a>`__)
- Fixed bug in ``ShowSubmobjectsOneByOne`` (`bcd0990 <https://github.com/3b1b/manim/pull/1688/commits/bcd09906bea5eaaa5352e7bee8f3153f434cf606>`__)
- Fixed bug in ``TransformMatchingParts`` (`7023548 <https://github.com/3b1b/manim/pull/1691/commits/7023548ec62c4adb2f371aab6a8c7f62deb7c33c>`__)
New features
^^^^^^^^^^^^
- Added CLI flag ``--log-level`` to specify log level (`e10f850 <https://github.com/3b1b/manim/commit/e10f850d0d9f971931cc85d44befe67dc842af6d>`__)
- Added operations (``+`` and ``*``) for ``Mobject`` (`#1667 <https://github.com/3b1b/manim/pull/1667>`__)
- Added 4 boolean operations for ``VMobject`` in ``manimlib/mobject/boolean_ops.py`` (`#1675 <https://github.com/3b1b/manim/pull/1675>`__)
- ``Union(*vmobjects, **kwargs)``
- ``Difference(subject, clip, **kwargs)``
- ``Intersection(*vmobjects, **kwargs)``
- ``Exclusion(*vmobjects, **kwargs)``
- Added reflectiveness (`81c3ae3 <https://github.com/3b1b/manim/pull/1688/commits/81c3ae30372e288dc772633dbd17def6e603753e>`__)
- Enabled ``glow_factor`` on ``DotCloud`` (`2c7689e <https://github.com/3b1b/manim/pull/1688/commits/2c7689ed9e81229ce87c648f97f26267956c0bc9>`__)
- Added option ``-e`` to insert embed line from the command line (`d065e19 <https://github.com/3b1b/manim/pull/1688/commits/d065e1973d1d6ebd2bece81ce4bdf0c2fff7c772>`__)
- Improved ``point_from_proportion`` to account for arc length (`0e78027 <https://github.com/3b1b/manim/pull/1688/commits/0e78027186a976f7e5fa8d586f586bf6e6baab8d>`__)
- Added shortcut ``set_backstroke`` for setting black background stroke (`781a993 <https://github.com/3b1b/manim/pull/1688/commits/781a9934fda6ba11f22ba32e8ccddcb3ba78592e>`__)
- Added ``Suface.always_sort_to_camera`` (`0b898a5 <https://github.com/3b1b/manim/pull/1688/commits/0b898a5594203668ed9cad38b490ab49ba233bd4>`__)
- Added getter methods for specific euler angles (`e899604 <https://github.com/3b1b/manim/pull/1688/commits/e899604a2d05f78202fcb3b9824ec34647237eae>`__)
- Hade ``rotation_between_vectors`` handle identical/similar vectors (`407c53f <https://github.com/3b1b/manim/pull/1688/commits/407c53f97c061bfd8a53beacd88af4c786f9e9ee>`__)
- Added ``Mobject.insert_submobject`` method (`49743da <https://github.com/3b1b/manim/pull/1688/commits/49743daf3244bfa11a427040bdde8e2bb79589e8>`__)
- Created single progress display for full scene render (`9dd1f47 <https://github.com/3b1b/manim/pull/1688/commits/9dd1f47dabca1580d6102e34e44574b0cba556e7>`__)
- Added ``Circle.get_radius`` (`264f7b1 <https://github.com/3b1b/manim/pull/1691/commits/264f7b11726e9e736f0fe472f66e38539f74e848>`__)
- Added ``Dodecahedron`` (`83841ae <https://github.com/3b1b/manim/pull/1691/commits/83841ae41568a9c9dff44cd163106c19a74ac281>`__)
- Added ``GlowDot`` (`a1d5147 <https://github.com/3b1b/manim/pull/1691/commits/a1d51474ea1ce3b7aa3efbe4c5e221be70ee2f5b>`__)
- Added ``MTex`` , see `#1678 <https://github.com/3b1b/manim/pull/1678>`__ for details (`#1678 <https://github.com/3b1b/manim/pull/1678>`__)
Refactor
^^^^^^^^
- Refactored support for command ``A`` in path of SVG (`#1662 <https://github.com/3b1b/manim/pull/1662>`__)
- Refactored ``SingleStringTex.balance_braces`` (`#1662 <https://github.com/3b1b/manim/pull/1662>`__)
- Slight tweaks to how saturation_factor works on newton-fractal (`8b454fb <https://github.com/3b1b/manim/pull/1688/commits/8b454fbe9335a7011e947093230b07a74ba9c653>`__)
- Made it possible to set full screen preview as a default (`317a5d6 <https://github.com/3b1b/manim/pull/1688/commits/317a5d6226475b6b54a78db7116c373ef84ea923>`__)
- Used ``quick_point_from_proportion`` for graph points (`e764da3 <https://github.com/3b1b/manim/pull/1688/commits/e764da3c3adc5ae2a4ce877b340d2b6abcddc2fc>`__)
- Made sure ``Line.set_length`` returns self (`d2182b9 <https://github.com/3b1b/manim/pull/1688/commits/d2182b9112300558b6c074cefd685f97c10b3898>`__)
- Better align ``SurfaceMesh`` to the corresponding surface polygons (`eea3c6b <https://github.com/3b1b/manim/pull/1688/commits/eea3c6b29438f9e9325329c4355e76b9f635e97a>`__)
- Match ``fix_in_frame`` status for ``FlashAround`` mobject (`ee1594a <https://github.com/3b1b/manim/pull/1688/commits/ee1594a3cb7a79b8fc361e4c4397a88c7d20c7e3>`__)
- Made sure ``Mobject.is_fixed_in_frame`` stays updated with uniforms (`ba23fbe <https://github.com/3b1b/manim/pull/1688/commits/ba23fbe71e4a038201cd7df1d200514ed1c13bc2>`__)
- Made sure ``skip_animations`` and ``start_at_animation_number`` play well together (`98b0d26 <https://github.com/3b1b/manim/pull/1691/commits/98b0d266d2475926a606331923cca3dc1dea97ad>`__)
- Updated progress display for full scene render (`f8e6e7d <https://github.com/3b1b/manim/pull/1691/commits/f8e6e7df3ceb6f3d845ced4b690a85b35e0b8d00>`__)
- ``VectorizedPoint`` should call ``__init__`` for both super classes (`8f1dfab <https://github.com/3b1b/manim/pull/1691/commits/8f1dfabff04a8456f5c4df75b0f97d50b2755003>`__)
- Used array copy when checking need for refreshing triangulation (`758f329 <https://github.com/3b1b/manim/pull/1691/commits/758f329a06a0c198b27a48c577575d94554305bf>`__)
Dependencies
^^^^^^^^^^^^
- Added dependency on python package `skia-pathops <https://github.com/fonttools/skia-pathops>`__ (`#1675 <https://github.com/3b1b/manim/pull/1675>`__)
v1.2.0
------
Fixed bugs
^^^^^^^^^^
- Fixed ``put_start_and_end_on`` in 3D (`#1592 <https://github.com/3b1b/manim/pull/1592>`__)
- Fixed ``DecimalNumber``'s scaling issue (`#1601 <https://github.com/3b1b/manim/pull/1601>`__)
- Fixed bug with common range array used for all coordinate systems (`56df154 <https://github.com/3b1b/manim/commit/56df15453f3e3837ed731581e52a1d76d5692077>`__)
- Fixed ``CoordinateSystem`` init bug (`8645894 <https://github.com/3b1b/manim/commit/86458942550c639a241267d04d57d0e909fcf252>`__)
- Fixed bug for single-valued ``ValueTracker`` (`0dc096b <https://github.com/3b1b/manim/commit/0dc096bf576ea900b351e6f4a80c13a77676f89b>`__)
- Fixed bug with SVG rectangles (`54ad355 <https://github.com/3b1b/manim/commit/54ad3550ef0c0e2fda46b26700a43fa8cde0973f>`__)
- Fixed ``DotCloud.set_radii`` (`d45ea28 <https://github.com/3b1b/manim/commit/d45ea28dc1d92ab9c639a047c00c151382eb0131>`__)
- Temporarily fixed bug for ``PMobject`` array resizing (`b543cc0 <https://github.com/3b1b/manim/commit/b543cc0e32d45399ee81638b6d4fb631437664cd>`__)
- Fixed ``match_style`` (`5f878a2 <https://github.com/3b1b/manim/commit/5f878a2c1aa531b7682bd048468c72d2835c7fe5>`__)
- Fixed negative ``path_arc`` case (`719c81d <https://github.com/3b1b/manim/commit/719c81d72b00dcf49f148d7c146774b22e0fe348>`__)
- Fixed bug with ``CoordinateSystem.get_lines_parallel_to_axis`` (`c726eb7 <https://github.com/3b1b/manim/commit/c726eb7a180b669ee81a18555112de26a8aff6d6>`__)
- Fixed ``ComplexPlane`` -i display bug (`7732d2f <https://github.com/3b1b/manim/commit/7732d2f0ee10449c5731499396d4911c03e89648>`__)
New features
^^^^^^^^^^^^
- Supported the elliptical arc command ``A`` for ``SVGMobject`` (`#1598 <https://github.com/3b1b/manim/pull/1598>`__)
- Added ``FlashyFadeIn`` (`#1607 <https://github.com/3b1b/manim/pull/1607>`__)
- Save triangulation (`#1607 <https://github.com/3b1b/manim/pull/1607>`__)
- Added new ``Code`` mobject (`#1625 <https://github.com/3b1b/manim/pull/1625>`__)
- Add warnings and use rich to display log (`#1637 <https://github.com/3b1b/manim/pull/1637>`__)
- Added ``VCube`` (`bd356da <https://github.com/3b1b/manim/commit/bd356daa99bfe3134fcb192a5f72e0d76d853801>`__)
- Supported ``ValueTracker`` to track vectors (`6d72893 <https://github.com/3b1b/manim/commit/6d7289338234acc6658b9377c0f0084aa1fa7119>`__)
- Added ``set_max_width``, ``set_max_height``, ``set_max_depth`` to ``Mobject`` (`3bb8f3f <https://github.com/3b1b/manim/commit/3bb8f3f0422a5dfba0da6ef122dc0c01f31aff03>`__)
- Added ``TracgTail`` (`a35dd5a <https://github.com/3b1b/manim/commit/a35dd5a3cbdeffa3891d5aa5f80287c18dba2f7f>`__)
- Added ``Scene.point_to_mobject`` (`acba13f <https://github.com/3b1b/manim/commit/acba13f4991b78d54c0bf93cce7ca3b351c25476>`__)
- Added poly_fractal shader (`f84b8a6 <https://github.com/3b1b/manim/commit/f84b8a66fe9e8b3872e5c716c5c240c14bb555ee>`__)
- Added kwargs to ``TipableVMobject.set_length`` (`b24ba19 <https://github.com/3b1b/manim/commit/b24ba19dec48ba4e38acbde8eec6d3a308b6ab83>`__)
- Added ``Mobject.replicate`` (`17c2772 <https://github.com/3b1b/manim/commit/17c2772b84abf6392a4170030e36e981de4737d0>`__)
- Added mandelbrot_fractal shader (`33fa76d <https://github.com/3b1b/manim/commit/33fa76dfac36e70bb5fad69dc6a336800c6dacce>`__)
- Saved state before each embed (`f22a341 <https://github.com/3b1b/manim/commit/f22a341e8411eae9331d4dd976b5e15bc6db08d9>`__)
- Allowed releasing of Textures (`e10a752 <https://github.com/3b1b/manim/commit/e10a752c0001e8981038faa03be4de2603d3565f>`__)
- Consolidated and renamed newton_fractal shader (`14fbed7 <https://github.com/3b1b/manim/commit/14fbed76da4b493191136caebb8a955e2d41265b>`__)
- Hade ``ImageMoject`` remember the filepath to the Image (`6cdbe0d <https://github.com/3b1b/manim/commit/6cdbe0d67a11ab14a6d84840a114ae6d3af10168>`__)
Refactor
^^^^^^^^
- Changed back to simpler ``Mobject.scale`` implementation (`#1601 <https://github.com/3b1b/manim/pull/1601>`__)
- Simplified ``Square`` (`b667db2 <https://github.com/3b1b/manim/commit/b667db2d311a11cbbca2a6ff511d2c3cf1675486>`__)
- Removed unused parameter ``triangulation_locked`` (`40290ad <https://github.com/3b1b/manim/commit/40290ada8343f10901fa9151cbdf84689667786d>`__)
- Reimplemented ``Arrow`` (`8647a64 <https://github.com/3b1b/manim/commit/8647a6429dd0c52cba14e971b8c09194a93cfd87>`__)
- Used ``make_approximately_smooth`` for ``set_points_smoothly`` by default (`d8378d8 <https://github.com/3b1b/manim/commit/d8378d8157040cd797cc47ef9576beffd8607863>`__)
- Refactored to call ``_handle_scale_side_effects`` after scaling takes place (`7b4199c <https://github.com/3b1b/manim/commit/7b4199c674e291f1b84678828b63b6bd4fcc6b17>`__)
- Refactored to only call ``throw_error_if_no_points`` once for ``get_start_and_end`` (`7356a36 <https://github.com/3b1b/manim/commit/7356a36fa70a8279b43ae74e247cbd43b2bfd411>`__)
- Made sure framerate is 30 for previewed scenes (`0787c4f <https://github.com/3b1b/manim/commit/0787c4f36270a6560b50ce3e07b30b0ec5f2ba3e>`__)
- Pushed ``pixel_coords_to_space_coords`` to ``Window`` (`c635f19 <https://github.com/3b1b/manim/commit/c635f19f2a33e916509e53ded46f55e2afa8f5f2>`__)
- Refactored to pass tuples and not arrays to uniforms (`d5a88d0 <https://github.com/3b1b/manim/commit/d5a88d0fa457cfcf4cb9db417a098c37c95c7051>`__)
- Refactored to copy uniform arrays in ``Mobject.copy`` (`9483f26 <https://github.com/3b1b/manim/commit/9483f26a3b056de0e34f27acabd1a946f1adbdf9>`__)
- Added ``bounding_box`` as exceptional key to point_cloud mobject (`ed1fc4d <https://github.com/3b1b/manim/commit/ed1fc4d5f94467d602a568466281ca2d0368b506>`__)
- Made sure stroke width is always a float (`329d2c6 <https://github.com/3b1b/manim/commit/329d2c6eaec3d88bfb754b555575a3ea7c97a7e0>`__)
v1.1.0
-------
Fixed bugs
^^^^^^^^^^
- Fixed the bug of :func:`~manimlib.utils.iterables.resize_with_interpolation` in the case of ``length=0``
- Fixed the bug of ``__init__`` in :class:`~manimlib.mobject.geometry.Elbow`
- If chosen monitor is not available, choose one that does exist
- Make sure mobject data gets unlocked after animations
- Fixed a bug for off-center vector fields
- Had ``Mobject.match_points`` return self
- Fixed chaining animation in example scenes
- Fixed the default color of tip
- Fixed a typo in ``ShowPassingFlashWithThinningStrokeWidth``
- Fixed the default size of ``Text``
- Fixed a missing import line in ``mobject.py``
- Fixed the bug in ControlsExample
- Make sure frame is added to the scene when initialization
- Fixed zooming directions
- Rewrote ``earclip_triangulation`` to fix triangulation
- Allowed sound_file_name to be taken in without extensions
New features
^^^^^^^^^^^^
- Added :class:`~manimlib.animation.indication.VShowPassingFlash`
- Added ``COLORMAP_3B1B``
- Added some methods to coordinate system to access all axes ranges
- :meth:`~manimlib.mobject.coordinate_systems.CoordinateSystem.get_origin`
- :meth:`~manimlib.mobject.coordinate_systems.CoordinateSystem.get_all_ranges`
- Added :meth:`~manimlib.mobject.mobject.Mobject.set_color_by_rgba_func`
- Updated :class:`~manimlib.mobject.vector_field.VectorField` and :class:`~manimlib.mobject.vector_field.StreamLines`
- Allow ``3b1b_colormap`` as an option for :func:`~manimlib.utils.color.get_colormap_list`
- Return ``stroke_width`` as 1d array
- Added :meth:`~manimlib.mobject.svg.text_mobject.Text.get_parts_by_text`
- Use Text not TexText for Brace
- Update to Cross to make it default to variable stroke width
- Added :class:`~manimlib.animation.indication.FlashAround` and :class:`~manimlib.animation.indication.FlashUnder`
- Allowed configuration in ``Brace.get_text``
- Added :meth:`~manimlib.camera.camera.CameraFrame.reorient` for quicker changes to frame angle
- Added ``units`` to :meth:`~manimlib.camera.camera.CameraFrame.set_euler_angles`
- Allowed any ``VMobject`` to be passed into ``TransformMatchingTex``
- Removed double brace convention in ``Tex`` and ``TexText``
- Added support for debugger launch
- Added CLI flag ``--config_file`` to load configuration file manually
- Added ``tip_style`` to ``tip_config``
- Added ``MarkupText``
- Take in ``u_range`` and ``v_range`` as arguments to ``ParametricSurface``
- Added ``TrueDot``

View File

@@ -0,0 +1,59 @@
Contributing
============
Accept any contribution you make :)
- **Contribute to the manim source code**:
Please fork to your own repository and make changes, submit a pull request, and fill in
the motivation for the change following the instructions in the template. We will check
your pull request in detail (this usually takes a while, please be patient)
- **Contribute to the documentation**:
Also submit a pull request and write down the main changes.
- **If you find a bug in the code**:
Please open an issue and fill in the found problem and your environment according
to the template. (But please note that if you think this problem is just a problem
of yourself, rather than a problem of source code, it is recommended that you ask a
question in the `Q&A category <https://github.com/3b1b/manim/discussions/categories/q-a>`_
of the discussion page)
- **You are welcome to share the content you made with manim**:
Post it in the `show and tell category <https://github.com/3b1b/manim/discussions/categories/show-and-tell>`_
of the discussion page.
- **You are also welcome to share some of your suggestions and ideas**:
Post them in the `ideas category <https://github.com/3b1b/manim/discussions/categories/ideas>`_
of the discussion page.
How to build this documentation
-------------------------------
- Clone the 3b1b/manim repository
.. code-block:: sh
git clone https://github.com/3b1b/manim.git
# or your own repo
# git clone https://github.com/<your user name>/manim.git
cd manim
- Install python package dependencies
.. code-block:: sh
pip install -r docs/requirements.txt
- Go to the ``docs/`` folder and build
.. code-block:: sh
cd docs/
make html
- The output document is located in ``docs/build/html/``

View File

@@ -0,0 +1,2 @@
Animation (TODO)
================

View File

@@ -0,0 +1,2 @@
Camera (TODO)
=============

View File

@@ -0,0 +1,190 @@
constants
=========
The ``constants.py`` in the ``manimlib`` folder defines the constants
needed when running manim. Some constants are not explained here because
they are only used inside manim.
Frame and pixel shape
---------------------
.. code-block:: python
ASPECT_RATIO = 16.0 / 9.0
FRAME_HEIGHT = 8.0
FRAME_WIDTH = FRAME_HEIGHT * ASPECT_RATIO
FRAME_Y_RADIUS = FRAME_HEIGHT / 2
FRAME_X_RADIUS = FRAME_WIDTH / 2
DEFAULT_PIXEL_HEIGHT = 1080
DEFAULT_PIXEL_WIDTH = 1920
DEFAULT_FRAME_RATE = 30
Buffs
-----
.. code-block:: python
SMALL_BUFF = 0.1
MED_SMALL_BUFF = 0.25
MED_LARGE_BUFF = 0.5
LARGE_BUFF = 1
DEFAULT_MOBJECT_TO_EDGE_BUFFER = MED_LARGE_BUFF # Distance between object and edge
DEFAULT_MOBJECT_TO_MOBJECT_BUFFER = MED_SMALL_BUFF # Distance between objects
Run times
---------
.. code-block:: python
DEFAULT_POINTWISE_FUNCTION_RUN_TIME = 3.0
DEFAULT_WAIT_TIME = 1.0
Coordinates
-----------
manim uses three-dimensional coordinates and uses the type of ``ndarray``
.. code-block:: python
ORIGIN = np.array((0., 0., 0.))
UP = np.array((0., 1., 0.))
DOWN = np.array((0., -1., 0.))
RIGHT = np.array((1., 0., 0.))
LEFT = np.array((-1., 0., 0.))
IN = np.array((0., 0., -1.))
OUT = np.array((0., 0., 1.))
X_AXIS = np.array((1., 0., 0.))
Y_AXIS = np.array((0., 1., 0.))
Z_AXIS = np.array((0., 0., 1.))
# Useful abbreviations for diagonals
UL = UP + LEFT
UR = UP + RIGHT
DL = DOWN + LEFT
DR = DOWN + RIGHT
TOP = FRAME_Y_RADIUS * UP
BOTTOM = FRAME_Y_RADIUS * DOWN
LEFT_SIDE = FRAME_X_RADIUS * LEFT
RIGHT_SIDE = FRAME_X_RADIUS * RIGHT
Mathematical constant
---------------------
.. code-block:: python
PI = np.pi
TAU = 2 * PI
DEGREES = TAU / 360
Text
----
.. code-block:: python
NORMAL = "NORMAL"
ITALIC = "ITALIC"
OBLIQUE = "OBLIQUE"
BOLD = "BOLD"
Stroke width
------------
.. code-block:: python
DEFAULT_STROKE_WIDTH = 4
Colours
-------
Here are the preview of default colours. (Modified from
`elteoremadebeethoven <https://elteoremadebeethoven.github.io/manim_3feb_docs.github.io/html/_static/colors/colors.html>`_)
.. raw:: html
<div style="float: left;">
<h3>BLUE</h3>
<div class="colors BLUE_E"><p class="color-text">BLUE_E</p></div>
<div class="colors BLUE_D"><p class="color-text">BLUE_D</p></div>
<div class="colors BLUE_C"><p class="color-text">BLUE_C</p></div>
<div class="colors BLUE_B"><p class="color-text">BLUE_B</p></div>
<div class="colors BLUE_A"><p class="color-text">BLUE_A</p></div>
</div>
<div style="float: left;">
<h3>TEAL</h3>
<div class="colors TEAL_E"><p class="color-text">TEAL_E</p></div>
<div class="colors TEAL_D"><p class="color-text">TEAL_D</p></div>
<div class="colors TEAL_C"><p class="color-text">TEAL_C</p></div>
<div class="colors TEAL_B"><p class="color-text">TEAL_B</p></div>
<div class="colors TEAL_A"><p class="color-text">TEAL_A</p></div>
</div>
<div style="float: left;">
<h3>GREEN</h3>
<div class="colors GREEN_E"><p class="color-text">GREEN_E</p></div>
<div class="colors GREEN_D"><p class="color-text">GREEN_D</p></div>
<div class="colors GREEN_C"><p class="color-text">GREEN_C</p></div>
<div class="colors GREEN_B"><p class="color-text">GREEN_B</p></div>
<div class="colors GREEN_A"><p class="color-text">GREEN_A</p></div>
</div>
<div style="float: left;">
<h3>YELLOW</h3>
<div class="colors YELLOW_E"><p class="color-text">YELLOW_E</p></div>
<div class="colors YELLOW_D"><p class="color-text">YELLOW_D</p></div>
<div class="colors YELLOW_C"><p class="color-text">YELLOW_C</p></div>
<div class="colors YELLOW_B"><p class="color-text">YELLOW_B</p></div>
<div class="colors YELLOW_A"><p class="color-text">YELLOW_A</p></div>
</div>
<div style="float: left;">
<h3>GOLD</h3>
<div class="colors GOLD_E"><p class="color-text">GOLD_E</p></div>
<div class="colors GOLD_D"><p class="color-text">GOLD_D</p></div>
<div class="colors GOLD_C"><p class="color-text">GOLD_C</p></div>
<div class="colors GOLD_B"><p class="color-text">GOLD_B</p></div>
<div class="colors GOLD_A"><p class="color-text">GOLD_A</p></div>
</div>
<div style="float: left;">
<h3>RED</h3>
<div class="colors RED_E"><p class="color-text">RED_E</p></div>
<div class="colors RED_D"><p class="color-text">RED_D</p></div>
<div class="colors RED_C"><p class="color-text">RED_C</p></div>
<div class="colors RED_B"><p class="color-text">RED_B</p></div>
<div class="colors RED_A"><p class="color-text">RED_A</p></div>
</div>
<div style="float: left;">
<h3>MAROON</h3>
<div class="colors MAROON_E"><p class="color-text">MAROON_E</p></div>
<div class="colors MAROON_D"><p class="color-text">MAROON_D</p></div>
<div class="colors MAROON_C"><p class="color-text">MAROON_C</p></div>
<div class="colors MAROON_B"><p class="color-text">MAROON_B</p></div>
<div class="colors MAROON_A"><p class="color-text">MAROON_A</p></div>
</div>
<div style="float: left;">
<h3>PURPLE</h3>
<div class="colors PURPLE_E"><p class="color-text">PURPLE_E</p></div>
<div class="colors PURPLE_D"><p class="color-text">PURPLE_D</p></div>
<div class="colors PURPLE_C"><p class="color-text">PURPLE_C</p></div>
<div class="colors PURPLE_B"><p class="color-text">PURPLE_B</p></div>
<div class="colors PURPLE_A"><p class="color-text">PURPLE_A</p></div>
</div>
<div style="float: left;">
<h3>GREY</h3>
<div class="colors GREY_E"><p class="color-text">GREY_E</p></div>
<div class="colors GREY_D"><p class="color-text">GREY_D</p></div>
<div class="colors GREY_C"><p class="color-text">GREY_C</p></div>
<div class="colors GREY_B"><p class="color-text">GREY_B</p></div>
<div class="colors GREY_A"><p class="color-text">GREY_A</p></div>
</div>
<div style="float: left;">
<h3>Others</h3>
<div class="colors WHITE"><p class="color-text" style="color: BLACK">WHITE</p></div>
<div class="colors BLACK"><p class="color-text">BLACK</p></div>
<div class="colors GREY_BROWN"><p class="color-text-small">GREY_BROWN</p></div>
<div class="colors DARK_BROWN"><p class="color-text-small">DARK_BROWN</p></div>
<div class="colors LIGHT_BROWN"><p class="color-text-small">LIGHT_BROWN</p></div>
<div class="colors PINK"><p class="color-text">PINK</p></div>
<div class="colors LIGHT_PINK"><p class="color-text-small">LIGHT_PINK</p></div>
<div class="colors GREEN_SCREEN"><p class="color-text-small">GREEN_SCREEN</p></div>
<div class="colors ORANGE"><p class="color-text">ORANGE</p></div>
</div>

View File

@@ -0,0 +1,144 @@
custom_config
==============
``directories``
---------------
- ``mirror_module_path``
(``True`` or ``False``) Whether to create a folder named the name of the
running file under the ``output`` path, and save the output (``images/``
or ``videos/``) in it.
- ``output``
Output file path, the videos will be saved in the ``videos/`` folder under it,
and the pictures will be saved in the ``images/`` folder under it.
For example, if you set ``output`` to ``"/.../manim/output"`` and
``mirror_module_path`` to ``False``, then you exported ``Scene1`` in the code
file and saved the last frame, then the final directory structure will be like:
.. code-block:: text
:emphasize-lines: 9, 11
manim/
├── manimlib/
│ ├── animation/
│ ├── ...
│ ├── default_config.yml
│ └── window.py
├── output/
│ ├── images
│ │ └── Scene1.png
│ └── videos
│ └── Scene1.mp4
├── code.py
└── custom_config.yml
But if you set ``mirror_module_path`` to ``True``, the directory structure will be:
.. code-block:: text
:emphasize-lines: 8
manim/
├── manimlib/
│ ├── animation/
│ ├── ...
│ ├── default_config.yml
│ └── window.py
├── output/
│ └── code/
│ ├── images
│ │ └── Scene1.png
│ └── videos
│ └── Scene1.mp4
├── code.py
└── custom_config.yml
- ``raster_images``
The directory for storing raster images to be used in the code (including
``.jpg``, ``.jpeg``, ``.png`` and ``.gif``), which will be read by ``ImageMobject``.
- ``vector_images``
The directory for storing vector images to be used in the code (including
``.svg`` and ``.xdv``), which will be read by ``SVGMobject``.
- ``sounds``
The directory for storing sound files to be used in ``Scene.add_sound()`` (
including ``.wav`` and ``.mp3``).
- ``temporary_storage``
The directory for storing temporarily generated cache files, including
``Tex`` cache, ``Text`` cache and storage of object points.
``tex``
-------
- ``executable``
The executable program used to compile LaTeX (``latex`` or ``xelatex -no-pdf``
is recommended)
- ``template_file``
LaTeX template used, in ``manimlib/tex_templates``
- ``intermediate_filetype``
The type of intermediate vector file generated after compilation (``dvi`` if
``latex`` is used, ``xdv`` if ``xelatex`` is used)
- ``text_to_replace``
The text to be replaced in the template (needn't to change)
``universal_import_line``
-------------------------
Import line that need to execute when entering interactive mode directly.
``style``
---------
- ``font``
Default font of Text
- ``background_color``
Default background color
``window_position``
-------------------
The relative position of the playback window on the display (two characters,
the first character means upper(U) / middle(O) / lower(D), the second character
means left(L) / middle(O) / right(R)).
``window_monitor``
------------------
The number of the monitor you want the preview window to pop up on. (default is 0)
``break_into_partial_movies``
-----------------------------
If this is set to ``True``, then many small files will be written corresponding
to each ``Scene.play`` and ``Scene.wait`` call, and these files will then be combined
to form the full scene.
Sometimes video-editing is made easier when working with the broken up scene, which
effectively has cuts at all the places you might want.
``camera_qualities``
--------------------
Export quality
- ``low``
Low quality (default is 480p15)
- ``medium``
Medium quality (default is 720p30)
- ``high``
High quality (default is 1080p30)
- ``ultra_high``
Ultra high quality (default is 4K60)
- ``default_quality``
Default quality (one of the above four)

View File

@@ -0,0 +1,2 @@
Mobject (TODO)
==============

View File

@@ -0,0 +1,2 @@
Scene (TODO)
============

View File

@@ -0,0 +1,2 @@
Shaders (TODO)
==============

View File

@@ -0,0 +1,2 @@
Utils (TODO)
============

View File

@@ -1,4 +0,0 @@
Animating Mobjects
==================
Learn about animations.

View File

@@ -0,0 +1,85 @@
CONFIG dictionary
=================
What's CONFIG
-------------
``CONFIG`` dictionary is a feature of manim, which facilitates the inheritance
and modification of parameters between parent and child classes.
| ``CONFIG`` dictionary 's processing is in ``manimlib/utils/config_ops.py``
| It can convert the key-value pairs in the ``CONFIG`` dictionary into class attributes and values
Generally, the first line of the ``.__init__()`` method in some basic class (``Mobject``, ``Animation``,
etc.) will call this function ``digest_config(self, kwargs)`` to convert both
the ``CONFIG`` dictionary and ``kwargs`` into attributes. Then it can be accessed
directly through ``self.``, which simplifies the handling of inheritance between classes.
**An example**:
There are many class inheritance relationships in ``manimlib/mobject/geometry.py``
.. code-block:: python
# Line 279
class Circle(Arc):
CONFIG = {
"color": RED,
"close_new_points": True,
"anchors_span_full_range": False
}
.. code-block:: python
# Line 304
class Dot(Circle):
CONFIG = {
"radius": DEFAULT_DOT_RADIUS,
"stroke_width": 0,
"fill_opacity": 1.0,
"color": WHITE
}
The ``Circle`` class uses the key-value pair ``"color": RED`` in the ``CONFIG``
dictionary to add the attribute ``self.color``.
At the same time, the ``Dot`` class also contains the key ``color`` in the
``CONFIG`` dictionary, but the value is different. At this time, the priority will
modify the attribute ``self.color`` to ``WHITE``.
CONFIG nesting
--------------
The ``CONFIG`` dictionary supports nesting, that is, the value of the key is also
a dictionary, for example:
.. code-block:: python
class Camera(object):
CONFIG = {
# configs
}
.. code-block:: python
class Scene(object):
CONFIG = {
"window_config": {},
"camera_class": Camera,
"camera_config": {},
"file_writer_config": {},
# other configs
}
def __init__(self, **kwargs):
digest_config(self, kwargs)
# some lines
self.camera = self.camera_class(**self.camera_config)
The ``CONFIG`` dictionary of the ``Camera`` class contains many key-value pairs,
and this class needs to be instantiated in the ``Scene`` class. For more convenient
control, there is a special key-value pair in the Scene class ``"camera_config": {}``,
Its value is a dictionary, passed in as ``kwargs`` when initializing the ``Camera`` class
to modify the value of the properties of the ``Camera`` class.
So the nesting of the ``CONFIG`` dictionary **essentially** passes in the value as ``kwargs``.

View File

@@ -0,0 +1,98 @@
CLI flags and configuration
===========================
Command Line Interface
----------------------
To run manim, you need to enter the directory at the same level as ``manimlib/``
and enter the command in the following format into terminal:
.. code-block:: sh
manimgl <code>.py <Scene> <flags>
# or
manim-render <code>.py <Scene> <flags>
- ``<code>.py`` : The python file you wrote. Needs to be at the same level as ``manimlib/``, otherwise you need to use an absolute path or a relative path.
- ``<Scene>`` : The scene you want to render here. If it is not written or written incorrectly, it will list all for you to choose. And if there is only one ``Scene`` in the file, this class will be rendered directly.
- ``<flags>`` : CLI flags.
Some useful flags
^^^^^^^^^^^^^^^^^
- ``-w`` to write the scene to a file.
- ``-o`` to write the scene to a file and open the result.
- ``-s`` to skip to the end and just show the final frame.
- ``-so`` will save the final frame to an image and show it.
- ``-n <number>`` to skip ahead to the ``n``\ th animation of a scene.
- ``-f`` to make the playback window fullscreen.
All supported flags
^^^^^^^^^^^^^^^^^^^
========================================================== ====== =================================================================================================================================================================================================
flag abbr function
========================================================== ====== =================================================================================================================================================================================================
``--help`` ``-h`` Show the help message and exit
``--write_file`` ``-w`` Render the scene as a movie file
``--skip_animations`` ``-s`` Skip to the last frame
``--low_quality`` ``-l`` Render at a low quality (for faster rendering)
``--medium_quality`` ``-m`` Render at a medium quality
``--hd`` Render at a 1080p quality
``--uhd`` Render at a 4k quality
``--full_screen`` ``-f`` Show window in full screen
``--presenter_mode`` ``-p`` Scene will stay paused during wait calls until space bar or right arrow is hit, like a slide show
``--save_pngs`` ``-g`` Save each frame as a png
``--save_as_gif`` ``-i`` Save the video as gif
``--transparent`` ``-t`` Render to a movie file with an alpha channel
``--quiet`` ``-q``
``--write_all`` ``-a`` Write all the scenes from a file
``--open`` ``-o`` Automatically open the saved file once its done
``--finder`` Show the output file in finder
``--config`` Guide for automatic configuration
``--file_name FILE_NAME`` Name for the movie or image file
``--start_at_animation_number START_AT_ANIMATION_NUMBER`` ``-n`` Start rendering not from the first animation, but from another, specified by its index. If you passing two comma separated values, e.g. "3,6", it will end the rendering at the second value.
``--embed LINENO`` ``-e`` Takes a line number as an argument, and results in the scene being called as if the line ``self.embed()`` was inserted into the scene code at that line number
``--resolution RESOLUTION`` ``-r`` Resolution, passed as "WxH", e.g. "1920x1080"
``--frame_rate FRAME_RATE`` Frame rate, as an integer
``--color COLOR`` ``-c`` Background color
``--leave_progress_bars`` Leave progress bars displayed in terminal
``--video_dir VIDEO_DIR`` Directory to write video
``--config_file CONFIG_FILE`` Path to the custom configuration file
========================================================== ====== =================================================================================================================================================================================================
custom_config
--------------
In order to perform more configuration (about directories, etc.) and permanently
change the default value (you don't have to add flags to the command every time),
you can modify ``custom_config.yml``. The meaning of each option is in
page :doc:`../documentation/custom_config`.
You can also use different ``custom_config.yml`` for different directories, such as
following the directory structure:
.. code-block:: text
manim/
├── manimlib/
│ ├── animation/
│ ├── ...
│ ├── default_config.yml
│ └── window.py
├── project/
│ ├── code.py
│ └── custom_config.yml
└── custom_config.yml
When you enter the ``project/`` folder and run ``manimgl code.py <Scene>``,
it will overwrite ``manim/default_config.yml`` with ``custom_config.yml``
in the ``project`` folder.
Alternatively, you can use ``--config_file`` flag in CLI to specify configuration file manually.
.. code-block:: sh
manimgl project/code.py --config_file /path/to/custom_config.yml

View File

@@ -0,0 +1,726 @@
Example Scenes
==============
After understanding the previous knowledge, we can understand more scenes.
Many example scenes are given in ``example_scenes.py``, let's start with
the simplest and one by one.
InteractiveDevlopment
---------------------
.. manim-example:: InteractiveDevelopment
:media: https://cdn.jsdelivr.net/gh/manim-kindergarten/CDN@master/manimgl_assets/example_scenes/InteractiveDevelopment.mp4
from manimlib import *
class InteractiveDevelopment(Scene):
def construct(self):
circle = Circle()
circle.set_fill(BLUE, opacity=0.5)
circle.set_stroke(BLUE_E, width=4)
square = Square()
self.play(ShowCreation(square))
self.wait()
# This opens an iPython termnial where you can keep writing
# lines as if they were part of this construct method.
# In particular, 'square', 'circle' and 'self' will all be
# part of the local namespace in that terminal.
self.embed()
# Try copying and pasting some of the lines below into
# the interactive shell
self.play(ReplacementTransform(square, circle))
self.wait()
self.play(circle.animate.stretch(4, 0))
self.play(Rotate(circle, 90 * DEGREES))
self.play(circle.animate.shift(2 * RIGHT).scale(0.25))
text = Text("""
In general, using the interactive shell
is very helpful when developing new scenes
""")
self.play(Write(text))
# In the interactive shell, you can just type
# play, add, remove, clear, wait, save_state and restore,
# instead of self.play, self.add, self.remove, etc.
# To interact with the window, type touch(). You can then
# scroll in the window, or zoom by holding down 'z' while scrolling,
# and change camera perspective by holding down 'd' while moving
# the mouse. Press 'r' to reset to the standard camera position.
# Press 'q' to stop interacting with the window and go back to
# typing new commands into the shell.
# In principle you can customize a scene to be responsive to
# mouse and keyboard interactions
always(circle.move_to, self.mouse_point)
This scene is similar to what we wrote in :doc:`quickstart`.
And how to interact has been written in the comments.
No more explanation here.
AnimatingMethods
----------------
.. manim-example:: AnimatingMethods
:media: https://cdn.jsdelivr.net/gh/manim-kindergarten/CDN@master/manimgl_assets/example_scenes/AnimatingMethods.mp4
class AnimatingMethods(Scene):
def construct(self):
grid = Tex(r"\pi").get_grid(10, 10, height=4)
self.add(grid)
# You can animate the application of mobject methods with the
# ".animate" syntax:
self.play(grid.animate.shift(LEFT))
# Alternatively, you can use the older syntax by passing the
# method and then the arguments to the scene's "play" function:
self.play(grid.shift, LEFT)
# Both of those will interpolate between the mobject's initial
# state and whatever happens when you apply that method.
# For this example, calling grid.shift(LEFT) would shift the
# grid one unit to the left, but both of the previous calls to
# "self.play" animate that motion.
# The same applies for any method, including those setting colors.
self.play(grid.animate.set_color(YELLOW))
self.wait()
self.play(grid.animate.set_submobject_colors_by_gradient(BLUE, GREEN))
self.wait()
self.play(grid.animate.set_height(TAU - MED_SMALL_BUFF))
self.wait()
# The method Mobject.apply_complex_function lets you apply arbitrary
# complex functions, treating the points defining the mobject as
# complex numbers.
self.play(grid.animate.apply_complex_function(np.exp), run_time=5)
self.wait()
# Even more generally, you could apply Mobject.apply_function,
# which takes in functions form R^3 to R^3
self.play(
grid.animate.apply_function(
lambda p: [
p[0] + 0.5 * math.sin(p[1]),
p[1] + 0.5 * math.sin(p[0]),
p[2]
]
),
run_time=5,
)
self.wait()
The new usage in this scene is ``.get_grid()`` and ``self.play(mob.animate.method(args))``.
- ``.get_grid()`` method will return a new mobject containing multiple copies of this one arranged in a grid.
- ``self.play(mob.animate.method(args))`` animates the method, and the details are in the comments above.
TextExample
-----------
.. manim-example:: TextExample
:media: https://cdn.jsdelivr.net/gh/manim-kindergarten/CDN@master/manimgl_assets/example_scenes/TextExample.mp4
class TextExample(Scene):
def construct(self):
# To run this scene properly, you should have "Consolas" font in your computer
# for full usage, you can see https://github.com/3b1b/manim/pull/680
text = Text("Here is a text", font="Consolas", font_size=90)
difference = Text(
"""
The most important difference between Text and TexText is that\n
you can change the font more easily, but can't use the LaTeX grammar
""",
font="Arial", font_size=24,
# t2c is a dict that you can choose color for different text
t2c={"Text": BLUE, "TexText": BLUE, "LaTeX": ORANGE}
)
VGroup(text, difference).arrange(DOWN, buff=1)
self.play(Write(text))
self.play(FadeIn(difference, UP))
self.wait(3)
fonts = Text(
"And you can also set the font according to different words",
font="Arial",
t2f={"font": "Consolas", "words": "Consolas"},
t2c={"font": BLUE, "words": GREEN}
)
fonts.set_width(FRAME_WIDTH - 1)
slant = Text(
"And the same as slant and weight",
font="Consolas",
t2s={"slant": ITALIC},
t2w={"weight": BOLD},
t2c={"slant": ORANGE, "weight": RED}
)
VGroup(fonts, slant).arrange(DOWN, buff=0.8)
self.play(FadeOut(text), FadeOut(difference, shift=DOWN))
self.play(Write(fonts))
self.wait()
self.play(Write(slant))
self.wait()
The new classes in this scene are ``Text``, ``VGroup``, ``Write``, ``FadeIn`` and ``FadeOut``.
- ``Text`` can create text, define fonts, etc. The usage ais clearly reflected in the above examples.
- ``VGroup`` can put multiple ``VMobject`` together as a whole. In the example, the ``.arrange()`` method is called to arrange the sub-mobjects in sequence downward (``DOWN``), and the spacing is ``buff``.
- ``Write`` is an animation that shows similar writing effects.
- ``FadeIn`` fades the object in, the second parameter indicates the direction of the fade in.
- ``FadeOut`` fades out the object, the second parameter indicates the direction of the fade out.
TexTransformExample
-------------------
.. manim-example:: TexTransformExample
:media: https://cdn.jsdelivr.net/gh/manim-kindergarten/CDN@master/manimgl_assets/example_scenes/TexTransformExample.mp4
class TexTransformExample(Scene):
def construct(self):
to_isolate = ["B", "C", "=", "(", ")"]
lines = VGroup(
# Passing in muliple arguments to Tex will result
# in the same expression as if those arguments had
# been joined together, except that the submobject
# hierarchy of the resulting mobject ensure that the
# Tex mobject has a subject corresponding to
# each of these strings. For example, the Tex mobject
# below will have 5 subjects, corresponding to the
# expressions [A^2, +, B^2, =, C^2]
Tex("A^2", "+", "B^2", "=", "C^2"),
# Likewise here
Tex("A^2", "=", "C^2", "-", "B^2"),
# Alternatively, you can pass in the keyword argument
# "isolate" with a list of strings that should be out as
# their own submobject. So the line below is equivalent
# to the commented out line below it.
Tex("A^2 = (C + B)(C - B)", isolate=["A^2", *to_isolate]),
# Tex("A^2", "=", "(", "C", "+", "B", ")", "(", "C", "-", "B", ")"),
Tex("A = \\sqrt{(C + B)(C - B)}", isolate=["A", *to_isolate])
)
lines.arrange(DOWN, buff=LARGE_BUFF)
for line in lines:
line.set_color_by_tex_to_color_map({
"A": BLUE,
"B": TEAL,
"C": GREEN,
})
play_kw = {"run_time": 2}
self.add(lines[0])
# The animation TransformMatchingTex will line up parts
# of the source and target which have matching tex strings.
# Here, giving it a little path_arc makes each part sort of
# rotate into their final positions, which feels appropriate
# for the idea of rearranging an equation
self.play(
TransformMatchingTex(
lines[0].copy(), lines[1],
path_arc=90 * DEGREES,
),
**play_kw
)
self.wait()
# Now, we could try this again on the next line...
self.play(
TransformMatchingTex(lines[1].copy(), lines[2]),
**play_kw
)
self.wait()
# ...and this looks nice enough, but since there's no tex
# in lines[2] which matches "C^2" or "B^2", those terms fade
# out to nothing while the C and B terms fade in from nothing.
# If, however, we want the C^2 to go to C, and B^2 to go to B,
# we can specify that with a key map.
self.play(FadeOut(lines[2]))
self.play(
TransformMatchingTex(
lines[1].copy(), lines[2],
key_map={
"C^2": "C",
"B^2": "B",
}
),
**play_kw
)
self.wait()
# And to finish off, a simple TransformMatchingShapes would work
# just fine. But perhaps we want that exponent on A^2 to transform into
# the square root symbol. At the moment, lines[2] treats the expression
# A^2 as a unit, so we might create a new version of the same line which
# separates out just the A. This way, when TransformMatchingTex lines up
# all matching parts, the only mismatch will be between the "^2" from
# new_line2 and the "\sqrt" from the final line. By passing in,
# transform_mismatches=True, it will transform this "^2" part into
# the "\sqrt" part.
new_line2 = Tex("A^2 = (C + B)(C - B)", isolate=["A", *to_isolate])
new_line2.replace(lines[2])
new_line2.match_style(lines[2])
self.play(
TransformMatchingTex(
new_line2, lines[3],
transform_mismatches=True,
),
**play_kw
)
self.wait(3)
self.play(FadeOut(lines, RIGHT))
# Alternatively, if you don't want to think about breaking up
# the tex strings deliberately, you can TransformMatchingShapes,
# which will try to line up all pieces of a source mobject with
# those of a target, regardless of the submobject hierarchy in
# each one, according to whether those pieces have the same
# shape (as best it can).
source = Text("the morse code", height=1)
target = Text("here come dots", height=1)
self.play(Write(source))
self.wait()
kw = {"run_time": 3, "path_arc": PI / 2}
self.play(TransformMatchingShapes(source, target, **kw))
self.wait()
self.play(TransformMatchingShapes(target, source, **kw))
self.wait()
The new classes in this scene are ``Tex``, ``TexText``, ``TransformMatchingTex``
and ``TransformMatchingShapes``.
- ``Tex`` uses LaTeX to create mathematical formulas.
- ``TexText`` uses LaTeX to create text.
- ``TransformMatchingTeX`` automatically transforms sub-objects according to the similarities and differences of tex in ``Tex``.
- ``TransformMatchingShapes`` automatically transform sub-objects directly based on the similarities and differences of the object point sets.
UpdatersExample
---------------
.. manim-example:: UpdatersExample
:media: https://cdn.jsdelivr.net/gh/manim-kindergarten/CDN@master/manimgl_assets/example_scenes/UpdatersExample.mp4
class UpdatersExample(Scene):
def construct(self):
square = Square()
square.set_fill(BLUE_E, 1)
# On all all frames, the constructor Brace(square, UP) will
# be called, and the mobject brace will set its data to match
# that of the newly constructed object
brace = always_redraw(Brace, square, UP)
text, number = label = VGroup(
Text("Width = "),
DecimalNumber(
0,
show_ellipsis=True,
num_decimal_places=2,
include_sign=True,
)
)
label.arrange(RIGHT)
# This ensures that the method deicmal.next_to(square)
# is called on every frame
always(label.next_to, brace, UP)
# You could also write the following equivalent line
# label.add_updater(lambda m: m.next_to(brace, UP))
# If the argument itself might change, you can use f_always,
# for which the arguments following the initial Mobject method
# should be functions returning arguments to that method.
# The following line ensures that decimal.set_value(square.get_y())
# is called every frame
f_always(number.set_value, square.get_width)
# You could also write the following equivalent line
# number.add_updater(lambda m: m.set_value(square.get_width()))
self.add(square, brace, label)
# Notice that the brace and label track with the square
self.play(
square.animate.scale(2),
rate_func=there_and_back,
run_time=2,
)
self.wait()
self.play(
square.animate.set_width(5, stretch=True),
run_time=3,
)
self.wait()
self.play(
square.animate.set_width(2),
run_time=3
)
self.wait()
# In general, you can alway call Mobject.add_updater, and pass in
# a function that you want to be called on every frame. The function
# should take in either one argument, the mobject, or two arguments,
# the mobject and the amount of time since the last frame.
now = self.time
w0 = square.get_width()
square.add_updater(
lambda m: m.set_width(w0 * math.cos(self.time - now))
)
self.wait(4 * PI)
The new classes and usage in this scene are ``always_redraw()``, ``DecimalNumber``, ``.to_edge()``,
``.center()``, ``always()``, ``f_always()``, ``.set_y()`` and ``.add_updater()``.
- ``always_redraw()`` function create a new mobject every frame.
- ``DecimalNumber`` is a variable number, speed it up by breaking it into ``Text`` characters.
- ``.to_edge()`` means to place the object on the edge of the screen.
- ``.center()`` means to place the object in the center of the screen.
- ``always(f, x)`` means that a certain function (``f(x)``) is executed every frame.
- ``f_always(f, g)`` is similar to ``always``, executed ``f(g())`` every frame.
- ``.set_y()`` means to set the ordinate of the object on the screen.
- ``.add_updater()`` sets an update function for the object. For example: ``mob1.add_updater(lambda mob: mob.next_to(mob2))`` means ``mob1.next_to(mob2)`` is executed every frame.
CoordinateSystemExample
-----------------------
.. manim-example:: CoordinateSystemExample
:media: https://cdn.jsdelivr.net/gh/manim-kindergarten/CDN@master/manimgl_assets/example_scenes/CoordinateSystemExample.mp4
class CoordinateSystemExample(Scene):
def construct(self):
axes = Axes(
# x-axis ranges from -1 to 10, with a default step size of 1
x_range=(-1, 10),
# y-axis ranges from -2 to 2 with a step size of 0.5
y_range=(-2, 2, 0.5),
# The axes will be stretched so as to match the specified
# height and width
height=6,
width=10,
# Axes is made of two NumberLine mobjects. You can specify
# their configuration with axis_config
axis_config={
"stroke_color": GREY_A,
"stroke_width": 2,
},
# Alternatively, you can specify configuration for just one
# of them, like this.
y_axis_config={
"include_tip": False,
}
)
# Keyword arguments of add_coordinate_labels can be used to
# configure the DecimalNumber mobjects which it creates and
# adds to the axes
axes.add_coordinate_labels(
font_size=20,
num_decimal_places=1,
)
self.add(axes)
# Axes descends from the CoordinateSystem class, meaning
# you can call call axes.coords_to_point, abbreviated to
# axes.c2p, to associate a set of coordinates with a point,
# like so:
dot = Dot(color=RED)
dot.move_to(axes.c2p(0, 0))
self.play(FadeIn(dot, scale=0.5))
self.play(dot.animate.move_to(axes.c2p(3, 2)))
self.wait()
self.play(dot.animate.move_to(axes.c2p(5, 0.5)))
self.wait()
# Similarly, you can call axes.point_to_coords, or axes.p2c
# print(axes.p2c(dot.get_center()))
# We can draw lines from the axes to better mark the coordinates
# of a given point.
# Here, the always_redraw command means that on each new frame
# the lines will be redrawn
h_line = always_redraw(lambda: axes.get_h_line(dot.get_left()))
v_line = always_redraw(lambda: axes.get_v_line(dot.get_bottom()))
self.play(
ShowCreation(h_line),
ShowCreation(v_line),
)
self.play(dot.animate.move_to(axes.c2p(3, -2)))
self.wait()
self.play(dot.animate.move_to(axes.c2p(1, 1)))
self.wait()
# If we tie the dot to a particular set of coordinates, notice
# that as we move the axes around it respects the coordinate
# system defined by them.
f_always(dot.move_to, lambda: axes.c2p(1, 1))
self.play(
axes.animate.scale(0.75).to_corner(UL),
run_time=2,
)
self.wait()
self.play(FadeOut(VGroup(axes, dot, h_line, v_line)))
# Other coordinate systems you can play around with include
# ThreeDAxes, NumberPlane, and ComplexPlane.
GraphExample
------------
.. manim-example:: GraphExample
:media: https://cdn.jsdelivr.net/gh/manim-kindergarten/CDN@master/manimgl_assets/example_scenes/GraphExample.mp4
class GraphExample(Scene):
def construct(self):
axes = Axes((-3, 10), (-1, 8))
axes.add_coordinate_labels()
self.play(Write(axes, lag_ratio=0.01, run_time=1))
# Axes.get_graph will return the graph of a function
sin_graph = axes.get_graph(
lambda x: 2 * math.sin(x),
color=BLUE,
)
# By default, it draws it so as to somewhat smoothly interpolate
# between sampled points (x, f(x)). If the graph is meant to have
# a corner, though, you can set use_smoothing to False
relu_graph = axes.get_graph(
lambda x: max(x, 0),
use_smoothing=False,
color=YELLOW,
)
# For discontinuous functions, you can specify the point of
# discontinuity so that it does not try to draw over the gap.
step_graph = axes.get_graph(
lambda x: 2.0 if x > 3 else 1.0,
discontinuities=[3],
color=GREEN,
)
# Axes.get_graph_label takes in either a string or a mobject.
# If it's a string, it treats it as a LaTeX expression. By default
# it places the label next to the graph near the right side, and
# has it match the color of the graph
sin_label = axes.get_graph_label(sin_graph, "\\sin(x)")
relu_label = axes.get_graph_label(relu_graph, Text("ReLU"))
step_label = axes.get_graph_label(step_graph, Text("Step"), x=4)
self.play(
ShowCreation(sin_graph),
FadeIn(sin_label, RIGHT),
)
self.wait(2)
self.play(
ReplacementTransform(sin_graph, relu_graph),
FadeTransform(sin_label, relu_label),
)
self.wait()
self.play(
ReplacementTransform(relu_graph, step_graph),
FadeTransform(relu_label, step_label),
)
self.wait()
parabola = axes.get_graph(lambda x: 0.25 * x**2)
parabola.set_stroke(BLUE)
self.play(
FadeOut(step_graph),
FadeOut(step_label),
ShowCreation(parabola)
)
self.wait()
# You can use axes.input_to_graph_point, abbreviated
# to axes.i2gp, to find a particular point on a graph
dot = Dot(color=RED)
dot.move_to(axes.i2gp(2, parabola))
self.play(FadeIn(dot, scale=0.5))
# A value tracker lets us animate a parameter, usually
# with the intent of having other mobjects update based
# on the parameter
x_tracker = ValueTracker(2)
f_always(
dot.move_to,
lambda: axes.i2gp(x_tracker.get_value(), parabola)
)
self.play(x_tracker.animate.set_value(4), run_time=3)
self.play(x_tracker.animate.set_value(-2), run_time=3)
self.wait()
SurfaceExample
--------------
.. manim-example:: SurfaceExample
:media: https://cdn.jsdelivr.net/gh/manim-kindergarten/CDN@master/manimgl_assets/example_scenes/SurfaceExample.mp4
class SurfaceExample(Scene):
CONFIG = {
"camera_class": ThreeDCamera,
}
def construct(self):
surface_text = Text("For 3d scenes, try using surfaces")
surface_text.fix_in_frame()
surface_text.to_edge(UP)
self.add(surface_text)
self.wait(0.1)
torus1 = Torus(r1=1, r2=1)
torus2 = Torus(r1=3, r2=1)
sphere = Sphere(radius=3, resolution=torus1.resolution)
# You can texture a surface with up to two images, which will
# be interpreted as the side towards the light, and away from
# the light. These can be either urls, or paths to a local file
# in whatever you've set as the image directory in
# the custom_config.yml file
# day_texture = "EarthTextureMap"
# night_texture = "NightEarthTextureMap"
day_texture = "https://upload.wikimedia.org/wikipedia/commons/thumb/4/4d/Whole_world_-_land_and_oceans.jpg/1280px-Whole_world_-_land_and_oceans.jpg"
night_texture = "https://upload.wikimedia.org/wikipedia/commons/thumb/b/ba/The_earth_at_night.jpg/1280px-The_earth_at_night.jpg"
surfaces = [
TexturedSurface(surface, day_texture, night_texture)
for surface in [sphere, torus1, torus2]
]
for mob in surfaces:
mob.shift(IN)
mob.mesh = SurfaceMesh(mob)
mob.mesh.set_stroke(BLUE, 1, opacity=0.5)
# Set perspective
frame = self.camera.frame
frame.set_euler_angles(
theta=-30 * DEGREES,
phi=70 * DEGREES,
)
surface = surfaces[0]
self.play(
FadeIn(surface),
ShowCreation(surface.mesh, lag_ratio=0.01, run_time=3),
)
for mob in surfaces:
mob.add(mob.mesh)
surface.save_state()
self.play(Rotate(surface, PI / 2), run_time=2)
for mob in surfaces[1:]:
mob.rotate(PI / 2)
self.play(
Transform(surface, surfaces[1]),
run_time=3
)
self.play(
Transform(surface, surfaces[2]),
# Move camera frame during the transition
frame.animate.increment_phi(-10 * DEGREES),
frame.animate.increment_theta(-20 * DEGREES),
run_time=3
)
# Add ambient rotation
frame.add_updater(lambda m, dt: m.increment_theta(-0.1 * dt))
# Play around with where the light is
light_text = Text("You can move around the light source")
light_text.move_to(surface_text)
light_text.fix_in_frame()
self.play(FadeTransform(surface_text, light_text))
light = self.camera.light_source
self.add(light)
light.save_state()
self.play(light.animate.move_to(3 * IN), run_time=5)
self.play(light.animate.shift(10 * OUT), run_time=5)
drag_text = Text("Try moving the mouse while pressing d or s")
drag_text.move_to(light_text)
drag_text.fix_in_frame()
self.play(FadeTransform(light_text, drag_text))
self.wait()
This scene shows an example of using a three-dimensional surface, and
the related usage has been briefly described in the notes.
- ``.fix_in_frame()`` makes the object not change with the view angle of the screen, and is always displayed at a fixed position on the screen.
OpeningManimExample
-------------------
.. manim-example:: OpeningManimExample
:media: https://cdn.jsdelivr.net/gh/manim-kindergarten/CDN@master/manimgl_assets/example_scenes/OpeningManimExample.mp4
class OpeningManimExample(Scene):
def construct(self):
intro_words = Text("""
The original motivation for manim was to
better illustrate mathematical functions
as transformations.
""")
intro_words.to_edge(UP)
self.play(Write(intro_words))
self.wait(2)
# Linear transform
grid = NumberPlane((-10, 10), (-5, 5))
matrix = [[1, 1], [0, 1]]
linear_transform_words = VGroup(
Text("This is what the matrix"),
IntegerMatrix(matrix, include_background_rectangle=True),
Text("looks like")
)
linear_transform_words.arrange(RIGHT)
linear_transform_words.to_edge(UP)
linear_transform_words.set_stroke(BLACK, 10, background=True)
self.play(
ShowCreation(grid),
FadeTransform(intro_words, linear_transform_words)
)
self.wait()
self.play(grid.animate.apply_matrix(matrix), run_time=3)
self.wait()
# Complex map
c_grid = ComplexPlane()
moving_c_grid = c_grid.copy()
moving_c_grid.prepare_for_nonlinear_transform()
c_grid.set_stroke(BLUE_E, 1)
c_grid.add_coordinate_labels(font_size=24)
complex_map_words = TexText("""
Or thinking of the plane as $\\mathds{C}$,\\\\
this is the map $z \\rightarrow z^2$
""")
complex_map_words.to_corner(UR)
complex_map_words.set_stroke(BLACK, 5, background=True)
self.play(
FadeOut(grid),
Write(c_grid, run_time=3),
FadeIn(moving_c_grid),
FadeTransform(linear_transform_words, complex_map_words),
)
self.wait()
self.play(
moving_c_grid.animate.apply_complex_function(lambda z: z**2),
run_time=6,
)
self.wait(2)
This scene is a comprehensive application of a two-dimensional scene.
After seeing these scenes, you have already understood part of the
usage of manim. For more examples, see `the video code of 3b1b <https://github.com/3b1b/videos>`_.

View File

@@ -1,18 +0,0 @@
Getting Started
===============
Todd Zimmerman put together `a very nice tutorial`_ on getting started with
``manim``, which has been updated to run on python 3.7. Note that you'll want
to change `from big_ol_pile_of_manim_imports import *` to `from
manimlib.imports import *` to work with the current codebase.
.. _a very nice tutorial: https://talkingphysics.wordpress.com/2019/01/08/getting-started-animating-with-manim-and-python-3-7/
.. toctree::
:caption: Contents
:maxdepth: 2
learning_by_example
mathematical_objects
animating_mobjects
making_a_scene

View File

@@ -0,0 +1,69 @@
Installation
============
Manim runs on Python 3.7 or higher.
System requirements are
- `FFmpeg <https://ffmpeg.org/>`__
- `OpenGL <https://www.opengl.org//>`__ (included in python package ``PyOpenGL``)
- `LaTeX <https://www.latex-project.org>`__ (optional, if you want to use LaTeX)
- `Pango <https://pango.org>`__ (only for Linux)
Directly
--------
.. code-block:: sh
# Install manimgl
pip install manimgl
# Try it out
manimgl
If you want to hack on manimlib itself, clone this repository and in
that directory execute:
.. code-block:: sh
# Install python requirements
pip install -e .
# Try it out
manimgl example_scenes.py OpeningManimExample
# or
manim-render example_scenes.py OpeningManimExample
If you run the above command and no error message appears,
then you have successfully installed all the environments required by manim.
Directly (Windows)
------------------
1. `Install
FFmpeg <https://www.wikihow.com/Install-FFmpeg-on-Windows>`__, and make sure that its path is in the PATH environment variable.
2. Install a LaTeX distribution.
`TeXLive-full <http://tug.org/texlive/>`__ is recommended.
3. Install the remaining Python packages.
.. code-block:: sh
git clone https://github.com/3b1b/manim.git
cd manim
pip install -e .
manimgl example_scenes.py OpeningManimExample
For Anaconda
------------
- Install FFmpeg and LaTeX as above.
- Create a conda environment using
.. code-block:: sh
git clone https://github.com/3b1b/manim.git
cd manim
conda create -n manim python=3.8
conda activate manim
pip install -e .

View File

@@ -1,131 +0,0 @@
Learning by Example
===================
SquareToCircle
--------------
``example_scenes.py`` contains simple examples that we can use to learn about manim.
Go ahead and try out the ``SquareToCircle`` scene by running it with ``$ manim example_scenes.py SquareToCircle -p``
in manim directory.
.. code-block:: python
:linenos:
from manimlib.imports import *
class SquareToCircle(Scene):
def construct(self):
circle = Circle()
square = Square()
square.flip(RIGHT)
square.rotate(-3 * TAU / 8)
circle.set_fill(PINK, opacity=0.5)
self.play(ShowCreation(square))
self.play(Transform(square, circle))
self.play(FadeOut(square))
.. raw:: html
<video width="560" height="315" controls>
<source src="../_static/SquareToCircle.mp4" type="video/mp4">
</video>
.. note::
The flag ``-p`` plays the rendered video with default video player.
Other frequently used flags are:
* ``-l`` for rendering video in lower resolution (which renders faster)
* ``-s`` to show the last frame of the video.
Run ``manim -h`` all the available flags (``python -m manim -h`` if you installed it to a venv)
Let's step through each line of ``SquareToCircle``
.. code-block:: python
:lineno-start: 3
class SquareToCircle(Scene):
You create videos in manim by writing :class:`~scene.scene.Scene` classes.
Each :class:`~scene.scene.Scene` in manim is self-contained. That means everything
you created under this scene does not exist outside the class.
.. code-block:: python
:lineno-start: 4
def construct(self):
:meth:`~scene.scene.Scene.construct` specifies what is displayed on the screen
when the :class:`~scene.scene.Scene` is rendered to video.
.. code-block:: python
:lineno-start: 5
circle = Circle()
square = Square()
``Circle()`` and ``Square()`` create :class:`~mobject.geometry.Circle` and :class:`~mobject.geometry.Square`.
Both of these are instances of :class:`~mobject.mobject.Mobject` subclasses, the base class for objects in manim. Note
that instantiating a :class:`~mobject.mobject.Mobject` does not add it to the
:class:`~scene.scene.Scene`, so you wouldn't see anything if you were to render
the :class:`~scene.scene.Scene` at this point.
.. code-block:: python
:lineno-start: 7
square.flip(RIGHT)
square.rotate(-3 * TAU / 8)
circle.set_fill(PINK, opacity=0.5)
``flip()`` ``rotate()`` ``set_fill()`` apply various modifications to the mobjects before animating
them. The call to :meth:`~mobject.mobject.Mobject.flip` flips the
:class:`~mobject.geometry.Square` across the RIGHT vector. This is equivalent
to a refection across the x-axis.
The call to :meth:`~mobject.mobject.Mobject.rotate` rotates the
:class:`~mobject.geometry.Square` 3/8ths of a full rotation counterclockwise.
The call to :meth:`~mobject.mobject.Mobject.set_fill` sets
the fill color for the :class:`~mobject.geometry.Circle` to pink, and its opacity to 0.5.
.. code-block:: python
:lineno-start: 11
self.play(ShowCreation(square))
self.play(Transform(square, circle))
self.play(FadeOut(square))
To generated animation, :class:`~animation.animation.Animation` classes are used.
Each :class:`~animation.animation.Animation` takes one or more :class:`~mobject.mobject.Mobject` instances as arguments, which it animates
when passed to :meth:`~scene.scene.Scene.play`. This is how video is typically
created in manim.
:class:`~mobject.mobject.Mobject` instances are automatically
added to the :class:`~scene.scene.Scene` when they are animated. You can add a
:class:`~mobject.mobject.Mobject` to the :class:`~scene.scene.Scene` manually
by passing it as an argument to :meth:`~scene.scene.Scene.add`.
:class:`~animation.creation.ShowCreation` draws a :class:`~mobject.mobject.Mobject` to the screen.
:class:`~animation.transform.Transform` morphs one :class:`~mobject.mobject.Mobject` into another.
:class:`~animation.creation.FadeOut` fades a :class:`~mobject.mobject.Mobject` out of the :class:`~scene.scene.Scene`.
.. note::
Only the first argument to :class:`~animation.transform.Transform` is modified,
the second is not added to the :class:`~scene.scene.Scene`. :class:`~animation.tranform.Transform`
only changes the appearance but not the underlying properties.
After the call to ``transform()`` ``square`` is still a :class:`~mobject.geometry.Square` instance
but with the shape of :class:`~mobject.geometry.Circle`.

View File

@@ -1,15 +0,0 @@
Making a Scene
==============
A scene is what renders when manim is executed. Each scene contains mobjects, which can then be animated as
previously explained. In code, a scene is a class that extends ``Scene`` and implements the ``construct``
function, like so. Manim will execute this function to render the scene.
.. code-block:: python
:linenos:
from manimlib.imports import *
class ExampleScene(Scene):
def construct(self):
# Add and animate mobjects here

View File

@@ -1,13 +0,0 @@
Mathematical Objects
====================
Everything that appears on screen in a manim video is a
:class:`~mobject.mobject.Mobject`, or Mathematical Object. A
:class:`~mobject.mobject.Mobject`'s appearance is determined by 3
factors:
* ``m.points``, an Nx3 ``numpy.array`` specifying how to draw ``m``
* ``m``'s style attributes, such as ``m.color``, ``m.stroke_width``, and
``m.fill_opacity``
* ``m.submobjects``, a list of :class:`~mobject.mobject.Mobject` instances that
are considered part of ``m``

View File

@@ -0,0 +1,256 @@
Quick Start
===========
After installing the manim environment according to the instructions on the
:doc:`installation` page, you can try to make a scene yourself from scratch.
First, create a new ``.py`` file (such as ``start.py``) according to the following
directory structure:
.. code-block:: text
:emphasize-lines: 8
manim/
├── manimlib/
│ ├── animation/
│ ├── ...
│ ├── default_config.yml
│ └── window.py
├── custom_config.yml
└── start.py
And paste the following code (I will explain the function of each line in detail later):
.. code-block:: python
:linenos:
from manimlib import *
class SquareToCircle(Scene):
def construct(self):
circle = Circle()
circle.set_fill(BLUE, opacity=0.5)
circle.set_stroke(BLUE_E, width=4)
self.add(circle)
And run this command:
.. code-block:: sh
manimgl start.py SquareToCircle
A window will pop up on the screen. And then you can :
- scroll the middle mouse button to move the screen up and down
- hold down the :kbd:`z` on the keyboard while scrolling the middle mouse button to zoom the screen
- hold down the :kbd:`s` key on the keyboard and move the mouse to pan the screen
- hold down the :kbd:`d` key on the keyboard and move the mouse to change the three-dimensional perspective.
Finally, you can close the window and exit the program by pressing :kbd:`q`.
Run this command again:
.. code-block:: sh
manimgl start.py SquareToCircle -os
At this time, no window will pop up. When the program is finished, this rendered
image will be automatically opened (saved in the subdirectory ``images/`` of the same
level directory of ``start.py`` by default):
.. image:: https://cdn.jsdelivr.net/gh/manim-kindergarten/CDN@master/manimgl_assets/quickstart/SquareToCircle.png
:align: center
Make an image
-------------
Next, let's take a detailed look at what each row does.
**Line 1**:
.. code-block:: python
from manimlib import *
This will import all the classes that may be used when using manim.
**Line 3**:
.. code-block:: python
class SquareToCircle(Scene):
Create a :class:`Scene` subclass ``SquareToCircle``, which will be
the scene you write and render.
**Line 4**:
.. code-block:: python
def construct(self):
Write the ``construct()`` method, the content of which will determine
how to create the mobjects in the screen and what operations need to be performed.
**Line 5**:
.. code-block:: python
circle = Circle()
Create a circle (an instance of the :class:`Circle` class), called ``circle``
**Line 6~7**:
.. code-block:: python
circle.set_fill(BLUE, opacity=0.5)
circle.set_stroke(BLUE_E, width=4)
Set the circle style by calling the circle's method.
- The ``.set_fill()`` method sets the fill color of this circle to blue (``BLUE``, defined in :doc:`../documentation/constants`), and the fill transparency to 0.5.
- The ``.set_stroke()`` method sets the stroke color of this circle to dark blue (``BLUE_E``, defined in :doc:`../documentation/constants`), and the stroke width to 4.
**Line 9**:
.. code-block:: python
self.add(circle)
Add this circle to the screen through the ``.add()`` method of :class:`Scene`.
Add animations
--------------
Let's change some codes and add some animations to make videos instead of just pictures.
.. code-block:: python
:linenos:
from manimlib import *
class SquareToCircle(Scene):
def construct(self):
circle = Circle()
circle.set_fill(BLUE, opacity=0.5)
circle.set_stroke(BLUE_E, width=4)
square = Square()
self.play(ShowCreation(square))
self.wait()
self.play(ReplacementTransform(square, circle))
self.wait()
Run this command this time:
.. code-block:: sh
manimgl start.py SquareToCircle
The pop-up window will play animations of drawing a square and transforming
it into a circle. If you want to save this video, run:
.. code-block:: sh
manimgl start.py SquareToCircle -o
This time there will be no pop-up window, but the video file (saved in the subdirectory
``videos/`` of the same level directory of ``start.py`` by default) will be automatically
opened after the operation is over:
.. raw:: html
<video class="manim-video" controls loop autoplay src="https://cdn.jsdelivr.net/gh/manim-kindergarten/CDN@master/manimgl_assets/quickstart/SquareToCircle.mp4"></video>
Let's take a look at the code this time. The first 7 lines are the same as the previous
ones, and the 8th line is similar to the 5th line, which creates an instance of the
:class:`Square` class and named it ``square``.
**Line 10**:
.. code-block:: python
self.play(ShowCreation(square))
An animation is played through :class:`Scene`'s ``.play()`` method. :class:`ShowCreation`
is an animation that shows the process of creating a given mobject.
``self.play(ShowCreation(square))`` is to play the animation of creating ``square``.
**Line 11**:
.. code-block:: python
self.wait()
Use :class:`Scene`'s ``.wait()`` method to pause (default 1s), you can pass in
parameters to indicate the pause time (for example, ``self.wait(3)`` means pause for 3s).
**Line 12**:
.. code-block:: python
self.play(ReplacementTransform(square, circle))
Play the animation that transforms ``square`` into ``circle``.
``ReplacementTransform(A, B)`` means to transform A into B's pattern and replace A with B.
**Line 13**: Same as line 11, pause for 1s.
Enable interaction
------------------
Interaction is a new feature of the new version. You can add the following line
at the end of the code to enable interaction:
.. code-block:: python
self.embed()
Then run ``manimgl start.py SquareToCircle``.
After the previous animation is executed, the ipython terminal will be opened on
the command line. After that, you can continue to write code in it, and the statement
you entered will be executed immediately after pressing :kbd:`Enter`.
For example: input the following lines (without comment lines) into it respectively
(``self.play`` can be abbreviated as ``play`` in this mode):
.. code-block:: python
# Stretched 4 times in the vertical direction
play(circle.animate.stretch(4, dim=0))
# Rotate the ellipse 90°
play(Rotate(circle, TAU / 4))
# Move 2 units to the right and shrink to 1/4 of the original
play(circle.animate.shift(2 * RIGHT), circle.animate.scale(0.25))
# Insert 10 curves into circle for non-linear transformation (no animation will play)
circle.insert_n_curves(10)
# Apply a complex transformation of f(z)=z^2 to all points on the circle
play(circle.animate.apply_complex_function(lambda z: z**2))
# Close the window and exit the program
exit()
You will get an animation similar to the following:
.. raw:: html
<video class="manim-video" controls loop autoplay src="https://cdn.jsdelivr.net/gh/manim-kindergarten/CDN@master/manimgl_assets/quickstart/SquareToCircleEmbed.mp4"></video>
If you want to enter the interactive mode directly, you don't have to write an
empty scene containing only ``self.embed()``, you can directly run the following command
(this will enter the ipython terminal while the window pops up):
.. code-block:: sh
manimgl
You succeeded!
--------------
After reading the above content, you already know how to use manim.
Below you can see some examples, in the :doc:`example_scenes` page.
But before that, you'd better have a look at the :doc:`configuration` of manim.

View File

@@ -0,0 +1,128 @@
Manim's structure
=================
Manim's directory structure
---------------------------
The manim directory looks very complicated, with a lot of files,
but the structure is clear.
Below is the directory structure of manim:
.. code-block:: text
manimlib/ # manim library
├── __init__.py
├── __main__.py
├── default_config.yml # Default configuration file
├── config.py # Process CLI flags
├── constants.py # Defined some constants
├── extract_scene.py # Extract and run the scene
├── shader_wrapper.py # Shaders' Wrapper for convenient control
├── window.py # Playback window
├── tex_templates/ # Templates preset for LaTeX
│ ├── tex_templates.tex # Tex template (will be compiled with latex, default)
│ └── ctex_templates.tex # Tex template that support Chinese (will be compiled with xelatex)
├── camera/
│ └── camera.py # Including Camera and CameraFrame
├── scene/
│ ├── scene_file_writer.py # Used to write scene to video file
│ ├── scene.py # The basic Scene class
│ ├── three_d_scene.py # Three-dimensional scene
│ ├── sample_space_scene.py # Probability related sample space scene
│ └── vector_space_scene.py # Vector field scene
├── animation/
│ ├── animation.py # The basic class of animation
│ ├── composition.py # Animation group
│ ├── creation.py # Animation related to Create
│ ├── fading.py # Fade related animation
│ ├── growing.py # Animation related to Grow
│ ├── indication.py # Some animations for emphasis
│ ├── movement.py # Animation related to movement
│ ├── numbers.py # Realize changes to DecimalNumber
│ ├── rotation.py # Animation related to rotation
│ ├── specialized.py # Some uncommon animations for special projects
│ ├── transform_matching_parts.py # Transform which can automatically match parts
│ ├── transform.py # Some Transforms
│ └── update.py # Realize update from function
├── mobject/
│ ├── mobject.py # The basic class of all math object
│ ├── types/ # 4 types of mobject
│ │ ├── dot_cloud.py # Dot cloud (an subclass of PMobject)
│ │ ├── image_mobject.py # Insert pictures
│ │ ├── point_cloud_mobject.py # PMobject (mobject composed of points)
│ │ ├── surface.py # ParametricSurface
│ │ └── vectorized_mobject.py # VMobject (vectorized mobject)
│ ├── svg/ # mobject related to svg
│ │ ├── svg_mobject.py # SVGMobject
│ │ ├── brace.py # Brace
│ │ ├── drawings.py # Some special mobject of svg image
│ │ ├── tex_mobject.py # Tex and TexText implemented by LaTeX
│ │ └── text_mobject.py # Text implemented by manimpango
│ ├── changing.py # Dynamically changing mobject
│ ├── coordinate_systems.py # coordinate system
│ ├── frame.py # mobject related to frame
│ ├── functions.py # ParametricFunction
│ ├── geometry.py # geometry mobjects
│ ├── matrix.py # matrix
│ ├── mobject_update_utils.py # some defined updater
│ ├── number_line.py # Number line
│ ├── numbers.py # Numbers that can be changed
│ ├── probability.py # mobject related to probability
│ ├── shape_matchers.py # mobject adapted to the size of other objects
│ ├── three_dimensions.py # Three-dimensional objects
│ ├── value_tracker.py # ValueTracker which storage number
│ └── vector_field.py # VectorField
├── once_useful_constructs/ # 3b1b's Common scenes written for some videos
│ └── ...
├── shaders/ # GLSL scripts for rendering
│ ├── simple_vert.glsl # a simple glsl script for position
│ ├── insert/ # glsl scripts to be inserted in other glsl scripts
│ │ ├── NOTE.md # explain how to insert glsl scripts
│ │ └── ... # useful scripts
│ ├── image/ # glsl for images
│ │ └── ... # containing shaders for vertex and fragment
│ ├── quadratic_bezier_fill/ # glsl for the fill of quadratic bezier curve
│ │ └── ... # containing shaders for vertex, fragment and geometry
│ ├── quadratic_bezier_stroke/ # glsl for the stroke of quadratic bezier curve
│ │ └── ... # containing shaders for vertex, fragment and geometry
│ ├── surface/ # glsl for surfaces
│ │ └── ... # containing shaders for vertex and fragment
│ ├── textured_surface/ # glsl for textured_surface
│ │ └── ... # containing shaders for vertex and fragment
│ └── true_dot/ # glsl for a dot
│ └── ... # containing shaders for vertex, fragment and geometry
└── utils/ # Some useful utility functions
├── bezier.py # For bezier curve
├── color.py # For color
├── config_ops.py # Process CONFIG
├── customization.py # Read from custom_config.yml
├── debug.py # Utilities for debugging in program
├── directories.py # Read directories from config file
├── family_ops.py # Process family members
├── file_ops.py # Process files and directories
├── images.py # Read image
├── init_config.py # Configuration guide
├── iterables.py # Functions related to list/dictionary processing
├── paths.py # Curve path
├── rate_functions.py # Some defined rate_functions
├── simple_functions.py # Some commonly used functions
├── sounds.py # Process sounds
├── space_ops.py # Space coordinate calculation
├── strings.py # Process strings
└── tex_file_writing.py # Use LaTeX to write strings as svg
Inheritance structure of manim's classes
----------------------------------------
`Here <https://github.com/3b1b/manim/files/5824383/manim_shaders_structure.pdf>`_
is a pdf showed inheritance structure of manim's classes, large,
but basically all classes have included:
.. image:: https://cdn.jsdelivr.net/gh/manim-kindergarten/CDN@master/manimgl_assets/manim_shaders_structure.png
Manim execution process
-----------------------
.. image:: https://cdn.jsdelivr.net/gh/manim-kindergarten/CDN@master/manimgl_assets/manim_shaders_process_en.png

View File

@@ -0,0 +1,144 @@
What's new
==========
Usage changes of new version manim
----------------------------------
There are many changes in the new version of manim, and here are only the changes that
may have an impact at the code writing level.
Some of the changes here may not have any major impact on the use, and some changes
that affect the use are not mentioned below.
This document is for reference only, see the source code for details.
- ``Animation``
- Added ``Fade`` as the parent class of ``FadeIn`` and ``FadeOut``
- ``FadeIn`` and ``FadeOut`` can be passed in ``shift`` and ``scale`` parameters
- Deleted ``FadeInFrom, FadeInFromDown, FadeOutAndShift, FadeOutAndShiftDown, FadeInFromLarge``, these can be used ``FadeIn, FadeOut`` to achieve the same effect more easily
- Added ``FadeTransform`` to cross fade between two objects, and subclass ``FadeTransformPieces``
- Added ``CountInFrom(decimal_mob, source_number=0)`` to count ``decimal_mob`` from ``source_number`` to the current value
- ``Rotating`` can directly pass in ``angle`` and ``axis`` without writing keywords ``angle=, axis=``
- ``Rotate`` has become a subclass of ``Rotating``, and the distortion effect in ``Transform`` will not appear
- Removed ``MoveCar`` animation
- Added ``TransformMatchingShapes(mobject, target_mobject)`` and ``TransformMatchingTex(mobject, target_mobject)``
- ``Camera``
- Removed all camera classes except ``Camera`` (``MappingCamera``, ``MovingCamera``, ``MultiCamera``) and all functions in ``ThreeDCamera``
- Implemented ``CameraFrame`` (as a ``Mobject``)
- Can be called by ``self.camera.frame`` in ``Scene``
- All methods of ``Mobject`` can be used, such as ``.shift()``, ``.scale()``, etc.
- Call ``.to_default_state()`` to place in the default position
- Set the Euler angles of the camera by ``.set_euler_angles(theta, phi, gamma)``
- Set three single Euler angles by ``.set_theta(theta)``, ``.set_phi(phi)``, ``.set_gamma(gamma)``
- Use ``.increment_theta(dtheta)``, ``.increment_phi(dphi)``, ``.increment_gamma(gamma)`` to increase the three Euler angles by a certain value. Can be used to realize automatic rotation ``self.camera.frame.add_updater(lambda mob, dt: mob.increment_theta(0.1 * dt))``
- ``Camera`` adds a light source, which is a ``Point``, which can be called by ``self.camera.light_source`` in ``Scene`` to move and so on. The default position is ``(- 10, 10, 10)``
- Delete ``Container``
- ``Mobject``
- ``svg`` related
- Added ``Checkmark`` and ``Exmark``
- Some unnecessary classes have been removed from ``drawings.py``
- Removed ``Code`` and ``Paragraph`` (by mistake)
- ``TexMobject`` is renamed to ``Tex``, ``TextMobject`` is renamed to ``TexText``
- ``font_size`` has been added to ``Tex``, ``TexText`` and ``Text``
- ``Tex`` and ``TexText`` added ``isolate``, which is a list, which will be automatically split
- Mobject ``types``
- Added a new class ``Surface``, which is the parent class of ``ParametricSurface`` and ``TexturedSurface``.
- Added the group ``SGroup`` for ``Surface``
- Added ``TexturedSurface(uv_surface, image_file, dark_image_file=None)``, where ``uv_surface`` is a ``Surface``, ``image_file`` is the image to be posted, and ``dark_image_file`` is the image to be posted in the dark (default and ``image_file`` is the same)
- Deleted ``Mobject1D``, ``Mobject2D``, ``PointCloudDot``
- Added ``DotCloud`` (a ``PMobject``), which has been greatly optimized
- Removed ``AbstractImageMobject``, ``ImageMobjectFromCamera``
- Removed ``sheen`` from ``VMobject``
- ``Mobject``
- Added ``gloss`` and ``shadow``, which are the numbers between ``[0, 1]`` respectively. There are four methods of ``.get_gloss()``, ``.set_gloss(gloss)``, ``.get_shadow()``, ``.set_shadow(shadow)``
- Added ``.get_grid(n_rows, n_cols)`` to copy into grid
- Added ``.set_color_by_code(glsl_code)`` to use GLSL code to change the color
- Added ``.set_color_by_xyz_func(glsl_snippet, min_value=-5.0, max_value=5.0, colormap="viridis")`` to pass in GLSL expression in the form of ``x,y,z``, the return value should be a floating point number
- Coordinate system (including ``Axes``, ``ThreeDAxes``, ``NumberPlane``, ``ComplexPlane``)
- No longer use ``x_min``, ``x_max``, ``y_min``, ``y_max``, but use ``x_range``, ``y_range`` as a ``np.array()``, containing three numbers ``np.array([ Minimum, maximum, step size])``
- Added the abbreviation ``.i2gp(x, graph)`` of ``.input_to_graph_point(x, graph)``
- Added some functions of the original ``GraphScene``
- Added ``.get_v_line(point)``, ``.get_h_line(point)`` to return the line from ``point`` to the two coordinate axes, and specify the line type through the keyword argument of ``line_func`` (default ``DashedLine``)
- Added ``.get_graph_label(graph, label, x, direction, buff, color)`` to return the label added to the image
- Added ``.get_v_line_to_graph(x, graph)``, ``.get_h_line_to_graph(x, graph)`` to return the line from the point with the abscissa of ``x`` on the ``graph`` to the two- axis line
- Added ``.angle_of_tangent(x, graph, dx=EPSILON)``, returns the inclination angle of ``graph`` at ``x``
- Added ``.slope_of_tangent(x, graph, dx=EPSILON)``, returns the slope of tangent line of ``graph`` at ``x``
- Added ``.get_tangent_line(x, graph, length=5)`` to return the tangent line of ``graph`` at ``x``
- Added ``.get_riemann_rectangles(graph, x_range, dx, input_sample_type, ...)`` to return Riemann rectangles (a ``VGroup``)
- The attribute ``number_line_config`` of ``Axes`` is renamed to ``axis_config``
- ``Axes`` original ``.get_coordinate_labels(x_values, y_values)`` method was renamed to ``.add_coordinate_labels(x_values, y_values)`` (but it is not added to the screen)
- ``.add_coordinate_labels(numbers)`` of ``ComplexPlane`` will directly add the coordinates to the screen
- ``NumberLine``
- No longer use ``x_min``, ``x_max``, ``tick_frequency``, but use ``x_range``, which is an array containing three numbers ``[min, max, step]``
- The original ``label_direction`` attribute changed to the ``line_to_number_direction`` attribute
- Replace ``tip_width`` and ``tip_height`` with ``tip_config`` (dictionary) attributes
- The original ``exclude_zero_from_default`` attribute is modified to the ``numbers_to_exclude`` attribute (default is None)
- The original ``.add_tick_marks()`` method was changed to the ``.add_ticks()`` method
- Delete the ``.get_number_mobjects(*numbers)`` method, only use the ``.add_numbers(x_values=None, excluding=None)`` method
- Three-dimensional objects
- Added ``SurfaceMesh(uv_surface)``, pass in a ``Surface`` to generate its uv mesh
- ``ParametricSurface`` no longer uses ``u_min, u_max, v_min, v_max``, but instead uses ``u_range, v_range``, which is a tuple (``(min, max)``), and ``resolution`` can be set larger, dont worry Speed issue
- Added ``Torus``, controlled by ``r1, r2`` keyword parameters
- Added ``Cylinder``, controlled by ``height, radius`` keyword parameters
- Added ``Line3D`` (extremely thin cylinder), controlled by the ``width`` keyword parameter
- Added ``Disk3D``, controlled by ``radius`` keyword parameter
- Add ``Square3D``, controlled by ``side_length`` keyword parameter
- Improved ``Cube`` and ``Prism``, the usage remains unchanged
- Other objects
- ``ParametricFunction`` is renamed to ``ParametricCurve``. Instead of using ``t_min, t_max, step_size``, use ``t_range``, which is an array of three numbers (``[t_min, t_max, step_size]``). ``dt`` was renamed to ``epsilon``. Other usage remains unchanged
- All ``TipableVMobject`` can pass in ``tip_length`` to control the style of ``tip``
- ``Line`` adds ``.set_points_by_ends(start, end, buff=0, path_arc=0)`` method
- ``Line`` added ``.get_projection(point)`` to return the projection position of ``point`` on a straight line
- ``Arrow`` adds three attributes of ``thickness, tip_width_ratio, tip_angle``
- ``CubicBezier`` is changed to ``a0, h0, h1, a1``, that is, only a third-order Bezier curve is supported
- ``Square`` can be initialized directly by passing in ``side_length`` instead of using the keyword ``side_length=``
- ``always_redraw(func, *args, **kwargs)`` supports incoming parameters ``*args, **kwargs``
- The ``digit_to_digit_buff`` property of ``DecimalNumber`` has been renamed to ``digit_buff_per_font_unit``, and the ``.scale()`` method has been improved
- ``ValueTracker`` adds ``value_type`` attribute, the default is ``np.float64``
- ``Scene``
- Removed all functions of ``GraphScene`` (moved to ``once_useful_constructs``), ``MovingCameraScene``, ``ReconfigurableScene``, ``SceneFromVideo``, ``ZoomedScene``, and ``ThreeDScene``. Because these can basically be achieved by adjusting ``CameraFrame`` (``self.camera.frame``)
- Currently ``SampleSpaceScene`` and ``VectorScene`` have not been changed for the new version, so it is not recommended to use (only ``Scene`` is recommended)
- Fix the export of gif, just use the ``-i`` option directly
- Added the ``.interact()`` method, during which the mouse and keyboard can be used to continue the interaction, which will be executed by default after the scene ends
- Added ``.embed()`` method, open iPython terminal to enter interactive mode
- Added ``.save_state()`` method to save the current state of the scene
- Added ``.restore()`` method to restore the entire scene to the saved state
- ``utils``
- A series of functions related to second-order Bezier have been added to ``utils/bezier.py``
- Added a function to read color map from ``matplotlib`` in ``utils/color.py``
- Added a series of related functions for processing folders/custom styles/object families
- ``resize_array``, ``resize_preserving_order``, ``resize_with_interpolation`` three functions have been added to ``utils/iterables.py``
- The definition of ``smooth`` is updated in ``utils/rate_functions.py``
- ``clip(a, min_a, max_a)`` function has been added to ``utils/simple_functions.py``
- Some functions have been improved in ``utils/space_ops.py``, some functions for space calculation, and functions for processing triangulation have been added
- ``constants``
- Fixed the aspect ratio of the screen to 16:9
- Deleted the old gray series (``LIGHT_GREY``, ``GREY``, ``DARK_GREY``, ``DARKER_GREY``), added a new series of gray ``GREY_A`` ~ ``GREY_E``

View File

@@ -1,30 +1,36 @@
.. Manim documentation master file, created by
sphinx-quickstart on Mon May 27 14:19:19 2019.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Manim's documentation
=====================
Welcome to Manim's documentation!
=================================
.. image:: https://cdn.jsdelivr.net/gh/3b1b/manim@master/logo/white_with_name.png
These docs are generated from the master branch of the
`Manim repo <https://github.com/3b1b/manim>`_. You can contribute by submitting
a pull request there.
Manim is an animation engine for explanatory math videos. It's used to create precise animations programmatically, as seen in the videos
at `3Blue1Brown <https://www.3blue1brown.com/>`_.
And here is a Chinese version of this documentation: https://docs.manim.org.cn/
.. toctree::
:maxdepth: 2
:caption: Contents
:maxdepth: 2
:caption: Getting Started
about
installation/index
getting_started/index
coordinate
animation
constants
getting_started/installation
getting_started/quickstart
getting_started/configuration
getting_started/example_scenes
getting_started/config
getting_started/structure
getting_started/whatsnew
.. toctree::
:maxdepth: 2
:caption: Documentation
Indices and tables
==================
documentation/constants
documentation/custom_config
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
.. toctree::
:maxdepth: 2
:caption: Development
development/changelog
development/contributing
development/about

View File

@@ -1,12 +0,0 @@
Installation
============
Instructions on installing Manim
.. toctree::
:maxdepth: 2
:caption: Contents
linux
mac
windows

View File

@@ -1,64 +0,0 @@
Linux
=====
Ubuntu
------
Install system libraries::
# apt install sox ffmpeg libcairo2 libcairo2-dev
Install Latex distribution::
# apt install texlive-full
Install manim via pypi::
# pip3 install manimlib
OR Install manim via the git repository with venv::
$ git clone https://github.com/3b1b/manim
$ cd manim
$ python3 -m venv ./
$ source bin/activate
$ pip3 install -r requirement.txt
To use manim in virtual environment you need to activate the environment with
the ``activate`` binary by doing ``source bin/activate``, to exit use the ``deactivate`` command.
.. note:: The git repository is updated first before the one on pypi. The git repository also
includes project files used to produce 3b1b videos. Some of the old projects might not
work as due to api changes.
.. note:: The required latex packages are dictated by
``manimlib/tex_template.tex`` which ``texlive-full`` will satisfy. The download size
can be quite large. If you wish to install only the packages required to use
manim, substitude ``texlive-full`` with::
texlive texlive-latex-extra texlive-fonts-extra
texlive-latex-recommended texlive-science texlive-fonts-extra tipa
Arch Linux
----------
Install system libraries::
# pacman -S cairo ffmpeg opencv sox
Install Latex distribution::
# pacman -S texlive-most
OR install python-manimlib_:sup:`AUR` package::
$ git clone https://aur.archlinux.org/python-manimlib.git
$ cd python-manimlib
$ makepkg -si
You can use AUR helpers such as yay_:sup:`AUR`::
$ yay -S python-manimlib
.. _python-manimlib: https://aur.archlinux.org/packages/python-manimlib/
.. _yay: https://aur.archlinux.org/packages/yay/

View File

@@ -1,12 +0,0 @@
Mac
===
The simplest way to install the system dependencies on Mac OS X is with Homebrew.
Mac come preinstalled with python2, but to use manim, python3 is required
1. Install python3 https://docs.python.org/3/using/mac.html
2. Install Cairo: ``brew install cairo``
3. Install Sox: ``brew install sox``
4. Install ffmpeg: ``brew install ffmpeg``
5. Install latex (MacTeX): ``brew cask install mactex``
6. Install manimlib ``pip install manimlib`` (or ``pip install --user manimlib`` to just yourself)

View File

@@ -1,60 +0,0 @@
Windows
=======
Install System Libraries
------------------------
Make sure you have *Python 3* for Windows installed first:
https://www.python.org/downloads/windows/
Install ffmpeg:
https://ffmpeg.org/download.html#build-windows
Install sox:
http://sox.sourceforge.net/Main/HomePage
Install a latex distribution. On Windows MikTex is commonly used:
https://miktex.org/howto/install-miktex
Path configuration
------------------
To invoke commandline without supplying path to the binary
the PATH environment needs to be configured. Below are template examples, please change
the path according to your username and specific python version. Assuming all the
softwares are installed with no alteration to the installation paths::
C:\Users\$username\AppData\local\Programs\Python\Python$version\
C:\Users\$username\AppData\local\Programs\Python\Python$version\Scripts\
C:\MikTex\miktex\bin\x64\
C:\ffmpeg\bin\
The path entries should be separated by semicolon.
Installing python packages and manim
------------------------------------
Make sure you can start pip using ``pip`` in your commandline. Then do
``pip install pyreadline`` for the ``readline`` package.
Grab the pycairo wheel binary ``pycairo1.18.0cp37cp37mwin32.whl`` from https://www.lfd.uci.edu/~gohlke/pythonlibs/#pycairo
and install it via ``python -m pip install C:\absolute\path\to\the\whl\file``
clone the manim repository if you have git ``git clone https://github.com/3b1b/manim`` or download the zip file from
the repository page with ``Clone or download`` button and unzip it.
Open the commandline within the manim directory with ``Shift + Right click`` on an empty space in the folder and select ``open command window here``
Install manim python dependencies with ``pip install -r requirements.txt``
Test the installation
---------------------
Type in ``python -m manim -h`` and if nothing went wrong during the installation process you should see the help text.
Use ``python -m manim example_scenes.py SquareToCircle -pl`` to render the example scene and the file should play after rendering. The movie file should be
in ``media/videos/example_scenes/480p15``

View File

@@ -0,0 +1,108 @@
from docutils import nodes
from docutils.parsers.rst import directives, Directive
import jinja2
import os
class skip_manim_node(nodes.Admonition, nodes.Element):
pass
def visit(self, node, name=""):
self.visit_admonition(node, name)
def depart(self, node):
self.depart_admonition(node)
class ManimExampleDirective(Directive):
has_content = True
required_arguments = 1
optional_arguments = 0
option_spec = {
"hide_code": bool,
"media": str,
}
final_argument_whitespace = True
def run(self):
hide_code = "hide_code" in self.options
scene_name = self.arguments[0]
media_file_name = self.options["media"]
source_block = [
".. code-block:: python",
"",
*[" " + line for line in self.content],
]
source_block = "\n".join(source_block)
state_machine = self.state_machine
document = state_machine.document
if any(media_file_name.endswith(ext) for ext in [".png", ".jpg", ".gif"]):
is_video = False
else:
is_video = True
rendered_template = jinja2.Template(TEMPLATE).render(
scene_name=scene_name,
scene_name_lowercase=scene_name.lower(),
hide_code=hide_code,
is_video=is_video,
media_file_name=media_file_name,
source_block=source_block,
)
state_machine.insert_input(
rendered_template.split("\n"), source=document.attributes["source"]
)
return []
def setup(app):
app.add_node(skip_manim_node, html=(visit, depart))
setup.app = app
setup.config = app.config
setup.confdir = app.confdir
app.add_directive("manim-example", ManimExampleDirective)
metadata = {"parallel_read_safe": False, "parallel_write_safe": True}
return metadata
TEMPLATE = r"""
{% if not hide_code %}
.. raw:: html
<div class="manim-example">
{% endif %}
{% if is_video %}
.. raw:: html
<video id="{{ scene_name_lowercase }}" class="manim-video" controls loop autoplay src="{{ media_file_name }}"></video>
{% else %}
.. image:: {{ media_file_name }}
:align: center
:name: {{ scene_name_lowercase }}
{% endif %}
{% if not hide_code %}
.. raw:: html
<h5 class="example-header">{{ scene_name }}<a class="headerlink" href="#{{ scene_name_lowercase }}">¶</a></h5>
{{ source_block }}
{% endif %}
.. raw:: html
</div>
"""

View File

@@ -1,20 +0,0 @@
name: manim
channels:
- defaults
- conda-forge
dependencies:
- python=3.7
- cairo
- ffmpeg
- colour==0.1.5
- numpy==1.15.0
- pillow==5.2.0
- scipy==1.1.0
- tqdm==4.24.0
- opencv==3.4.2
- pycairo==1.18.0
- pydub==0.23.0
- ffmpeg
- pygments==2.6.1
- pip:
- pyreadline

View File

@@ -1,136 +1,674 @@
#!/usr/bin/env python
from manimlib.imports import *
from manimlib import *
import numpy as np
# To watch one of these scenes, run the following:
# python -m manim example_scenes.py SquareToCircle -pl
#
# Use the flag -l for a faster rendering at a lower
# quality.
# manimgl example_scenes.py OpeningManimExample
# Use -s to skip to the end and just save the final frame
# Use the -p to have the animation (or image, if -s was
# used) pop up once done.
# Use -w to write the animation to a file
# Use -o to write it to a file and open it once done
# Use -n <number> to skip ahead to the n'th animation of a scene.
# Use -r <number> to specify a resolution (for example, -r 1080
# for a 1920x1080 video)
class OpeningManimExample(Scene):
def construct(self):
title = TextMobject("This is some \\LaTeX")
basel = TexMobject(
"\\sum_{n=1}^\\infty "
"\\frac{1}{n^2} = \\frac{\\pi^2}{6}"
intro_words = Text("""
The original motivation for manim was to
better illustrate mathematical functions
as transformations.
""")
intro_words.to_edge(UP)
self.play(Write(intro_words))
self.wait(2)
# Linear transform
grid = NumberPlane((-10, 10), (-5, 5))
matrix = [[1, 1], [0, 1]]
linear_transform_words = VGroup(
Text("This is what the matrix"),
IntegerMatrix(matrix, include_background_rectangle=True),
Text("looks like")
)
VGroup(title, basel).arrange(DOWN)
linear_transform_words.arrange(RIGHT)
linear_transform_words.to_edge(UP)
linear_transform_words.set_stroke(BLACK, 10, background=True)
self.play(
Write(title),
FadeInFrom(basel, UP),
ShowCreation(grid),
FadeTransform(intro_words, linear_transform_words)
)
self.wait()
transform_title = TextMobject("That was a transform")
transform_title.to_corner(UP + LEFT)
self.play(
Transform(title, transform_title),
LaggedStart(*map(FadeOutAndShiftDown, basel)),
)
self.play(grid.animate.apply_matrix(matrix), run_time=3)
self.wait()
grid = NumberPlane()
grid_title = TextMobject("This is a grid")
grid_title.scale(1.5)
grid_title.move_to(transform_title)
# Complex map
c_grid = ComplexPlane()
moving_c_grid = c_grid.copy()
moving_c_grid.prepare_for_nonlinear_transform()
c_grid.set_stroke(BLUE_E, 1)
c_grid.add_coordinate_labels(font_size=24)
complex_map_words = TexText("""
Or thinking of the plane as $\\mathds{C}$,\\\\
this is the map $z \\rightarrow z^2$
""")
complex_map_words.to_corner(UR)
complex_map_words.set_stroke(BLACK, 5, background=True)
self.add(grid, grid_title) # Make sure title is on top of grid
self.play(
FadeOut(title),
FadeInFromDown(grid_title),
ShowCreation(grid, run_time=3, lag_ratio=0.1),
)
self.wait()
grid_transform_title = TextMobject(
"That was a non-linear function \\\\"
"applied to the grid"
)
grid_transform_title.move_to(grid_title, UL)
grid.prepare_for_nonlinear_transform()
self.play(
grid.apply_function,
lambda p: p + np.array([
np.sin(p[1]),
np.sin(p[0]),
0,
]),
run_time=3,
FadeOut(grid),
Write(c_grid, run_time=3),
FadeIn(moving_c_grid),
FadeTransform(linear_transform_words, complex_map_words),
)
self.wait()
self.play(
Transform(grid_title, grid_transform_title)
moving_c_grid.animate.apply_complex_function(lambda z: z**2),
run_time=6,
)
self.wait()
self.wait(2)
class SquareToCircle(Scene):
class AnimatingMethods(Scene):
def construct(self):
circle = Circle()
square = Square()
square.flip(RIGHT)
square.rotate(-3 * TAU / 8)
circle.set_fill(PINK, opacity=0.5)
grid = Tex(r"\pi").get_grid(10, 10, height=4)
self.add(grid)
self.play(ShowCreation(square))
self.play(Transform(square, circle))
self.play(FadeOut(square))
# You can animate the application of mobject methods with the
# ".animate" syntax:
self.play(grid.animate.shift(LEFT))
# Alternatively, you can use the older syntax by passing the
# method and then the arguments to the scene's "play" function:
self.play(grid.shift, LEFT)
class WarpSquare(Scene):
def construct(self):
square = Square()
self.play(ApplyPointwiseFunction(
lambda point: complex_to_R3(np.exp(R3_to_complex(point))),
square
))
# Both of those will interpolate between the mobject's initial
# state and whatever happens when you apply that method.
# For this example, calling grid.shift(LEFT) would shift the
# grid one unit to the left, but both of the previous calls to
# "self.play" animate that motion.
# The same applies for any method, including those setting colors.
self.play(grid.animate.set_color(YELLOW))
self.wait()
self.play(grid.animate.set_submobject_colors_by_gradient(BLUE, GREEN))
self.wait()
self.play(grid.animate.set_height(TAU - MED_SMALL_BUFF))
self.wait()
# The method Mobject.apply_complex_function lets you apply arbitrary
# complex functions, treating the points defining the mobject as
# complex numbers.
self.play(grid.animate.apply_complex_function(np.exp), run_time=5)
self.wait()
# Even more generally, you could apply Mobject.apply_function,
# which takes in functions form R^3 to R^3
self.play(
grid.animate.apply_function(
lambda p: [
p[0] + 0.5 * math.sin(p[1]),
p[1] + 0.5 * math.sin(p[0]),
p[2]
]
),
run_time=5,
)
self.wait()
class WriteStuff(Scene):
class TextExample(Scene):
def construct(self):
example_text = TextMobject(
"This is some text",
tex_to_color_map={"text": YELLOW}
# To run this scene properly, you should have "Consolas" font in your computer
# for full usage, you can see https://github.com/3b1b/manim/pull/680
text = Text("Here is a text", font="Consolas", font_size=90)
difference = Text(
"""
The most important difference between Text and TexText is that\n
you can change the font more easily, but can't use the LaTeX grammar
""",
font="Arial", font_size=24,
# t2c is a dict that you can choose color for different text
t2c={"Text": BLUE, "TexText": BLUE, "LaTeX": ORANGE}
)
example_tex = TexMobject(
"\\sum_{k=1}^\\infty {1 \\over k^2} = {\\pi^2 \\over 6}",
)
group = VGroup(example_text, example_tex)
group.arrange(DOWN)
group.set_width(FRAME_WIDTH - 2 * LARGE_BUFF)
VGroup(text, difference).arrange(DOWN, buff=1)
self.play(Write(text))
self.play(FadeIn(difference, UP))
self.wait(3)
self.play(Write(example_text))
self.play(Write(example_tex))
fonts = Text(
"And you can also set the font according to different words",
font="Arial",
t2f={"font": "Consolas", "words": "Consolas"},
t2c={"font": BLUE, "words": GREEN}
)
fonts.set_width(FRAME_WIDTH - 1)
slant = Text(
"And the same as slant and weight",
font="Consolas",
t2s={"slant": ITALIC},
t2w={"weight": BOLD},
t2c={"slant": ORANGE, "weight": RED}
)
VGroup(fonts, slant).arrange(DOWN, buff=0.8)
self.play(FadeOut(text), FadeOut(difference, shift=DOWN))
self.play(Write(fonts))
self.wait()
self.play(Write(slant))
self.wait()
class TexTransformExample(Scene):
def construct(self):
to_isolate = ["B", "C", "=", "(", ")"]
lines = VGroup(
# Passing in muliple arguments to Tex will result
# in the same expression as if those arguments had
# been joined together, except that the submobject
# hierarchy of the resulting mobject ensure that the
# Tex mobject has a subject corresponding to
# each of these strings. For example, the Tex mobject
# below will have 5 subjects, corresponding to the
# expressions [A^2, +, B^2, =, C^2]
Tex("A^2", "+", "B^2", "=", "C^2"),
# Likewise here
Tex("A^2", "=", "C^2", "-", "B^2"),
# Alternatively, you can pass in the keyword argument
# "isolate" with a list of strings that should be out as
# their own submobject. So the line below is equivalent
# to the commented out line below it.
Tex("A^2 = (C + B)(C - B)", isolate=["A^2", *to_isolate]),
# Tex("A^2", "=", "(", "C", "+", "B", ")", "(", "C", "-", "B", ")"),
Tex("A = \\sqrt{(C + B)(C - B)}", isolate=["A", *to_isolate])
)
lines.arrange(DOWN, buff=LARGE_BUFF)
for line in lines:
line.set_color_by_tex_to_color_map({
"A": BLUE,
"B": TEAL,
"C": GREEN,
})
play_kw = {"run_time": 2}
self.add(lines[0])
# The animation TransformMatchingTex will line up parts
# of the source and target which have matching tex strings.
# Here, giving it a little path_arc makes each part sort of
# rotate into their final positions, which feels appropriate
# for the idea of rearranging an equation
self.play(
TransformMatchingTex(
lines[0].copy(), lines[1],
path_arc=90 * DEGREES,
),
**play_kw
)
self.wait()
# Now, we could try this again on the next line...
self.play(
TransformMatchingTex(lines[1].copy(), lines[2]),
**play_kw
)
self.wait()
# ...and this looks nice enough, but since there's no tex
# in lines[2] which matches "C^2" or "B^2", those terms fade
# out to nothing while the C and B terms fade in from nothing.
# If, however, we want the C^2 to go to C, and B^2 to go to B,
# we can specify that with a key map.
self.play(FadeOut(lines[2]))
self.play(
TransformMatchingTex(
lines[1].copy(), lines[2],
key_map={
"C^2": "C",
"B^2": "B",
}
),
**play_kw
)
self.wait()
# And to finish off, a simple TransformMatchingShapes would work
# just fine. But perhaps we want that exponent on A^2 to transform into
# the square root symbol. At the moment, lines[2] treats the expression
# A^2 as a unit, so we might create a new version of the same line which
# separates out just the A. This way, when TransformMatchingTex lines up
# all matching parts, the only mismatch will be between the "^2" from
# new_line2 and the "\sqrt" from the final line. By passing in,
# transform_mismatches=True, it will transform this "^2" part into
# the "\sqrt" part.
new_line2 = Tex("A^2 = (C + B)(C - B)", isolate=["A", *to_isolate])
new_line2.replace(lines[2])
new_line2.match_style(lines[2])
self.play(
TransformMatchingTex(
new_line2, lines[3],
transform_mismatches=True,
),
**play_kw
)
self.wait(3)
self.play(FadeOut(lines, RIGHT))
# Alternatively, if you don't want to think about breaking up
# the tex strings deliberately, you can TransformMatchingShapes,
# which will try to line up all pieces of a source mobject with
# those of a target, regardless of the submobject hierarchy in
# each one, according to whether those pieces have the same
# shape (as best it can).
source = Text("the morse code", height=1)
target = Text("here come dots", height=1)
self.play(Write(source))
self.wait()
kw = {"run_time": 3, "path_arc": PI / 2}
self.play(TransformMatchingShapes(source, target, **kw))
self.wait()
self.play(TransformMatchingShapes(target, source, **kw))
self.wait()
class UpdatersExample(Scene):
def construct(self):
decimal = DecimalNumber(
0,
show_ellipsis=True,
num_decimal_places=3,
include_sign=True,
)
square = Square().to_edge(UP)
square = Square()
square.set_fill(BLUE_E, 1)
decimal.add_updater(lambda d: d.next_to(square, RIGHT))
decimal.add_updater(lambda d: d.set_value(square.get_center()[1]))
self.add(square, decimal)
# On all frames, the constructor Brace(square, UP) will
# be called, and the mobject brace will set its data to match
# that of the newly constructed object
brace = always_redraw(Brace, square, UP)
text, number = label = VGroup(
Text("Width = "),
DecimalNumber(
0,
show_ellipsis=True,
num_decimal_places=2,
include_sign=True,
)
)
label.arrange(RIGHT)
# This ensures that the method deicmal.next_to(square)
# is called on every frame
always(label.next_to, brace, UP)
# You could also write the following equivalent line
# label.add_updater(lambda m: m.next_to(brace, UP))
# If the argument itself might change, you can use f_always,
# for which the arguments following the initial Mobject method
# should be functions returning arguments to that method.
# The following line ensures thst decimal.set_value(square.get_y())
# is called every frame
f_always(number.set_value, square.get_width)
# You could also write the following equivalent line
# number.add_updater(lambda m: m.set_value(square.get_width()))
self.add(square, brace, label)
# Notice that the brace and label track with the square
self.play(
square.to_edge, DOWN,
square.animate.scale(2),
rate_func=there_and_back,
run_time=5,
run_time=2,
)
self.wait()
self.play(
square.animate.set_width(5, stretch=True),
run_time=3,
)
self.wait()
self.play(
square.animate.set_width(2),
run_time=3
)
self.wait()
# See old_projects folder for many, many more
# In general, you can alway call Mobject.add_updater, and pass in
# a function that you want to be called on every frame. The function
# should take in either one argument, the mobject, or two arguments,
# the mobject and the amount of time since the last frame.
now = self.time
w0 = square.get_width()
square.add_updater(
lambda m: m.set_width(w0 * math.sin(self.time - now) + w0)
)
self.wait(4 * PI)
class CoordinateSystemExample(Scene):
def construct(self):
axes = Axes(
# x-axis ranges from -1 to 10, with a default step size of 1
x_range=(-1, 10),
# y-axis ranges from -2 to 2 with a step size of 0.5
y_range=(-2, 2, 0.5),
# The axes will be stretched so as to match the specified
# height and width
height=6,
width=10,
# Axes is made of two NumberLine mobjects. You can specify
# their configuration with axis_config
axis_config={
"stroke_color": GREY_A,
"stroke_width": 2,
},
# Alternatively, you can specify configuration for just one
# of them, like this.
y_axis_config={
"include_tip": False,
}
)
# Keyword arguments of add_coordinate_labels can be used to
# configure the DecimalNumber mobjects which it creates and
# adds to the axes
axes.add_coordinate_labels(
font_size=20,
num_decimal_places=1,
)
self.add(axes)
# Axes descends from the CoordinateSystem class, meaning
# you can call call axes.coords_to_point, abbreviated to
# axes.c2p, to associate a set of coordinates with a point,
# like so:
dot = Dot(color=RED)
dot.move_to(axes.c2p(0, 0))
self.play(FadeIn(dot, scale=0.5))
self.play(dot.animate.move_to(axes.c2p(3, 2)))
self.wait()
self.play(dot.animate.move_to(axes.c2p(5, 0.5)))
self.wait()
# Similarly, you can call axes.point_to_coords, or axes.p2c
# print(axes.p2c(dot.get_center()))
# We can draw lines from the axes to better mark the coordinates
# of a given point.
# Here, the always_redraw command means that on each new frame
# the lines will be redrawn
h_line = always_redraw(lambda: axes.get_h_line(dot.get_left()))
v_line = always_redraw(lambda: axes.get_v_line(dot.get_bottom()))
self.play(
ShowCreation(h_line),
ShowCreation(v_line),
)
self.play(dot.animate.move_to(axes.c2p(3, -2)))
self.wait()
self.play(dot.animate.move_to(axes.c2p(1, 1)))
self.wait()
# If we tie the dot to a particular set of coordinates, notice
# that as we move the axes around it respects the coordinate
# system defined by them.
f_always(dot.move_to, lambda: axes.c2p(1, 1))
self.play(
axes.animate.scale(0.75).to_corner(UL),
run_time=2,
)
self.wait()
self.play(FadeOut(VGroup(axes, dot, h_line, v_line)))
# Other coordinate systems you can play around with include
# ThreeDAxes, NumberPlane, and ComplexPlane.
class GraphExample(Scene):
def construct(self):
axes = Axes((-3, 10), (-1, 8))
axes.add_coordinate_labels()
self.play(Write(axes, lag_ratio=0.01, run_time=1))
# Axes.get_graph will return the graph of a function
sin_graph = axes.get_graph(
lambda x: 2 * math.sin(x),
color=BLUE,
)
# By default, it draws it so as to somewhat smoothly interpolate
# between sampled points (x, f(x)). If the graph is meant to have
# a corner, though, you can set use_smoothing to False
relu_graph = axes.get_graph(
lambda x: max(x, 0),
use_smoothing=False,
color=YELLOW,
)
# For discontinuous functions, you can specify the point of
# discontinuity so that it does not try to draw over the gap.
step_graph = axes.get_graph(
lambda x: 2.0 if x > 3 else 1.0,
discontinuities=[3],
color=GREEN,
)
# Axes.get_graph_label takes in either a string or a mobject.
# If it's a string, it treats it as a LaTeX expression. By default
# it places the label next to the graph near the right side, and
# has it match the color of the graph
sin_label = axes.get_graph_label(sin_graph, "\\sin(x)")
relu_label = axes.get_graph_label(relu_graph, Text("ReLU"))
step_label = axes.get_graph_label(step_graph, Text("Step"), x=4)
self.play(
ShowCreation(sin_graph),
FadeIn(sin_label, RIGHT),
)
self.wait(2)
self.play(
ReplacementTransform(sin_graph, relu_graph),
FadeTransform(sin_label, relu_label),
)
self.wait()
self.play(
ReplacementTransform(relu_graph, step_graph),
FadeTransform(relu_label, step_label),
)
self.wait()
parabola = axes.get_graph(lambda x: 0.25 * x**2)
parabola.set_stroke(BLUE)
self.play(
FadeOut(step_graph),
FadeOut(step_label),
ShowCreation(parabola)
)
self.wait()
# You can use axes.input_to_graph_point, abbreviated
# to axes.i2gp, to find a particular point on a graph
dot = Dot(color=RED)
dot.move_to(axes.i2gp(2, parabola))
self.play(FadeIn(dot, scale=0.5))
# A value tracker lets us animate a parameter, usually
# with the intent of having other mobjects update based
# on the parameter
x_tracker = ValueTracker(2)
f_always(
dot.move_to,
lambda: axes.i2gp(x_tracker.get_value(), parabola)
)
self.play(x_tracker.animate.set_value(4), run_time=3)
self.play(x_tracker.animate.set_value(-2), run_time=3)
self.wait()
class SurfaceExample(Scene):
CONFIG = {
"camera_class": ThreeDCamera,
}
def construct(self):
surface_text = Text("For 3d scenes, try using surfaces")
surface_text.fix_in_frame()
surface_text.to_edge(UP)
self.add(surface_text)
self.wait(0.1)
torus1 = Torus(r1=1, r2=1)
torus2 = Torus(r1=3, r2=1)
sphere = Sphere(radius=3, resolution=torus1.resolution)
# You can texture a surface with up to two images, which will
# be interpreted as the side towards the light, and away from
# the light. These can be either urls, or paths to a local file
# in whatever you've set as the image directory in
# the custom_config.yml file
# day_texture = "EarthTextureMap"
# night_texture = "NightEarthTextureMap"
day_texture = "https://upload.wikimedia.org/wikipedia/commons/thumb/4/4d/Whole_world_-_land_and_oceans.jpg/1280px-Whole_world_-_land_and_oceans.jpg"
night_texture = "https://upload.wikimedia.org/wikipedia/commons/thumb/b/ba/The_earth_at_night.jpg/1280px-The_earth_at_night.jpg"
surfaces = [
TexturedSurface(surface, day_texture, night_texture)
for surface in [sphere, torus1, torus2]
]
for mob in surfaces:
mob.shift(IN)
mob.mesh = SurfaceMesh(mob)
mob.mesh.set_stroke(BLUE, 1, opacity=0.5)
# Set perspective
frame = self.camera.frame
frame.set_euler_angles(
theta=-30 * DEGREES,
phi=70 * DEGREES,
)
surface = surfaces[0]
self.play(
FadeIn(surface),
ShowCreation(surface.mesh, lag_ratio=0.01, run_time=3),
)
for mob in surfaces:
mob.add(mob.mesh)
surface.save_state()
self.play(Rotate(surface, PI / 2), run_time=2)
for mob in surfaces[1:]:
mob.rotate(PI / 2)
self.play(
Transform(surface, surfaces[1]),
run_time=3
)
self.play(
Transform(surface, surfaces[2]),
# Move camera frame during the transition
frame.animate.increment_phi(-10 * DEGREES),
frame.animate.increment_theta(-20 * DEGREES),
run_time=3
)
# Add ambient rotation
frame.add_updater(lambda m, dt: m.increment_theta(-0.1 * dt))
# Play around with where the light is
light_text = Text("You can move around the light source")
light_text.move_to(surface_text)
light_text.fix_in_frame()
self.play(FadeTransform(surface_text, light_text))
light = self.camera.light_source
self.add(light)
light.save_state()
self.play(light.animate.move_to(3 * IN), run_time=5)
self.play(light.animate.shift(10 * OUT), run_time=5)
drag_text = Text("Try moving the mouse while pressing d or s")
drag_text.move_to(light_text)
drag_text.fix_in_frame()
self.play(FadeTransform(light_text, drag_text))
self.wait()
class InteractiveDevelopment(Scene):
def construct(self):
circle = Circle()
circle.set_fill(BLUE, opacity=0.5)
circle.set_stroke(BLUE_E, width=4)
square = Square()
self.play(ShowCreation(square))
self.wait()
# This opens an iPython termnial where you can keep writing
# lines as if they were part of this construct method.
# In particular, 'square', 'circle' and 'self' will all be
# part of the local namespace in that terminal.
self.embed()
# Try copying and pasting some of the lines below into
# the interactive shell
self.play(ReplacementTransform(square, circle))
self.wait()
self.play(circle.animate.stretch(4, 0))
self.play(Rotate(circle, 90 * DEGREES))
self.play(circle.animate.shift(2 * RIGHT).scale(0.25))
text = Text("""
In general, using the interactive shell
is very helpful when developing new scenes
""")
self.play(Write(text))
# In the interactive shell, you can just type
# play, add, remove, clear, wait, save_state and restore,
# instead of self.play, self.add, self.remove, etc.
# To interact with the window, type touch(). You can then
# scroll in the window, or zoom by holding down 'z' while scrolling,
# and change camera perspective by holding down 'd' while moving
# the mouse. Press 'r' to reset to the standard camera position.
# Press 'q' to stop interacting with the window and go back to
# typing new commands into the shell.
# In principle you can customize a scene to be responsive to
# mouse and keyboard interactions
always(circle.move_to, self.mouse_point)
class ControlsExample(Scene):
def setup(self):
self.textbox = Textbox()
self.checkbox = Checkbox()
self.color_picker = ColorSliders()
self.panel = ControlPanel(
Text("Text", font_size=24), self.textbox, Line(),
Text("Show/Hide Text", font_size=24), self.checkbox, Line(),
Text("Color of Text", font_size=24), self.color_picker
)
self.add(self.panel)
def construct(self):
text = Text("text", font_size=96)
def text_updater(old_text):
assert(isinstance(old_text, Text))
new_text = Text(self.textbox.get_value(), font_size=old_text.font_size)
# new_text.align_data_and_family(old_text)
new_text.move_to(old_text)
if self.checkbox.get_value():
new_text.set_fill(
color=self.color_picker.get_picked_color(),
opacity=self.color_picker.get_picked_opacity()
)
else:
new_text.set_opacity(0)
old_text.become(new_text)
text.add_updater(text_updater)
self.add(MotionMobject(text))
self.textbox.set_value("Manim")
# self.wait(60)
# self.embed()
# See https://github.com/3b1b/videos for many, many more

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,107 +0,0 @@
from active_projects.diffyq.part1.pendulum import *
from active_projects.diffyq.part1.staging import *
from active_projects.diffyq.part1.pi_scenes import *
from active_projects.diffyq.part1.phase_space import *
from active_projects.diffyq.part1.wordy_scenes import *
OUTPUT_DIRECTORY = "diffyq/part1"
SCENES_IN_ORDER = [
WhenChangeIsEasier,
VectorFieldTest,
IntroducePendulum,
MultiplePendulumsOverlayed,
PeriodFormula,
FormulasAreLies,
MediumAnglePendulum,
MediumHighAnglePendulum,
HighAnglePendulum,
LowAnglePendulum,
SomeOfYouWatching,
SmallAngleApproximationTex,
VeryLowAnglePendulum,
FormulasAreLies,
TourOfDifferentialEquations,
WherePendulumLeads,
LongDoublePendulum,
# FollowThisThread,
StrogatzQuote,
ShowHorizontalDashedLine,
RabbitFoxPopulations,
RabbitFoxEquation,
# Something...
ShowSimpleTrajectory,
SimpleProjectileEquation,
SimpleProjectileEquationVGraphFreedom,
ShowGravityAcceleration,
UniversalGravityLawSymbols,
ExampleTypicalODE,
AnalyzePendulumForce,
ShowSineValues,
BuildUpEquation,
AirResistanceBrace,
ShowDerivativeVideo,
SubtleAirCurrents,
SimpleDampenedPendulum,
DefineODE,
SecondOrderEquationExample,
ODEvsPDEinFrames,
ProveTeacherWrong,
SetAsideSeekingSolution,
#
WriteInRadians,
XEqLThetaToCorner,
ComingUp,
InputLabel,
SoWhatIsThetaThen,
ReallyHardToSolve,
ReasonForSolution,
PhysicistPhaseSpace,
GleickQuote,
SpectrumOfStartingStates,
WritePhaseFlow,
AskAboutStability,
LoveExample,
PassageOfTime,
LovePhaseSpace,
ComparePhysicsToLove,
FramesComparingPhysicsToLove,
SetupToTakingManyTinySteps,
ShowClutterPrevention,
# VisualizeHeightSlopeCurvature,
VisualizeStates,
ReferencePiCollisionStateSpaces,
IntroduceVectorField,
XComponentArrows,
BreakingSecondOrderIntoTwoFirstOrder,
ShowPendulumPhaseFlow,
ShowHighVelocityCase,
TweakMuInFormula,
TweakMuInVectorField,
FromODEToVectorField,
LorenzVectorField,
ThreeBodiesInSpace,
AltThreeBodiesInSpace,
TwoBodiesInSpace,
TwoBodiesWithZPart,
ThreeBodyTitle,
ThreeBodySymbols,
#
HighAmplitudePendulum,
WritePhaseSpace,
#
AskAboutActuallySolving,
WriteODESolvingCode,
TakeManyTinySteps,
ManyStepsFromDifferentStartingPoints,
InaccurateComputation,
HungerForExactness,
ShowRect,
ShowSquare,
JumpToThisPoint,
ThreeBodyEquation,
ItGetsWorse,
ChaosTitle,
RevisitQuote,
EndScreen,
Thumbnail,
]

View File

@@ -1,41 +0,0 @@
from active_projects.diffyq.part2.staging import *
from active_projects.diffyq.part2.fourier_series import *
from active_projects.diffyq.part2.heat_equation import *
from active_projects.diffyq.part2.pi_scenes import *
from active_projects.diffyq.part2.wordy_scenes import *
OUTPUT_DIRECTORY = "diffyq/part2"
SCENES_IN_ORDER = [
PartTwoOfTour,
HeatEquationIntroTitle,
BrownianMotion,
BlackScholes,
ContrastChapters1And2,
FourierSeriesIntro,
FourierSeriesIntroBackground20,
ExplainCircleAnimations,
# FourierSeriesIntroBackground4,
# FourierSeriesIntroBackground8,
# FourierSeriesIntroBackground12,
TwoDBodyWithManyTemperatures,
TwoDBodyWithManyTemperaturesGraph,
TwoDBodyWithManyTemperaturesContour,
BringTwoRodsTogether,
ShowEvolvingTempGraphWithArrows,
# TodaysTargetWrapper,
WriteHeatEquation,
ReactionsToInitialHeatEquation,
TalkThrough1DHeatGraph,
ShowCubeFormation,
CompareInputsOfGeneralCaseTo1D,
ContrastXChangesToTChanges,
ShowPartialDerivativeSymbols,
WriteHeatEquation,
ShowCurvatureToRateOfChangeIntuition,
ContrastPDEToODE,
TransitionToTempVsTime,
Show1DAnd3DEquations,
#
AskAboutWhereEquationComesFrom,
DiscreteSetup,
]

View File

@@ -1,70 +0,0 @@
from active_projects.diffyq.part3.staging import *
from active_projects.diffyq.part3.temperature_graphs import *
from active_projects.diffyq.part3.pi_creature_scenes import *
from active_projects.diffyq.part3.wordy_scenes import *
from active_projects.diffyq.part3.discrete_case import *
OUTPUT_DIRECTORY = "diffyq/part3"
SCENES_IN_ORDER = [
LastChapterWrapper,
ThreeConstraints,
OceanOfPossibilities,
ThreeMainObservations,
SimpleCosExpGraph,
AddMultipleSolutions,
FourierSeriesIllustraiton,
BreakDownAFunction,
SineCurveIsUnrealistic,
AnalyzeSineCurve,
EquationAboveSineAnalysis,
ExponentialDecay,
InvestmentGrowth,
GrowingPileOfMoney,
CarbonDecayCurve,
CarbonDecayingInMammoth,
SineWaveScaledByExp,
ShowSinExpDerivatives,
IfOnly,
BoundaryConditionInterlude,
BoundaryConditionReference,
GiantCross,
SimulateRealSineCurve,
DerivativesOfLinearFunction,
StraightLine3DGraph,
SimulateLinearGraph,
EmphasizeBoundaryPoints,
ShowNewRuleAtDiscreteBoundary,
DiscreteEvolutionPoint25,
DiscreteEvolutionPoint1,
FlatEdgesForDiscreteEvolution,
FlatEdgesForDiscreteEvolutionTinySteps,
FlatEdgesContinuousEvolution,
FlatAtBoundaryWords,
SlopeToHeatFlow,
CloserLookAtStraightLine,
WriteOutBoundaryCondition,
SoWeGotNowhere,
ManipulateSinExpSurface,
HeatEquationFrame,
ShowFreq1CosExpDecay,
ShowFreq2CosExpDecay,
ShowFreq4CosExpDecay,
CompareFreqDecays1to2,
CompareFreqDecays1to4,
CompareFreqDecays2to4,
ShowHarmonics,
ShowHarmonicSurfaces,
# SimpleCosExpGraph,
# AddMultipleSolutions,
# IveHeardOfThis,
# FourierSeriesOfLineIllustration,
# InFouriersShoes,
]
PART_4_SCENES = [
FourierSeriesIllustraiton,
FourierNameIntro,
CircleAnimationOfF,
]

View File

@@ -1,65 +0,0 @@
from active_projects.diffyq.part4.staging import *
from active_projects.diffyq.part4.fourier_series_scenes import *
from active_projects.diffyq.part4.pi_creature_scenes import *
from active_projects.diffyq.part4.three_d_graphs import *
from active_projects.diffyq.part4.temperature_scenes import *
from active_projects.diffyq.part4.complex_functions import *
from active_projects.diffyq.part4.long_fourier_scenes import *
from active_projects.diffyq.part3.staging import *
OUTPUT_DIRECTORY = "diffyq/part4"
SCENES_IN_ORDER = [
ComplexFourierSeriesExample,
FourierOfFourier,
FourierOfFourierZoomedIn,
FourierOfFourier100xZoom,
FourierSeriesFormula,
RelationToOtherVideos,
WhyWouldYouCare,
ShowLinearity,
CombineSeveralSolutions,
FourierGainsImmortality,
SolveForWavesNothingElse,
CycleThroughManyLinearCombinations,
StepFunctionExample,
WhichWavesAreAvailable,
AlternateBoundaryConditions,
AskQuestionOfGraph,
CommentOnFouriersImmortality,
HangOnThere,
ShowInfiniteSum,
TechnicalNuances,
BreakDownStepFunction,
StepFunctionSolutionFormla,
# How to compute
FourierSeriesOfLineIllustration,
GeneralizeToComplexFunctions,
ClarifyInputAndOutput,
GraphForFlattenedPi,
PiFourierSeries,
RealValuedFunctionFourierSeries,
YouSaidThisWasEasier,
AskAboutComplexNotVector,
SimpleComplexExponentExample,
LooseWithLanguage,
DemonstrateAddingArrows,
TRangingFrom0To1,
LabelRotatingVectors,
IntegralTrick,
SwapIntegralAndSum,
FootnoteOnSwappingIntegralAndSum,
FormulaOutOfContext,
ShowRangeOfCnFormulas,
DescribeSVG,
# TODO
IncreaseOrderOfApproximation,
ShowStepFunctionIn2dView,
StepFunctionIntegral,
GeneralChallenge,
# Oldies
# FourierSeriesIllustraiton,
# FourierNameIntro,
# CircleAnimationOfF,
]

View File

@@ -1,5 +0,0 @@
from active_projects.diffyq.part5.staging import *
OUTPUT_DIRECTORY = "diffyq/part5"
SCENES_IN_ORDER = [
]

View File

@@ -1,23 +0,0 @@
from active_projects.diffyq.part4.long_fourier_scenes import *
OUTPUT_DIRECTORY = "diffyq/part4"
SCENES_IN_ORDER = [
ZoomedInFourierSeriesExample,
FourierSeriesExampleWithRectForZoom,
ZoomedInFourierSeriesExample100x,
FourierOfFourier100xZoom,
FourierOfFourierZoomedIn,
FourierOfFourier,
SigmaZoomedInFourierSeriesExample,
SigmaFourierSeriesExampleWithRectForZoom,
NailAndGearZoomedInFourierSeriesExample,
NailAndGearFourierSeriesExampleWithRectForZoom,
TrebleClefZoomedInFourierSeriesExample,
TrebleClefFourierSeriesExampleWithRectForZoom,
FourierOfSeattle,
FourierOfSeattleZoomedIn,
FourierOfBritain,
FourierOfBritainZoomedIn,
FourierOfHilbert,
FourierOfHilbertZoomedIn,
]

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,515 +0,0 @@
from manimlib.imports import *
from active_projects.diffyq.part1.shared_constructs import *
class SomeOfYouWatching(TeacherStudentsScene):
CONFIG = {
"camera_config": {
"background_color": DARKER_GREY,
}
}
def construct(self):
screen = self.screen
screen.scale(1.25, about_edge=UL)
screen.set_fill(BLACK, 1)
self.add(screen)
self.teacher.change("raise_right_hand")
for student in self.students:
student.change("pondering", screen)
self.student_says(
"Well...yeah",
target_mode="tease"
)
self.wait(3)
class FormulasAreLies(PiCreatureScene):
def construct(self):
you = self.pi_creature
t2c = {
"{L}": BLUE,
"{g}": YELLOW,
"\\theta_0": WHITE,
"\\sqrt{\\,": WHITE,
}
kwargs = {"tex_to_color_map": t2c}
period_eq = TexMobject(
"\\text{Period} = 2\\pi \\sqrt{\\,{L} / {g}}",
**kwargs
)
theta_eq = TexMobject(
"\\theta(t) = \\theta_0 \\cos\\left("
"\\sqrt{\\,{L} / {g}} \\cdot t"
"\\right)",
**kwargs
)
equations = VGroup(theta_eq, period_eq)
equations.arrange(DOWN, buff=LARGE_BUFF)
for eq in period_eq, theta_eq:
i = eq.index_of_part_by_tex("\\sqrt")
eq.sqrt_part = eq[i:i + 4]
theta0 = theta_eq.get_part_by_tex("\\theta_0")
theta0_words = TextMobject("Starting angle")
theta0_words.next_to(theta0, UL)
theta0_words.shift(UP + 0.5 * RIGHT)
arrow = Arrow(
theta0_words.get_bottom(),
theta0,
color=WHITE,
tip_length=0.25,
)
bubble = SpeechBubble()
bubble.pin_to(you)
bubble.write("Lies!")
bubble.content.scale(2)
bubble.resize_to_content()
self.add(period_eq)
you.change("pondering", period_eq)
self.wait()
theta_eq.remove(*theta_eq.sqrt_part)
self.play(
TransformFromCopy(
period_eq.sqrt_part,
theta_eq.sqrt_part,
),
FadeIn(theta_eq)
)
theta_eq.add(*theta_eq.sqrt_part)
self.play(
FadeInFrom(theta0_words, LEFT),
GrowArrow(arrow),
)
self.wait()
self.play(you.change, "confused")
self.wait()
self.play(
you.change, "angry",
ShowCreation(bubble),
FadeInFromPoint(bubble.content, you.mouth),
equations.to_edge, LEFT,
FadeOut(arrow),
FadeOut(theta0_words),
)
self.wait()
def create_pi_creature(self):
return You().flip().to_corner(DR)
# class TourOfDifferentialEquations(Scene):
# def construct(self):
# pass
class SoWhatIsThetaThen(TeacherStudentsScene):
def construct(self):
ode = get_ode()
ode.to_corner(UL)
self.add(ode)
self.student_says(
"Okay, but then\\\\"
"what \\emph{is} $\\theta(t)$?"
)
self.wait()
self.play(self.teacher.change, "happy")
self.wait(2)
self.teacher_says(
"First, you must appreciate\\\\"
"a deep truth...",
added_anims=[self.get_student_changes(
*3 * ["confused"]
)]
)
self.wait(4)
class ProveTeacherWrong(TeacherStudentsScene):
def construct(self):
tex_config = {
"tex_to_color_map": {
"{\\theta}": BLUE,
"{\\dot\\theta}": YELLOW,
"{\\ddot\\theta}": RED,
}
}
func = TexMobject(
"{\\theta}(t)", "=",
"\\theta_0", "\\cos(\\sqrt{g / L} \\cdot t)",
**tex_config,
)
d_func = TexMobject(
"{\\dot\\theta}(t)", "=",
"-\\left(\\sqrt{g / L}\\right)",
"\\theta_0", "\\sin(\\sqrt{g / L} \\cdot t)",
**tex_config,
)
dd_func = TexMobject(
"{\\ddot\\theta}(t)", "=",
"-\\left(g / L\\right)",
"\\theta_0", "\\cos(\\sqrt{g / L} \\cdot t)",
**tex_config,
)
# ode = TexMobject(
# "\\ddot {\\theta}({t})", "=",
# "-\\mu \\dot {\\theta}({t})",
# "-{g \\over L} \\sin\\big({\\theta}({t})\\big)",
# **tex_config,
# )
ode = get_ode()
arrows = [TexMobject("\\Downarrow") for x in range(2)]
VGroup(func, d_func, dd_func, ode, *arrows).scale(0.7)
teacher = self.teacher
you = self.students[2]
self.student_thinks(ode)
you.add_updater(lambda m: m.look_at(func))
self.teacher_holds_up(func)
self.wait()
group = VGroup(arrows[0], d_func, arrows[1], dd_func)
group.arrange(DOWN)
group.move_to(func, DOWN)
arrow = Arrow(
group.get_corner(UL),
ode.get_top(),
path_arc=PI / 2,
)
q_marks = VGroup(*[
TexMobject("?").scale(1.5).next_to(
arrow.point_from_proportion(a),
UP
)
for a in np.linspace(0.2, 0.8, 5)
])
cycle_animation(VFadeInThenOut(
q_marks,
lag_ratio=0.2,
run_time=4,
rate_func=squish_rate_func(smooth, 0, 0.5)
))
self.play(
func.next_to, group, UP,
LaggedStartMap(
FadeInFrom, group,
lambda m: (m, UP)
),
teacher.change, "guilty",
you.change, "sassy",
)
rect = SurroundingRectangle(
VGroup(group, func)
)
dashed_rect = DashedVMobject(rect, num_dashes=75)
animated_rect = AnimatedBoundary(dashed_rect, cycle_rate=1)
self.wait()
self.add(animated_rect, q_marks)
self.play(
ShowCreation(arrow),
# FadeInFromDown(q_mark),
self.get_student_changes("confused", "confused")
)
self.wait(4)
self.change_student_modes(
*3 * ["pondering"],
self.teacher.change, "maybe"
)
self.wait(8)
class PhysicistPhaseSpace(PiCreatureScene):
def construct(self):
physy = self.pi_creature
name = TextMobject("Physicist")
name.scale(1.5)
name.to_corner(DL, buff=MED_SMALL_BUFF)
physy.next_to(name, UP, SMALL_BUFF)
VGroup(name, physy).shift_onto_screen()
axes = Axes(
x_min=-1,
x_max=10,
y_min=-1,
y_max=7,
)
axes.set_height(6)
axes.next_to(physy, RIGHT)
axes.to_edge(UP)
axes.set_stroke(width=1)
x_label = TextMobject("Position")
x_label.next_to(axes.x_axis.get_right(), UP)
y_label = TextMobject("Momentum")
y_label.next_to(axes.y_axis.get_top(), RIGHT)
title = TextMobject("Phase space")
title.scale(1.5)
title.set_color(YELLOW)
title.move_to(axes)
self.add(name, physy)
self.play(
physy.change, "angry",
Write(axes),
FadeInFromDown(title)
)
self.wait(2)
self.play(
GrowFromPoint(x_label, physy.get_corner(UR)),
physy.change, "raise_right_hand",
axes.x_axis.get_right()
)
self.play(
GrowFromPoint(y_label, physy.get_corner(UR)),
physy.look_at, axes.y_axis.get_top(),
)
self.wait(3)
def create_pi_creature(self):
return PiCreature(color=GREY).to_corner(DL)
class AskAboutActuallySolving(TeacherStudentsScene):
def construct(self):
ode = get_ode()
ode.to_corner(UL)
self.add(ode)
morty = self.teacher
self.student_says(
"Yeah yeah, but how do\\\\"
"you actually \\emph{solve} it?",
student_index=1,
target_mode="sassy",
added_anims=[morty.change, "thinking"],
)
self.change_student_modes(
"confused", "sassy", "confused",
look_at_arg=ode,
)
self.wait()
self.teacher_says(
"What do you mean\\\\ by ``solve''?",
target_mode="speaking",
added_anims=[self.get_student_changes(
*3 * ["erm"]
)]
)
self.play(self.students[1].change, "angry")
self.wait(3)
class HungerForExactness(TeacherStudentsScene):
def construct(self):
students = self.students
you = students[2]
teacher = self.teacher
ode = get_ode()
ode.to_corner(UL)
left_part = ode[:5]
friction_part = ode[5:11]
self.add(ode)
proposed_solution = TexMobject(
"\\theta_0\\cos((\\sqrt{g/L})t)e^{-\\mu t}"
)
proposed_solution.next_to(
you.get_corner(UL), UP, buff=0.7
)
proposed_solution_rect = SurroundingRectangle(
proposed_solution, buff=MED_SMALL_BUFF,
)
proposed_solution_rect.set_color(BLUE)
proposed_solution_rect.round_corners()
solution_p1 = TexMobject(
"""
\\theta(t) = 2\\text{am}\\left(
\\frac{\\sqrt{2g + Lc_1} (t + c_2)}{2\\sqrt{L}},
\\frac{4g}{2g + Lc_1}
\\right)
""",
)
solution_p1.to_corner(UL)
solution_p2 = TexMobject(
"c_1, c_2 = \\text{Constants depending on initial conditions}"
)
solution_p2.set_color(LIGHT_GREY)
solution_p2.scale(0.75)
solution_p3 = TexMobject(
"""
\\text{am}(u, k) =
\\int_0^u \\text{dn}(v, k)\\,dv
"""
)
solution_p3.name = TextMobject(
"(Jacobi amplitude function)"
)
solution_p4 = TexMobject(
"""
\\text{dn}(u, k) =
\\sqrt{1 - k^2 \\sin^2(\\phi)}
"""
)
solution_p4.name = TextMobject(
"(Jacobi elliptic function)"
)
solution_p5 = TextMobject("Where $\\phi$ satisfies")
solution_p6 = TexMobject(
"""
u = \\int_0^\\phi \\frac{dt}{\\sqrt{1 - k^2 \\sin^2(t)}}
"""
)
solution = VGroup(
solution_p1,
solution_p2,
solution_p3,
solution_p4,
solution_p5,
solution_p6,
)
solution.arrange(DOWN)
solution.scale(0.7)
solution.to_corner(UL, buff=MED_SMALL_BUFF)
solution.set_stroke(width=0, background=True)
solution.remove(solution_p2)
solution_p1.add(solution_p2)
solution.remove(solution_p5)
solution_p6.add(solution_p5)
for part in [solution_p3, solution_p4]:
part.name.scale(0.7 * 0.7)
part.name.set_color(LIGHT_GREY)
part.name.next_to(part, RIGHT)
part.add(part.name)
self.student_says(
"Right, but like,\\\\"
"what \\emph{is} $\\theta(t)$?",
target_mode="sassy",
added_anims=[teacher.change, "guilty"],
)
self.wait()
self.play(
FadeInFromDown(proposed_solution),
RemovePiCreatureBubble(
you,
target_mode="raise_left_hand",
look_at_arg=proposed_solution,
),
teacher.change, "pondering",
students[0].change, "pondering",
students[1].change, "hesitant",
)
self.play(ShowCreation(proposed_solution_rect))
self.play(
proposed_solution.shift, 3 * RIGHT,
proposed_solution_rect.shift, 3 * RIGHT,
you.change, "raise_right_hand", teacher.eyes,
)
self.wait(3)
self.play(
FadeOut(proposed_solution),
FadeOut(proposed_solution_rect),
ode.move_to, self.hold_up_spot, DOWN,
ode.shift, LEFT,
teacher.change, "raise_right_hand",
self.get_student_changes(*3 * ["pondering"])
)
self.wait()
ode.save_state()
self.play(
left_part.move_to, friction_part, RIGHT,
left_part.match_y, left_part,
friction_part.to_corner, DR,
friction_part.fade, 0.5,
)
self.wait()
modes = ["erm", "sad", "sad", "horrified"]
for part, mode in zip(solution, modes):
self.play(
FadeInFrom(part, UP),
self.get_student_changes(
*3 * [mode],
look_at_arg=part,
)
)
self.wait()
self.wait(3)
self.change_student_modes("tired", "sad", "concerned_musician")
self.wait(4)
self.look_at(solution)
self.wait(5)
self.play(
FadeOutAndShift(solution, 2 * LEFT),
Restore(ode),
self.get_student_changes(
"sick", "angry", "tired",
)
)
self.wait(3)
mystery = TexMobject(
"\\theta(t) = ???",
tex_to_color_map={"\\theta": BLUE},
)
mystery.scale(2)
mystery.to_edge(UP)
mystery.set_stroke(width=0, background=True)
mystery_boundary = AnimatedBoundary(
mystery, stroke_width=1
)
self.play(
FadeInFromDown(mystery),
self.teacher.change, "pondering"
)
self.add(mystery_boundary, mystery)
self.change_all_student_modes("sad")
self.look_at(mystery)
self.wait(5)
# Define
self.student_says(
"Let $\\text{P}(\\mu, g, L; t)$ be a\\\\"
"function satisfying this ODE.",
student_index=0,
target_mode="speaking",
added_anims=[
FadeOut(mystery),
FadeOut(mystery_boundary),
ode.to_corner, UR
]
)
self.change_student_modes(
"hooray", "sassy", "sassy",
look_at_arg=students[0].eyes.get_corner(UR),
)
self.wait(2)
class ItGetsWorse(TeacherStudentsScene):
def construct(self):
self.teacher_says("It gets\\\\worse")
self.change_student_modes(
"hesitant", "pleading", "erm"
)
self.wait(5)

View File

@@ -1,118 +0,0 @@
from manimlib.imports import *
Lg_formula_config = {
"tex_to_color_map": {
"\\theta_0": WHITE,
"{L}": BLUE,
"{g}": YELLOW,
},
}
class You(PiCreature):
CONFIG = {
"color": BLUE_C,
}
def get_ode():
tex_config = {
"tex_to_color_map": {
"{\\theta}": BLUE,
"{\\dot\\theta}": RED,
"{\\ddot\\theta}": YELLOW,
"{t}": WHITE,
"{\\mu}": WHITE,
}
}
ode = TexMobject(
"{\\ddot\\theta}({t})", "=",
"-{\\mu} {\\dot\\theta}({t})",
"-{g \\over L} \\sin\\big({\\theta}({t})\\big)",
**tex_config,
)
return ode
def get_period_formula():
return TexMobject(
"2\\pi", "\\sqrt{\\,", "L", "/", "g", "}",
tex_to_color_map={
"L": BLUE,
"g": YELLOW,
}
)
def pendulum_vector_field_func(point, mu=0.1, g=9.8, L=3):
theta, omega = point[:2]
return np.array([
omega,
-np.sqrt(g / L) * np.sin(theta) - mu * omega,
0,
])
def get_vector_symbol(*texs, **kwargs):
config = {
"include_background_rectangle": True,
"bracket_h_buff": SMALL_BUFF,
"bracket_v_buff": SMALL_BUFF,
"element_alignment_corner": ORIGIN,
}
config.update(kwargs)
array = [[tex] for tex in texs]
return Matrix(array, **config)
def get_heart_var(index):
heart = SuitSymbol("hearts")
if index == 1:
heart.set_color(BLUE_C)
elif index == 2:
heart.set_color(GREEN)
heart.set_height(0.7)
index = Integer(index)
index.move_to(heart.get_corner(DR))
heart.add(index)
return heart
def get_heart_var_deriv(index):
heart = get_heart_var(index)
filler_tex = "T"
deriv = TexMobject("{d", filler_tex, "\\over", "dt}")
deriv.scale(2)
filler = deriv.get_part_by_tex(filler_tex)
heart.match_height(filler)
heart.move_to(filler)
heart.scale(1.5, about_edge=UL)
deriv.remove(filler)
deriv.add(heart)
deriv.heart = heart
return deriv
def get_love_equation1():
equation = VGroup(
get_heart_var_deriv(1),
TexMobject("=").scale(2),
TexMobject("a").scale(2),
get_heart_var(2)
)
equation.arrange(RIGHT)
equation[-1].shift(SMALL_BUFF * DL)
return equation
def get_love_equation2():
equation = VGroup(
get_heart_var_deriv(2),
TexMobject("=").scale(2),
TexMobject("-b").scale(2),
get_heart_var(1),
)
equation.arrange(RIGHT)
equation[-1].shift(SMALL_BUFF * DL)
return equation

File diff suppressed because it is too large Load Diff

View File

@@ -1,855 +0,0 @@
from manimlib.imports import *
from active_projects.diffyq.part1.shared_constructs import *
class SmallAngleApproximationTex(Scene):
def construct(self):
approx = TexMobject(
"\\sin", "(", "\\theta", ") \\approx \\theta",
tex_to_color_map={"\\theta": RED},
arg_separator="",
)
implies = TexMobject("\\Downarrow")
period = TexMobject(
"\\text{Period}", "\\approx",
"2\\pi \\sqrt{\\,{L} / {g}}",
**Lg_formula_config,
)
group = VGroup(approx, implies, period)
group.arrange(DOWN)
approx_brace = Brace(approx, UP, buff=SMALL_BUFF)
approx_words = TextMobject(
"For small $\\theta$",
tex_to_color_map={"$\\theta$": RED},
)
approx_words.scale(0.75)
approx_words.next_to(approx_brace, UP, SMALL_BUFF)
self.add(approx, approx_brace, approx_words)
self.play(
Write(implies),
FadeInFrom(period, LEFT)
)
self.wait()
class StrogatzQuote(Scene):
def construct(self):
quote = self.get_quote()
movers = VGroup(*quote[:-1].family_members_with_points())
for mover in movers:
mover.save_state()
disc = Circle(radius=0.05)
disc.set_stroke(width=0)
disc.set_fill(BLACK, 0)
disc.move_to(mover)
mover.become(disc)
self.play(
FadeInFrom(quote.author_part, LEFT),
LaggedStartMap(
# FadeInFromLarge,
# quote[:-1].family_members_with_points(),
Restore, movers,
lag_ratio=0.005,
run_time=2,
)
# FadeInFromDown(quote[:-1]),
# lag_ratio=0.01,
)
self.wait()
self.play(
Write(quote.law_part.copy().set_color(YELLOW)),
run_time=1,
)
self.wait()
self.play(
Write(quote.language_part.copy().set_color(BLUE)),
run_time=1.5,
)
self.wait(2)
def get_quote(self):
law_words = "laws of physics"
language_words = "language of differential equations"
author = "-Steven Strogatz"
quote = TextMobject(
"""
\\Large
``Since Newton, mankind has come to realize
that the laws of physics are always expressed
in the language of differential equations.''\\\\
""" + author,
alignment="",
arg_separator=" ",
substrings_to_isolate=[law_words, language_words, author]
)
quote.law_part = quote.get_part_by_tex(law_words)
quote.language_part = quote.get_part_by_tex(language_words)
quote.author_part = quote.get_part_by_tex(author)
quote.set_width(12)
quote.to_edge(UP)
quote[-2].shift(SMALL_BUFF * LEFT)
quote.author_part.shift(RIGHT + 0.5 * DOWN)
quote.author_part.scale(1.2, about_edge=UL)
return quote
class WriteInRadians(Scene):
def construct(self):
words = TextMobject("In radians")
words.set_color(YELLOW)
square = SurroundingRectangle(TexMobject("\\theta"))
square.next_to(words, UP)
self.play(ShowCreation(square))
self.play(Write(words), FadeOut(square))
self.wait()
class XEqLThetaToCorner(Scene):
def construct(self):
equation = TexMobject(
"x = L\\theta",
tex_to_color_map={
"x": GREEN,
"\\theta": BLUE,
}
)
equation.move_to(DOWN + 3 * RIGHT)
self.add(equation)
self.play(equation.to_corner, DL, {"buff": LARGE_BUFF})
self.wait()
class ComingUp(Scene):
CONFIG = {
"camera_config": {"background_color": DARKER_GREY}
}
def construct(self):
frame = ScreenRectangle(
stroke_width=0,
fill_color=BLACK,
fill_opacity=1,
height=6
)
title = TextMobject("Coming up")
title.scale(1.5)
title.to_edge(UP)
frame.next_to(title, DOWN)
animated_frame = AnimatedBoundary(frame)
self.add(frame, title, animated_frame)
self.wait(10)
class InputLabel(Scene):
def construct(self):
label = TextMobject("Input")
label.scale(1.25)
arrow = Vector(UP)
arrow.next_to(label, UP)
self.play(
FadeInFrom(label, UP),
GrowArrow(arrow)
)
self.wait()
class ReallyHardToSolve(Scene):
def construct(self):
words = TextMobject(
"They're", "really\\\\",
"freaking", "hard\\\\",
"to", "solve\\\\",
)
words.set_height(6)
self.wait()
for word in words:
wait_time = 0.05 * len(word)
self.add(word)
self.wait(wait_time)
self.wait()
class ReasonForSolution(Scene):
def construct(self):
# Words
eq_word = TextMobject("Differential\\\\Equation")
s_word = TextMobject("Solution")
u_word = TextMobject("Understanding")
c_word = TextMobject("Computation")
cu_group = VGroup(u_word, c_word)
cu_group.arrange(DOWN, buff=2)
group = VGroup(eq_word, s_word, cu_group)
group.arrange(RIGHT, buff=2)
# words = VGroup(eq_word, s_word, u_word, c_word)
# Arrows
arrows = VGroup(
Arrow(eq_word.get_right(), s_word.get_left()),
Arrow(s_word.get_right(), u_word.get_left()),
Arrow(s_word.get_right(), c_word.get_left()),
)
arrows.set_color(LIGHT_GREY)
new_arrows = VGroup(
Arrow(
eq_word.get_corner(UR),
u_word.get_left(),
path_arc=-60 * DEGREES,
),
Arrow(
eq_word.get_corner(DR),
c_word.get_left(),
path_arc=60 * DEGREES,
),
)
new_arrows.set_color(BLUE)
# Define first examples
t2c = {
"{x}": BLUE,
"{\\dot x}": RED,
}
equation = TexMobject(
"{\\dot x}(t) = k {x}(t)",
tex_to_color_map=t2c,
)
equation.next_to(eq_word, DOWN)
solution = TexMobject(
"{x}(t) = x_0 e^{kt}",
tex_to_color_map=t2c,
)
solution.next_to(s_word, DOWN, MED_LARGE_BUFF)
equation.align_to(solution, DOWN)
axes = Axes(
x_min=-1,
x_max=5.5,
y_min=-1,
y_max=4.5,
y_axis_config={"unit_size": 0.5}
)
axes.set_stroke(width=2)
graph_line = axes.get_graph(
lambda x: np.exp(0.4 * x)
)
graph_line.set_stroke(width=2)
graph = VGroup(axes, graph_line)
graph.scale(0.5)
graph.next_to(u_word, UP)
computation = TexMobject(
# "\\displaystyle "
"e^x = \\sum_{n=0}^\\infty "
"\\frac{x^n}{n!}"
)
computation.next_to(c_word, DOWN)
first_examples = VGroup(
equation, solution, graph, computation
)
# Second example
ode = get_ode()
ode.scale(0.75)
second_examples = VGroup(
ode,
TexMobject("???").set_color(LIGHT_GREY),
ScreenRectangle(
height=2,
stroke_width=1,
),
)
for fe, se in zip(first_examples, second_examples):
se.move_to(fe, DOWN)
ode.shift(2 * SMALL_BUFF * DOWN)
ode.add_to_back(BackgroundRectangle(ode[-4:]))
self.add(eq_word)
self.add(equation)
self.play(
FadeInFrom(s_word, LEFT),
GrowArrow(arrows[0]),
TransformFromCopy(equation, solution)
)
self.wait()
self.play(
FadeInFrom(c_word, UL),
GrowArrow(arrows[2]),
FadeInFrom(computation, UP)
)
self.wait()
self.play(
FadeInFrom(u_word, DL),
GrowArrow(arrows[1]),
FadeInFromDown(graph)
)
self.wait(2)
self.play(
FadeOut(first_examples),
FadeIn(second_examples[:2])
)
self.wait()
self.play(
arrows.fade, 0.75,
s_word.fade, 0.75,
second_examples[1].fade, 0.75,
ShowCreation(new_arrows[0]),
FadeIn(second_examples[2])
)
self.play(
ShowCreation(new_arrows[1]),
Animation(second_examples),
)
self.wait()
class WritePhaseSpace(Scene):
def construct(self):
word = TextMobject("Phase space")
word.scale(2)
word.shift(FRAME_WIDTH * LEFT / 4)
word.to_edge(UP)
word.add_background_rectangle()
lines = VGroup(*[
Line(v, 1.3 * v)
for v in compass_directions(50)
])
lines.replace(word, stretch=True)
lines.scale(1.5)
lines.set_stroke(YELLOW)
lines.shuffle()
self.add(word)
self.play(
ShowPassingFlashWithThinningStrokeWidth(
lines,
lag_ratio=0.002,
run_time=1.5,
time_width=0.9,
n_segments=5,
)
)
self.wait()
class GleickQuote(Scene):
def construct(self):
quote = TextMobject(
"``[Phase space is] one of the most\\\\",
"powerful inventions", "of modern science.''\\\\",
)
quote.power_part = quote.get_part_by_tex("power")
book = ImageMobject("ChaosBookCover")
book.set_height(5)
book.next_to(ORIGIN, LEFT)
book.to_edge(DOWN)
gleick = ImageMobject("JamesGleick")
gleick.set_height(5)
gleick.next_to(ORIGIN, RIGHT)
gleick.to_edge(DOWN)
quote.to_edge(UP)
self.play(
FadeInFrom(book, RIGHT),
FadeInFrom(gleick, LEFT),
)
self.wait()
self.play(Write(quote))
self.play(Write(
quote.power_part.copy().set_color(BLUE),
run_time=1
))
self.wait()
class WritePhaseFlow(Scene):
def construct(self):
words = TextMobject("Phase flow")
words.scale(2)
words.shift(FRAME_WIDTH * LEFT / 4)
words.to_edge(UP)
words.add_background_rectangle()
self.play(Write(words))
self.wait()
class ShowSineValues(Scene):
def construct(self):
angle_tracker = ValueTracker(60 * DEGREES)
get_angle = angle_tracker.get_value
formula = always_redraw(
lambda: self.get_sine_formula(get_angle())
)
self.add(formula)
self.play(
angle_tracker.set_value, 0,
run_time=3,
)
self.wait()
self.play(
angle_tracker.set_value, 90 * DEGREES,
run_time=3,
)
self.wait()
def get_sine_formula(self, angle):
sin, lp, rp = TexMobject(
"\\sin", "(", ") = "
)
input_part = Integer(
angle / DEGREES,
unit="^\\circ",
)
input_part.set_color(YELLOW)
output_part = DecimalNumber(
np.sin(input_part.get_value() * DEGREES),
num_decimal_places=3,
)
result = VGroup(
sin, lp, input_part, rp, output_part
)
result.arrange(RIGHT, buff=SMALL_BUFF)
sin.scale(1.1, about_edge=DOWN)
lp.align_to(rp, UP)
return result
class SetAsideSeekingSolution(Scene):
def construct(self):
ode = get_ode()
ode.to_edge(UP)
q1 = TextMobject("Find an exact solution")
q1.set_color(YELLOW)
q2 = TexMobject(
"\\text{What is }", "\\theta", "(t)",
"\\text{'s personality?}",
tex_to_color_map={"\\theta": BLUE},
arg_separator="",
)
theta = q2.get_part_by_tex("\\theta")
for q in q1, q2:
q.scale(1.5)
q.next_to(ode, DOWN, MED_LARGE_BUFF)
eyes = Eyes(theta, height=0.1)
self.add(ode)
self.add(q1)
self.wait()
self.play(
q1.scale, 0.3,
q1.to_corner, UR, MED_SMALL_BUFF,
)
self.play(FadeInFrom(q2, DOWN))
self.play(
eyes.blink,
rate_func=lambda t: smooth(1 - t),
)
self.play(eyes.look_at, q2.get_left())
self.play(eyes.look_at, q2.get_right())
self.play(
eyes.blink,
rate_func=squish_rate_func(there_and_back)
)
self.wait()
self.play(
eyes.change_mode, "confused",
eyes.look_at, ode.get_left(),
)
self.play(
eyes.blink,
rate_func=squish_rate_func(there_and_back)
)
class ThreeBodyTitle(Scene):
def construct(self):
title = TextMobject("Three body problem")
title.scale(1.5)
title.to_edge(UP)
self.add(title)
class ThreeBodySymbols(Scene):
def construct(self):
self.init_coord_groups()
self.introduce_coord_groups()
self.count_coords()
def init_coord_groups(self):
kwargs = {
"bracket_v_buff": 2 * SMALL_BUFF
}
positions = VGroup(*[
get_vector_symbol(*[
"{}_{}".format(s, i)
for s in "xyz"
], **kwargs)
for i in range(1, 4)
])
velocities = VGroup(*[
get_vector_symbol(*[
"p^{}_{}".format(s, i)
for s in "xyz"
], **kwargs)
for i in range(1, 4)
])
groups = VGroup(positions, velocities)
colors = [GREEN, RED, BLUE]
for group in groups:
for matrix in group:
matrix.coords = matrix.get_entries()
for coord, color in zip(matrix.coords, colors):
coord.set_color(color)
group.arrange(RIGHT)
groups.arrange(DOWN, buff=LARGE_BUFF)
groups.to_edge(LEFT)
self.coord_groups = groups
def introduce_coord_groups(self):
groups = self.coord_groups
x_group, p_group = groups
x_word = TextMobject("Positions")
p_word = TextMobject("Momenta")
words = VGroup(x_word, p_word)
for word, group in zip(words, groups):
word.next_to(group, UP)
rect_groups = VGroup()
for group in groups:
rect_group = VGroup(*[
SurroundingRectangle(
VGroup(*[
tm.coords[i]
for tm in group
]),
color=WHITE,
stroke_width=2,
)
for i in range(3)
])
rect_groups.add(rect_group)
self.play(
*[
LaggedStartMap(
FadeInFrom, group,
lambda m: (m, UP),
run_time=1,
)
for group in groups
],
*map(FadeInFromDown, words),
)
for rect_group in rect_groups:
self.play(
ShowCreationThenFadeOut(
rect_group,
lag_ratio=0.5,
)
)
self.wait()
def count_coords(self):
coord_copies = VGroup()
for group in self.coord_groups:
for tex_mob in group:
for coord in tex_mob.coords:
coord_copy = coord.copy()
coord_copy.set_stroke(
WHITE, 2, background=True
)
coord_copies.add(coord_copy)
count = Integer()
count_word = TextMobject("18", "degrees \\\\ of freedom")[1]
count_group = VGroup(count, count_word)
count_group.arrange(
RIGHT,
aligned_edge=DOWN,
)
count_group.scale(1.5)
count_group.next_to(
self.coord_groups, RIGHT,
aligned_edge=DOWN,
)
count.add_updater(
lambda m: m.set_value(len(coord_copies))
)
count.add_updater(
lambda m: m.next_to(count_word[0][0], LEFT, aligned_edge=DOWN)
)
self.add(count_group)
self.play(
# ChangeDecimalToValue(count, len(coord_copies)),
ShowIncreasingSubsets(coord_copies),
run_time=1.5,
rate_func=linear,
)
self.play(FadeOut(coord_copies))
class ThreeBodyEquation(Scene):
def construct(self):
x1 = "\\vec{\\textbf{x}}_1"
x2 = "\\vec{\\textbf{x}}_2"
x3 = "\\vec{\\textbf{x}}_3"
kw = {
"tex_to_color_map": {
x1: RED,
x2: GREEN,
x3: BLUE,
}
}
equations = VGroup(*[
TexMobject(
"{d^2", t1, "\\over dt^2}", "=",
"G", "\\left("
"{" + m2, "(", t2, "-", t1, ")"
"\\over"
"||", t2, "-", t1, "||^3}",
"+",
"{" + m3, "(", t3, "-", t1, ")"
"\\over"
"||", t3, "-", t1, "||^3}",
"\\right)",
**kw
)
for t1, t2, t3, m1, m2, m3 in [
(x1, x2, x3, "m_1", "m_2", "m_3"),
(x2, x3, x1, "m_2", "m_3", "m_1"),
(x3, x1, x2, "m_3", "m_1", "m_2"),
]
])
equations.arrange(DOWN, buff=LARGE_BUFF)
self.play(LaggedStartMap(
FadeInFrom, equations,
lambda m: (m, UP),
lag_ratio=0.2,
))
self.wait()
class JumpToThisPoint(Scene):
def construct(self):
dot = Dot(color=YELLOW)
dot.scale(0.5)
arrow = Vector(DR, color=WHITE)
arrow.next_to(dot, UL, SMALL_BUFF)
words = TextMobject(
"Jump directly to\\\\",
"this point?",
)
words.add_background_rectangle_to_submobjects()
words.next_to(arrow.get_start(), UP, SMALL_BUFF)
self.play(
FadeInFromLarge(dot, 20),
rate_func=rush_into,
)
self.play(
GrowArrow(arrow),
FadeInFromDown(words),
)
class ChaosTitle(Scene):
def construct(self):
title = TextMobject("Chaos theory")
title.scale(1.5)
title.to_edge(UP)
line = Line(LEFT, RIGHT)
line.set_width(FRAME_WIDTH - 1)
line.next_to(title, DOWN)
self.play(
Write(title),
ShowCreation(line),
)
self.wait()
class RevisitQuote(StrogatzQuote, PiCreatureScene):
def construct(self):
quote = self.get_quote()
quote.law_part.set_color(YELLOW)
quote.language_part.set_color(BLUE)
quote.set_stroke(BLACK, 6, background=True)
quote.scale(0.8, about_edge=UL)
new_langauge_part = TextMobject(
"\\Large Language of differential equations"
)
new_langauge_part.to_edge(UP)
new_langauge_part.match_style(quote.language_part)
randy = self.pi_creature
self.play(
FadeInFrom(quote[:-1], DOWN),
FadeInFrom(quote[-1:], LEFT),
randy.change, "raise_right_hand",
)
self.play(Blink(randy))
self.play(randy.change, "angry")
self.play(
Blink(randy),
VFadeOut(randy, run_time=3)
)
mover = VGroup(quote.language_part)
self.add(quote, mover)
self.play(
ReplacementTransform(
mover, new_langauge_part,
),
*[
FadeOut(part)
for part in quote
if part is not quote.language_part
],
run_time=2,
)
self.wait()
class EndScreen(PatreonEndScreen):
CONFIG = {
"specific_patrons": [
"Juan Benet",
"Vassili Philippov",
"Burt Humburg",
"Carlos Vergara Del Rio",
"Matt Russell",
"Scott Gray",
"soekul",
"Tihan Seale",
"Ali Yahya",
"dave nicponski",
"Evan Phillips",
"Graham",
"Joseph Kelly",
"Kaustuv DeBiswas",
"LambdaLabs",
"Lukas Biewald",
"Mike Coleman",
"Peter Mcinerney",
"Quantopian",
"Roy Larson",
"Scott Walter, Ph.D.",
"Yana Chernobilsky",
"Yu Jun",
"Jordan Scales",
"Lukas -krtek.net- Novy",
"John Shaughnessy",
"Britt Selvitelle",
"David Gow",
"J",
"Jonathan Wilson",
"Joseph John Cox",
"Magnus Dahlström",
"Randy C. Will",
"Ryan Atallah",
"Luc Ritchie",
"1stViewMaths",
"Adrian Robinson",
"Alexis Olson",
"Andreas Benjamin Brössel",
"Andrew Busey",
"Ankalagon",
"Antonio Juarez",
"Arjun Chakroborty",
"Art Ianuzzi",
"Awoo",
"Bernd Sing",
"Boris Veselinovich",
"Brian Staroselsky",
"Chad Hurst",
"Charles Southerland",
"Chris Connett",
"Christian Kaiser",
"Clark Gaebel",
"Cooper Jones",
"Danger Dai",
"Dave B",
"Dave Kester",
"David Clark",
"DeathByShrimp",
"Delton Ding",
"eaglle",
"emptymachine",
"Eric Younge",
"Eryq Ouithaqueue",
"Federico Lebron",
"Giovanni Filippi",
"Hal Hildebrand",
"Herman Dieset",
"Hitoshi Yamauchi",
"Isaac Jeffrey Lee",
"j eduardo perez",
"Jacob Magnuson",
"Jameel Syed",
"Jason Hise",
"Jeff Linse",
"Jeff Straathof",
"John Griffith",
"John Haley",
"John V Wertheim",
"Jonathan Eppele",
"Kai-Siang Ang",
"Kanan Gill",
"L0j1k",
"Lee Redden",
"Linh Tran",
"Ludwig Schubert",
"Magister Mugit",
"Mark B Bahu",
"Mark Heising",
"Martin Price",
"Mathias Jansson",
"Matt Langford",
"Matt Roveto",
"Matthew Cocke",
"Michael Faust",
"Michael Hardel",
"Mirik Gogri",
"Mustafa Mahdi",
"Márton Vaitkus",
"Nero Li",
"Nikita Lesnikov",
"Omar Zrien",
"Owen Campbell-Moore",
"Peter Ehrnstrom",
"RedAgent14",
"rehmi post",
"Richard Burgmann",
"Richard Comish",
"Ripta Pasay",
"Rish Kundalia",
"Robert Teed",
"Roobie",
"Ryan Williams",
"Samuel D. Judge",
"Solara570",
"Stevie Metke",
"Tal Einav",
"Ted Suzman",
"Valeriy Skobelev",
"Xavier Bernard",
"Yavor Ivanov",
"Yaw Etse",
"YinYangBalance.Asia",
"Zach Cardwell",
]
}

View File

@@ -1,931 +0,0 @@
from manimlib.imports import *
# import scipy
class FourierCirclesScene(Scene):
CONFIG = {
"n_vectors": 10,
"big_radius": 2,
"colors": [
BLUE_D,
BLUE_C,
BLUE_E,
GREY_BROWN,
],
"circle_style": {
"stroke_width": 2,
},
"vector_config": {
"buff": 0,
"max_tip_length_to_length_ratio": 0.35,
"tip_length": 0.15,
"max_stroke_width_to_length_ratio": 10,
"stroke_width": 2,
},
"circle_config": {
"stroke_width": 1,
},
"base_frequency": 1,
"slow_factor": 0.25,
"center_point": ORIGIN,
"parametric_function_step_size": 0.001,
"drawn_path_color": YELLOW,
"drawn_path_stroke_width": 2,
}
def setup(self):
self.slow_factor_tracker = ValueTracker(
self.slow_factor
)
self.vector_clock = ValueTracker(0)
self.vector_clock.add_updater(
lambda m, dt: m.increment_value(
self.get_slow_factor() * dt
)
)
self.add(self.vector_clock)
def get_slow_factor(self):
return self.slow_factor_tracker.get_value()
def get_vector_time(self):
return self.vector_clock.get_value()
#
def get_freqs(self):
n = self.n_vectors
all_freqs = list(range(n // 2, -n // 2, -1))
all_freqs.sort(key=abs)
return all_freqs
def get_coefficients(self):
return [complex(0) for x in range(self.n_vectors)]
def get_color_iterator(self):
return it.cycle(self.colors)
def get_rotating_vectors(self, freqs=None, coefficients=None):
vectors = VGroup()
self.center_tracker = VectorizedPoint(self.center_point)
if freqs is None:
freqs = self.get_freqs()
if coefficients is None:
coefficients = self.get_coefficients()
last_vector = None
for freq, coefficient in zip(freqs, coefficients):
if last_vector:
center_func = last_vector.get_end
else:
center_func = self.center_tracker.get_location
vector = self.get_rotating_vector(
coefficient=coefficient,
freq=freq,
center_func=center_func,
)
vectors.add(vector)
last_vector = vector
return vectors
def get_rotating_vector(self, coefficient, freq, center_func):
vector = Vector(RIGHT, **self.vector_config)
vector.scale(abs(coefficient))
if abs(coefficient) == 0:
phase = 0
else:
phase = np.log(coefficient).imag
vector.rotate(phase, about_point=ORIGIN)
vector.freq = freq
vector.coefficient = coefficient
vector.center_func = center_func
vector.add_updater(self.update_vector)
return vector
def update_vector(self, vector, dt):
time = self.get_vector_time()
coef = vector.coefficient
freq = vector.freq
phase = np.log(coef).imag
vector.set_length(abs(coef))
vector.set_angle(phase + time * freq * TAU)
vector.shift(vector.center_func() - vector.get_start())
return vector
def get_circles(self, vectors):
return VGroup(*[
self.get_circle(
vector,
color=color
)
for vector, color in zip(
vectors,
self.get_color_iterator()
)
])
def get_circle(self, vector, color=BLUE):
circle = Circle(color=color, **self.circle_config)
circle.center_func = vector.get_start
circle.radius_func = vector.get_length
circle.add_updater(self.update_circle)
return circle
def update_circle(self, circle):
circle.set_width(2 * circle.radius_func())
circle.move_to(circle.center_func())
return circle
def get_vector_sum_path(self, vectors, color=YELLOW):
coefs = [v.coefficient for v in vectors]
freqs = [v.freq for v in vectors]
center = vectors[0].get_start()
path = ParametricFunction(
lambda t: center + reduce(op.add, [
complex_to_R3(
coef * np.exp(TAU * 1j * freq * t)
)
for coef, freq in zip(coefs, freqs)
]),
t_min=0,
t_max=1,
color=color,
step_size=self.parametric_function_step_size,
)
return path
# TODO, this should be a general animated mobect
def get_drawn_path_alpha(self):
return self.get_vector_time()
def get_drawn_path(self, vectors, stroke_width=None, **kwargs):
if stroke_width is None:
stroke_width = self.drawn_path_stroke_width
path = self.get_vector_sum_path(vectors, **kwargs)
broken_path = CurvesAsSubmobjects(path)
broken_path.curr_time = 0
def update_path(path, dt):
# alpha = path.curr_time * self.get_slow_factor()
alpha = self.get_drawn_path_alpha()
n_curves = len(path)
for a, sp in zip(np.linspace(0, 1, n_curves), path):
b = alpha - a
if b < 0:
width = 0
else:
width = stroke_width * (1 - (b % 1))
sp.set_stroke(width=width)
path.curr_time += dt
return path
broken_path.set_color(self.drawn_path_color)
broken_path.add_updater(update_path)
return broken_path
def get_y_component_wave(self,
vectors,
left_x=1,
color=PINK,
n_copies=2,
right_shift_rate=5):
path = self.get_vector_sum_path(vectors)
wave = ParametricFunction(
lambda t: op.add(
right_shift_rate * t * LEFT,
path.function(t)[1] * UP
),
t_min=path.t_min,
t_max=path.t_max,
color=color,
)
wave_copies = VGroup(*[
wave.copy()
for x in range(n_copies)
])
wave_copies.arrange(RIGHT, buff=0)
top_point = wave_copies.get_top()
wave.creation = ShowCreation(
wave,
run_time=(1 / self.get_slow_factor()),
rate_func=linear,
)
cycle_animation(wave.creation)
wave.add_updater(lambda m: m.shift(
(m.get_left()[0] - left_x) * LEFT
))
def update_wave_copies(wcs):
index = int(
wave.creation.total_time * self.get_slow_factor()
)
wcs[:index].match_style(wave)
wcs[index:].set_stroke(width=0)
wcs.next_to(wave, RIGHT, buff=0)
wcs.align_to(top_point, UP)
wave_copies.add_updater(update_wave_copies)
return VGroup(wave, wave_copies)
def get_wave_y_line(self, vectors, wave):
return DashedLine(
vectors[-1].get_end(),
wave[0].get_end(),
stroke_width=1,
dash_length=DEFAULT_DASH_LENGTH * 0.5,
)
# Computing Fourier series
# i.e. where all the math happens
def get_coefficients_of_path(self, path, n_samples=10000, freqs=None):
if freqs is None:
freqs = self.get_freqs()
dt = 1 / n_samples
ts = np.arange(0, 1, dt)
samples = np.array([
path.point_from_proportion(t)
for t in ts
])
samples -= self.center_point
complex_samples = samples[:, 0] + 1j * samples[:, 1]
result = []
for freq in freqs:
riemann_sum = np.array([
np.exp(-TAU * 1j * freq * t) * cs
for t, cs in zip(ts, complex_samples)
]).sum() * dt
result.append(riemann_sum)
return result
class FourierSeriesIntroBackground4(FourierCirclesScene):
CONFIG = {
"n_vectors": 4,
"center_point": 4 * LEFT,
"run_time": 30,
"big_radius": 1.5,
}
def construct(self):
circles = self.get_circles()
path = self.get_drawn_path(circles)
wave = self.get_y_component_wave(circles)
h_line = always_redraw(
lambda: self.get_wave_y_line(circles, wave)
)
# Why?
circles.update(-1 / self.camera.frame_rate)
#
self.add(circles, path, wave, h_line)
self.wait(self.run_time)
def get_ks(self):
return np.arange(1, 2 * self.n_vectors + 1, 2)
def get_freqs(self):
return self.base_frequency * self.get_ks()
def get_coefficients(self):
return self.big_radius / self.get_ks()
class FourierSeriesIntroBackground8(FourierSeriesIntroBackground4):
CONFIG = {
"n_vectors": 8,
}
class FourierSeriesIntroBackground12(FourierSeriesIntroBackground4):
CONFIG = {
"n_vectors": 12,
}
class FourierSeriesIntroBackground20(FourierSeriesIntroBackground4):
CONFIG = {
"n_vectors": 20,
}
class FourierOfPiSymbol(FourierCirclesScene):
CONFIG = {
"n_vectors": 51,
"center_point": ORIGIN,
"slow_factor": 0.1,
"n_cycles": 1,
"tex": "\\pi",
"start_drawn": False,
"max_circle_stroke_width": 1,
}
def construct(self):
self.add_vectors_circles_path()
for n in range(self.n_cycles):
self.run_one_cycle()
def add_vectors_circles_path(self):
path = self.get_path()
coefs = self.get_coefficients_of_path(path)
vectors = self.get_rotating_vectors(coefficients=coefs)
circles = self.get_circles(vectors)
self.set_decreasing_stroke_widths(circles)
# approx_path = self.get_vector_sum_path(circles)
drawn_path = self.get_drawn_path(vectors)
if self.start_drawn:
self.vector_clock.increment_value(1)
self.add(path)
self.add(vectors)
self.add(circles)
self.add(drawn_path)
self.vectors = vectors
self.circles = circles
self.path = path
self.drawn_path = drawn_path
def run_one_cycle(self):
time = 1 / self.slow_factor
self.wait(time)
def set_decreasing_stroke_widths(self, circles):
mcsw = self.max_circle_stroke_width
for k, circle in zip(it.count(1), circles):
circle.set_stroke(width=max(
# mcsw / np.sqrt(k),
mcsw / k,
mcsw,
))
return circles
def get_path(self):
tex_mob = TexMobject(self.tex)
tex_mob.set_height(6)
path = tex_mob.family_members_with_points()[0]
path.set_fill(opacity=0)
path.set_stroke(WHITE, 1)
return path
class FourierOfTexPaths(FourierOfPiSymbol, MovingCameraScene):
CONFIG = {
"n_vectors": 100,
"name_color": WHITE,
"animated_name": "Abc",
"time_per_symbol": 5,
"slow_factor": 1 / 5,
"parametric_function_step_size": 0.01,
}
def construct(self):
name = TextMobject(self.animated_name)
max_width = FRAME_WIDTH - 2
max_height = FRAME_HEIGHT - 2
name.set_width(max_width)
if name.get_height() > max_height:
name.set_height(max_height)
frame = self.camera.frame
frame.save_state()
vectors = VGroup(VectorizedPoint())
circles = VGroup(VectorizedPoint())
for path in name.family_members_with_points():
for subpath in path.get_subpaths():
sp_mob = VMobject()
sp_mob.set_points(subpath)
coefs = self.get_coefficients_of_path(sp_mob)
new_vectors = self.get_rotating_vectors(
coefficients=coefs
)
new_circles = self.get_circles(new_vectors)
self.set_decreasing_stroke_widths(new_circles)
drawn_path = self.get_drawn_path(new_vectors)
drawn_path.clear_updaters()
drawn_path.set_stroke(self.name_color, 3)
static_vectors = VMobject().become(new_vectors)
static_circles = VMobject().become(new_circles)
# static_circles = new_circles.deepcopy()
# static_vectors.clear_updaters()
# static_circles.clear_updaters()
self.play(
Transform(vectors, static_vectors, remover=True),
Transform(circles, static_circles, remover=True),
frame.set_height, 1.5 * name.get_height(),
frame.move_to, path,
)
self.add(new_vectors, new_circles)
self.vector_clock.set_value(0)
self.play(
ShowCreation(drawn_path),
rate_func=linear,
run_time=self.time_per_symbol
)
self.remove(new_vectors, new_circles)
self.add(static_vectors, static_circles)
vectors = static_vectors
circles = static_circles
self.play(
FadeOut(vectors),
Restore(frame),
run_time=2
)
self.wait(3)
class FourierOfPiSymbol5(FourierOfPiSymbol):
CONFIG = {
"n_vectors": 5,
"run_time": 10,
}
class FourierOfTrebleClef(FourierOfPiSymbol):
CONFIG = {
"n_vectors": 101,
"run_time": 10,
"start_drawn": True,
"file_name": "TrebleClef",
"height": 7.5,
}
def get_shape(self):
shape = SVGMobject(self.file_name)
return shape
def get_path(self):
shape = self.get_shape()
path = shape.family_members_with_points()[0]
path.set_height(self.height)
path.set_fill(opacity=0)
path.set_stroke(WHITE, 0)
return path
class FourierOfIP(FourierOfTrebleClef):
CONFIG = {
"file_name": "IP_logo2",
"height": 6,
"n_vectors": 100,
}
# def construct(self):
# path = self.get_path()
# self.add(path)
def get_shape(self):
shape = SVGMobject(self.file_name)
return shape
def get_path(self):
shape = self.get_shape()
path = shape.family_members_with_points()[0]
path.add_line_to(path.get_start())
# path.make_smooth()
path.set_height(self.height)
path.set_fill(opacity=0)
path.set_stroke(WHITE, 0)
return path
class FourierOfEighthNote(FourierOfTrebleClef):
CONFIG = {
"file_name": "EighthNote"
}
class FourierOfN(FourierOfTrebleClef):
CONFIG = {
"height": 6,
"n_vectors": 1000,
}
def get_shape(self):
return TexMobject("N")
class FourierNailAndGear(FourierOfTrebleClef):
CONFIG = {
"height": 6,
"n_vectors": 200,
"run_time": 100,
"slow_factor": 0.01,
"parametric_function_step_size": 0.0001,
"arrow_config": {
"tip_length": 0.1,
"stroke_width": 2,
}
}
def get_shape(self):
shape = SVGMobject("Nail_And_Gear")[1]
return shape
class FourierBatman(FourierOfTrebleClef):
CONFIG = {
"height": 4,
"n_vectors": 100,
"run_time": 10,
"arrow_config": {
"tip_length": 0.1,
"stroke_width": 2,
}
}
def get_shape(self):
shape = SVGMobject("BatmanLogo")[1]
return shape
class FourierHeart(FourierOfTrebleClef):
CONFIG = {
"height": 4,
"n_vectors": 100,
"run_time": 10,
"arrow_config": {
"tip_length": 0.1,
"stroke_width": 2,
}
}
def get_shape(self):
shape = SuitSymbol("hearts")
return shape
def get_drawn_path(self, *args, **kwargs):
kwargs["stroke_width"] = 5
path = super().get_drawn_path(*args, **kwargs)
path.set_color(PINK)
return path
class FourierNDQ(FourierOfTrebleClef):
CONFIG = {
"height": 4,
"n_vectors": 1000,
"run_time": 10,
"arrow_config": {
"tip_length": 0.1,
"stroke_width": 2,
}
}
def get_shape(self):
path = VMobject()
shape = TexMobject("NDQ")
for sp in shape.family_members_with_points():
path.append_points(sp.points)
return path
class FourierGoogleG(FourierOfTrebleClef):
CONFIG = {
"n_vectors": 10,
"height": 5,
"g_colors": [
"#4285F4",
"#DB4437",
"#F4B400",
"#0F9D58",
]
}
def get_shape(self):
g = SVGMobject("google_logo")[5]
g.center()
self.add(g)
return g
def get_drawn_path(self, *args, **kwargs):
kwargs["stroke_width"] = 7
path = super().get_drawn_path(*args, **kwargs)
blue, red, yellow, green = self.g_colors
path[:250].set_color(blue)
path[250:333].set_color(green)
path[333:370].set_color(yellow)
path[370:755].set_color(red)
path[755:780].set_color(yellow)
path[780:860].set_color(green)
path[860:].set_color(blue)
return path
class ExplainCircleAnimations(FourierCirclesScene):
CONFIG = {
"n_vectors": 100,
"center_point": 2 * DOWN,
"n_top_circles": 9,
"path_height": 3,
}
def construct(self):
self.add_path()
self.add_circles()
self.wait(8)
self.organize_circles_in_a_row()
self.show_frequencies()
self.show_examples_for_frequencies()
self.show_as_vectors()
self.show_vector_sum()
self.tweak_starting_vectors()
def add_path(self):
self.path = self.get_path()
self.add(self.path)
def add_circles(self):
coefs = self.get_coefficients_of_path(self.path)
self.circles = self.get_circles(coefficients=coefs)
self.add(self.circles)
self.drawn_path = self.get_drawn_path(self.circles)
self.add(self.drawn_path)
def organize_circles_in_a_row(self):
circles = self.circles
top_circles = circles[:self.n_top_circles].copy()
center_trackers = VGroup()
for circle in top_circles:
tracker = VectorizedPoint(circle.center_func())
circle.center_func = tracker.get_location
center_trackers.add(tracker)
tracker.freq = circle.freq
tracker.circle = circle
center_trackers.submobjects.sort(
key=lambda m: m.freq
)
center_trackers.generate_target()
right_buff = 1.45
center_trackers.target.arrange(RIGHT, buff=right_buff)
center_trackers.target.to_edge(UP, buff=1.25)
self.add(top_circles)
self.play(
MoveToTarget(center_trackers),
run_time=2
)
self.wait(4)
self.top_circles = top_circles
self.center_trackers = center_trackers
def show_frequencies(self):
center_trackers = self.center_trackers
freq_numbers = VGroup()
for ct in center_trackers:
number = Integer(ct.freq)
number.next_to(ct, DOWN, buff=1)
freq_numbers.add(number)
ct.circle.number = number
ld, rd = [
TexMobject("\\dots")
for x in range(2)
]
ld.next_to(freq_numbers, LEFT, MED_LARGE_BUFF)
rd.next_to(freq_numbers, RIGHT, MED_LARGE_BUFF)
freq_numbers.add_to_back(ld)
freq_numbers.add(rd)
freq_word = TextMobject("Frequencies")
freq_word.scale(1.5)
freq_word.set_color(YELLOW)
freq_word.next_to(freq_numbers, DOWN, MED_LARGE_BUFF)
self.play(
LaggedStartMap(
FadeInFromDown, freq_numbers
)
)
self.play(
Write(freq_word),
LaggedStartMap(
ShowCreationThenFadeAround, freq_numbers,
)
)
self.wait(2)
self.freq_numbers = freq_numbers
self.freq_word = freq_word
def show_examples_for_frequencies(self):
top_circles = self.top_circles
c1, c2, c3 = [
list(filter(
lambda c: c.freq == k,
top_circles
))[0]
for k in (1, 2, 3)
]
neg_circles = VGroup(*filter(
lambda c: c.freq < 0,
top_circles
))
for c in [c1, c2, c3, *neg_circles]:
c.rect = SurroundingRectangle(c)
self.play(
ShowCreation(c2.rect),
WiggleOutThenIn(c2.number),
)
self.wait(2)
self.play(
ReplacementTransform(c2.rect, c1.rect),
)
self.play(FadeOut(c1.rect))
self.wait()
self.play(
ShowCreation(c3.rect),
WiggleOutThenIn(c3.number),
)
self.play(
FadeOut(c3.rect),
)
self.wait(2)
self.play(
LaggedStart(*[
ShowCreationThenFadeOut(c.rect)
for c in neg_circles
])
)
self.wait(3)
self.play(FadeOut(self.freq_word))
def show_as_vectors(self):
top_circles = self.top_circles
top_vectors = self.get_rotating_vectors(top_circles)
top_vectors.set_color(WHITE)
original_circles = top_circles.copy()
self.play(
FadeIn(top_vectors),
top_circles.set_opacity, 0,
)
self.wait(3)
self.play(
top_circles.match_style, original_circles
)
self.remove(top_vectors)
self.top_vectors = top_vectors
def show_vector_sum(self):
trackers = self.center_trackers.copy()
trackers.sort(
submob_func=lambda t: abs(t.circle.freq - 0.1)
)
plane = self.plane = NumberPlane(
x_min=-3,
x_max=3,
y_min=-2,
y_max=2,
axis_config={
"stroke_color": LIGHT_GREY,
}
)
plane.set_stroke(width=1)
plane.fade(0.5)
plane.move_to(self.center_point)
self.play(
FadeOut(self.drawn_path),
FadeOut(self.circles),
self.slow_factor_tracker.set_value, 0.05,
)
self.add(plane, self.path)
self.play(FadeIn(plane))
new_circles = VGroup()
last_tracker = None
for tracker in trackers:
if last_tracker:
tracker.new_location_func = last_tracker.circle.get_start
else:
tracker.new_location_func = lambda: self.center_point
original_circle = tracker.circle
tracker.circle = original_circle.copy()
tracker.circle.center_func = tracker.get_location
new_circles.add(tracker.circle)
self.add(tracker, tracker.circle)
start_point = tracker.get_location()
self.play(
UpdateFromAlphaFunc(
tracker, lambda t, a: t.move_to(
interpolate(
start_point,
tracker.new_location_func(),
a,
)
),
run_time=2
)
)
tracker.add_updater(lambda t: t.move_to(
t.new_location_func()
))
self.wait(2)
last_tracker = tracker
self.wait(3)
self.clear()
self.slow_factor_tracker.set_value(0.1)
self.add(
self.top_circles,
self.freq_numbers,
self.path,
)
self.add_circles()
for tc in self.top_circles:
for c in self.circles:
if c.freq == tc.freq:
tc.rotate(
angle_of_vector(c.get_start() - c.get_center()) -
angle_of_vector(tc.get_start() - tc.get_center())
)
self.wait(10)
def tweak_starting_vectors(self):
top_circles = self.top_circles
circles = self.circles
path = self.path
drawn_path = self.drawn_path
new_path = self.get_new_path()
new_coefs = self.get_coefficients_of_path(new_path)
new_circles = self.get_circles(coefficients=new_coefs)
new_top_circles = VGroup()
new_top_vectors = VGroup()
for top_circle in top_circles:
for circle in new_circles:
if circle.freq == top_circle.freq:
new_top_circle = circle.copy()
new_top_circle.center_func = top_circle.get_center
new_top_vector = self.get_rotating_vector(
new_top_circle
)
new_top_circles.add(new_top_circle)
new_top_vectors.add(new_top_vector)
self.play(
self.slow_factor_tracker.set_value, 0,
FadeOut(drawn_path)
)
self.wait()
self.play(
ReplacementTransform(top_circles, new_top_circles),
ReplacementTransform(circles, new_circles),
FadeOut(path),
run_time=3,
)
new_drawn_path = self.get_drawn_path(
new_circles, stroke_width=4,
)
self.add(new_drawn_path)
self.slow_factor_tracker.set_value(0.1)
self.wait(20)
#
def configure_path(self, path):
path.set_stroke(WHITE, 1)
path.set_fill(BLACK, opacity=1)
path.set_height(self.path_height)
path.move_to(self.center_point)
return path
def get_path(self):
tex = TexMobject("f")
path = tex.family_members_with_points()[0]
self.configure_path(path)
return path
# return Square().set_height(3)
def get_new_path(self):
shape = SVGMobject("TrebleClef")
path = shape.family_members_with_points()[0]
self.configure_path(path)
path.scale(1.5, about_edge=DOWN)
return path

File diff suppressed because it is too large Load Diff

View File

@@ -1,142 +0,0 @@
from manimlib.imports import *
from active_projects.diffyq.part2.wordy_scenes import WriteHeatEquationTemplate
class ReactionsToInitialHeatEquation(PiCreatureScene):
def construct(self):
randy = self.pi_creature
randy.set_color(BLUE_C)
randy.center()
point = VectorizedPoint().next_to(randy, UL, LARGE_BUFF)
randy.add_updater(lambda r: r.look_at(point))
self.play(randy.change, "horrified")
self.wait()
self.play(randy.change, "pondering")
self.wait()
self.play(
randy.change, "confused",
point.next_to, randy, UR, LARGE_BUFF,
)
self.wait(2)
self.play(
point.shift, 2 * DOWN,
randy.change, "horrified"
)
self.wait(4)
class ContrastPDEToODE(TeacherStudentsScene):
CONFIG = {
"random_seed": 2,
}
def construct(self):
student = self.students[2]
pde, ode = words = VGroup(*[
TextMobject(
text + "\\\\",
"Differential\\\\",
"Equation"
)
for text in ("Partial", "Ordinary")
])
pde[0].set_color(YELLOW)
ode[0].set_color(BLUE)
for word in words:
word.arrange(DOWN, aligned_edge=LEFT)
words.arrange(RIGHT, buff=LARGE_BUFF)
words.next_to(student.get_corner(UR), UP, MED_LARGE_BUFF)
words.shift(UR)
lt = TexMobject("<")
lt.scale(1.5)
lt.move_to(Line(pde.get_right(), ode.get_left()))
for pi in self.pi_creatures:
pi.add_updater(lambda p: p.look_at(pde))
self.play(
FadeInFromDown(VGroup(words, lt)),
student.change, "raise_right_hand",
)
self.play(
self.get_student_changes("pondering", "pondering", "hooray"),
self.teacher.change, "happy"
)
self.wait(3)
self.play(
Swap(ode, pde),
self.teacher.change, "raise_right_hand",
self.get_student_changes(
"erm", "sassy", "confused"
)
)
self.look_at(words)
self.change_student_modes(
"thinking", "thinking", "tease",
)
self.wait(3)
class AskAboutWhereEquationComesFrom(TeacherStudentsScene, WriteHeatEquationTemplate):
def construct(self):
equation = self.get_d1_equation()
equation.move_to(self.hold_up_spot, DOWN)
self.play(
FadeInFromDown(equation),
self.teacher.change, "raise_right_hand"
)
self.student_says(
"Um...why?",
target_mode="sassy",
student_index=2,
bubble_kwargs={"direction": RIGHT},
)
self.change_student_modes(
"confused", "confused", "sassy",
)
self.wait()
self.play(
self.teacher.change, "pondering",
)
self.wait(2)
class AskWhyRewriteIt(TeacherStudentsScene):
def construct(self):
self.student_says(
"Why?", student_index=1,
bubble_kwargs={"height": 2, "width": 2},
)
self.students[1].bubble = None
self.teacher_says(
"One step closer\\\\to derivatives"
)
self.change_student_modes(
"thinking", "thinking", "thinking",
look_at_arg=4 * LEFT + 2 * UP
)
self.wait(2)
class ReferenceKhanVideo(TeacherStudentsScene):
def construct(self):
khan_logo = ImageMobject("KhanLogo")
khan_logo.set_height(1)
khan_logo.next_to(self.teacher, UP, buff=2)
khan_logo.shift(2 * LEFT)
self.play(
self.teacher.change, "raise_right_hand",
)
self.change_student_modes(
"thinking", "pondering", "thinking",
look_at_arg=self.screen
)
self.wait()
self.play(FadeInFromDown(khan_logo))
self.look_at(self.screen)
self.wait(15)

View File

@@ -1,35 +0,0 @@
from manimlib.imports import *
TIME_COLOR = YELLOW
X_COLOR = GREEN
def get_heat_equation():
pass
def temperature_to_color(temp, min_temp=-1, max_temp=1):
colors = [BLUE, TEAL, GREEN, YELLOW, "#ff0000"]
alpha = inverse_interpolate(min_temp, max_temp, temp)
index, sub_alpha = integer_interpolate(
0, len(colors) - 1, alpha
)
return interpolate_color(
colors[index], colors[index + 1], sub_alpha
)
def two_d_temp_func(x, y, t):
return np.sum([
c * np.sin(f * var) * np.exp(-(f**2) * t)
for c, f, var in [
(0.2, 1, x),
(0.3, 3, x),
(0.02, 5, x),
(0.01, 7, x),
(0.5, 2, y),
(0.1, 10, y),
(0.01, 20, y),
]
])

View File

@@ -1,794 +0,0 @@
from manimlib.imports import *
from active_projects.diffyq.part1.staging import TourOfDifferentialEquations
class PartTwoOfTour(TourOfDifferentialEquations):
CONFIG = {
"zoomed_thumbnail_index": 1,
}
def construct(self):
self.add_title()
self.show_thumbnails()
self.zoom_in_to_one_thumbnail()
def zoom_in_to_one_thumbnail(self):
frame = self.camera_frame
thumbnails = self.thumbnails
ode = TextMobject("Ordinary\\\\", "Differential Equation")
pde = TextMobject("Partial\\\\", "Differential Equation")
for word, thumbnail, vect in zip([ode, pde], thumbnails, [DOWN, UP]):
word.match_width(thumbnail)
word.next_to(thumbnail, vect)
ode[0].set_color(BLUE)
pde[0].set_color(YELLOW)
self.add(ode)
frame.save_state()
self.play(
frame.replace,
thumbnails[0],
run_time=1,
)
self.play(
Restore(frame, run_time=3),
)
self.play(
TransformFromCopy(ode, pde),
)
self.play(
ApplyMethod(
frame.replace, thumbnails[1],
path_arc=(-30 * DEGREES),
run_time=3
),
)
self.wait()
class BrownianMotion(Scene):
CONFIG = {
"wait_time": 60,
"L": 3, # Box in [-L, L] x [-L, L]
"n_particles": 100,
"m1": 1,
"m2": 100,
"r1": 0.05,
"r2": 0.5,
"max_v": 5,
"random_seed": 2,
}
def construct(self):
self.add_title()
self.add_particles()
self.wait(self.wait_time)
def add_title(self):
square = Square(side_length=2 * self.L)
title = TextMobject("Brownian motion")
title.scale(1.5)
title.next_to(square, UP)
self.add(square)
self.add(title)
def add_particles(self):
m1 = self.m1
m2 = self.m2
r1 = self.r1
r2 = self.r2
L = self.L
max_v = self.max_v
n_particles = self.n_particles
lil_particles = VGroup(*[
self.get_particle(m1, r1, L, max_v)
for k in range(n_particles)
])
big_particle = self.get_particle(m2, r2, L=r2, max_v=0)
big_particle.set_fill(YELLOW, 1)
for p in lil_particles:
if self.are_colliding(p, big_particle):
lil_particles.remove(p)
all_particles = VGroup(big_particle, *lil_particles)
all_particles.add_updater(self.update_particles)
path = self.get_traced_path(big_particle)
self.add(all_particles)
self.add(path)
self.particles = all_particles
self.big_particle = big_particle
self.path = path
def get_particle(self, m, r, L, max_v):
dot = Dot(radius=r)
dot.set_fill(WHITE, 0.7)
dot.mass = m
dot.radius = r
dot.center = op.add(
np.random.uniform(-L + r, L - r) * RIGHT,
np.random.uniform(-L + r, L - r) * UP
)
dot.move_to(dot.center)
dot.velocity = rotate_vector(
np.random.uniform(0, max_v) * RIGHT,
np.random.uniform(0, TAU),
)
return dot
def are_colliding(self, p1, p2):
d = get_norm(p1.get_center() - p2.get_center())
return (d < p1.radius + p2.radius)
def get_traced_path(self, particle):
path = VMobject()
path.set_stroke(BLUE, 3)
path.start_new_path(particle.get_center())
buff = 0.02
def update_path(path):
new_point = particle.get_center()
if get_norm(new_point - path.get_last_point()) > buff:
path.add_line_to(new_point)
path.add_updater(update_path)
return path
def update_particles(self, particles, dt):
for p1 in particles:
p1.center += p1.velocity * dt
# Check particle collisions
buff = 0.01
for p2 in particles:
if p1 is p2:
continue
v = p2.center - p1.center
dist = get_norm(v)
r_sum = p1.radius + p2.radius
diff = dist - r_sum
if diff < 0:
unit_v = v / dist
p1.center += (diff - buff) * unit_v / 2
p2.center += -(diff - buff) * unit_v / 2
u1 = p1.velocity
u2 = p2.velocity
m1 = p1.mass
m2 = p2.mass
v1 = (
(m2 * (u2 - u1) + m1 * u1 + m2 * u2) /
(m1 + m2)
)
v2 = (
(m1 * (u1 - u2) + m1 * u1 + m2 * u2) /
(m1 + m2)
)
p1.velocity = v1
p2.velocity = v2
# Check edge collisions
r1 = p1.radius
c1 = p1.center
for i in [0, 1]:
if abs(c1[i]) + r1 > self.L:
c1[i] = np.sign(c1[i]) * (self.L - r1)
p1.velocity[i] *= -1 * op.mul(
np.sign(p1.velocity[i]),
np.sign(c1[i])
)
for p in particles:
p.move_to(p.center)
return particles
class AltBrownianMotion(BrownianMotion):
CONFIG = {
"wait_time": 20,
"n_particles": 100,
"m2": 10,
}
class BlackScholes(AltBrownianMotion):
def construct(self):
# For some reason I'm amused by the thought
# Of this graph perfectly matching the Brownian
# Motion y-coordiante
self.add_title()
self.add_particles()
self.particles.set_opacity(0)
self.remove(self.path)
self.add_graph()
self.wait(self.wait_time)
def add_title(self):
title = TextMobject("Black-Scholes equations")
title.scale(1.5)
title.next_to(2 * UP, UP)
equation = TexMobject(
"{\\partial V \\over \\partial t}", "+",
"\\frac{1}{2} \\sigma^2 S^2",
"{\\partial^2 V \\over \\partial S^2}", "+",
"rS", "{\\partial V \\over \\partial S}",
"-rV", "=", "0",
)
equation.scale(0.8)
equation.next_to(title, DOWN)
self.add(title)
self.add(equation)
self.title = title
self.equation = equation
def add_graph(self):
axes = Axes(
x_min=-1,
x_max=20,
y_min=0,
y_max=10,
axis_config={
"unit_size": 0.5,
},
)
axes.set_height(4)
axes.move_to(DOWN)
def get_graph_point():
return axes.c2p(
self.get_time(),
5 + 2 * self.big_particle.get_center()[1]
)
graph = VMobject()
graph.match_style(self.path)
graph.start_new_path(get_graph_point())
graph.add_updater(
lambda g: g.add_line_to(get_graph_point())
)
self.add(axes)
self.add(graph)
class ContrastChapters1And2(Scene):
def construct(self):
c1_frame, c2_frame = frames = VGroup(*[
ScreenRectangle(height=3.5)
for x in range(2)
])
frames.arrange(RIGHT, buff=LARGE_BUFF)
c1_title, c2_title = titles = VGroup(
TextMobject("Chapter 1"),
TextMobject("Chapter 2"),
)
titles.scale(1.5)
ode, pde = des = VGroup(
TextMobject(
"Ordinary",
"Differential Equations\\\\",
"ODEs",
),
TextMobject(
"Partial",
"Differential Equations\\\\",
"PDEs",
),
)
ode[0].set_color(BLUE)
pde[0].set_color(YELLOW)
for de in des:
de[-1][0].match_color(de[0])
de[-1].scale(1.5, about_point=de.get_top())
for title, frame, de in zip(titles, frames, des):
title.next_to(frame, UP)
de.match_width(frame)
de.next_to(frame, DOWN)
lt = TexMobject("<")
lt.move_to(Line(ode.get_right(), pde.get_left()))
lt.scale(2, about_edge=UP)
c1_words = TextMobject(
"They're", "really\\\\", "{}",
"freaking", "hard\\\\",
"to", "solve\\\\",
)
c1_words.set_height(0.5 * c1_frame.get_height())
c1_words.move_to(c1_frame)
c2_words = TextMobject(
"They're", "really", "\\emph{really}\\\\",
"freaking", "hard\\\\",
"to", "solve\\\\",
)
c2_words.set_color_by_tex("\\emph", YELLOW)
c2_words.move_to(c2_frame)
edit_shift = MED_LARGE_BUFF * RIGHT
c2_edits = VGroup(
TextMobject("sometimes").next_to(
c2_words[1:3], UP,
aligned_edge=LEFT,
),
Line(
c2_words[1].get_left(),
c2_words[2].get_right(),
stroke_width=8,
),
TextMobject("not too").next_to(
c2_words[3], LEFT,
),
Line(
c2_words[3].get_left(),
c2_words[3].get_right(),
stroke_width=8,
),
)
c2_edits.set_color(RED)
c2_edits[2:].shift(edit_shift)
self.add(titles)
self.add(frames)
self.add(des)
self.wait()
self.play(LaggedStartMap(
FadeInFromDown, c1_words,
lag_ratio=0.1,
))
self.wait()
# self.play(FadeIn(ode))
self.play(
# TransformFromCopy(ode, pde),
TransformFromCopy(c1_words, c2_words),
Write(lt)
)
self.wait()
self.play(
Write(c2_edits[:2], run_time=1),
)
self.play(
c2_words[3:5].shift, edit_shift,
Write(c2_edits[2:]),
run_time=1,
)
self.wait()
class ShowCubeFormation(ThreeDScene):
CONFIG = {
"camera_config": {
"shading_factor": 1.0,
},
"color": False,
}
def construct(self):
light_source = self.camera.light_source
light_source.move_to(np.array([-6, -3, 6]))
cube = Cube(
side_length=4,
fill_color=GREY,
stroke_color=WHITE,
stroke_width=0.5,
)
cube.set_fill(opacity=1)
if self.color:
# cube[0].set_color(BLUE)
# cube[1].set_color(RED)
# for face in cube[2:]:
# face.set_color([BLUE, RED])
cube.color_using_background_image("VerticalTempGradient")
# light_source.next_to(cube, np.array([1, -1, 1]), buff=2)
cube_3d = cube.copy()
cube_2d = cube_3d.copy().stretch(0, 2)
cube_1d = cube_2d.copy().stretch(0, 1)
cube_0d = cube_1d.copy().stretch(0, 0)
cube.become(cube_0d)
self.set_camera_orientation(
phi=70 * DEGREES,
theta=-145 * DEGREES,
)
self.begin_ambient_camera_rotation(rate=0.05)
for target in [cube_1d, cube_2d, cube_3d]:
self.play(
Transform(cube, target, run_time=1.5)
)
self.wait(8)
class ShowCubeFormationWithColor(ShowCubeFormation):
CONFIG = {
"color": True,
}
class ShowRect(Scene):
CONFIG = {
"height": 1,
"width": 3,
}
def construct(self):
rect = Rectangle(
height=self.height,
width=self.width,
)
rect.set_color(YELLOW)
self.play(ShowCreationThenFadeOut(rect))
class ShowSquare(ShowRect):
CONFIG = {
"height": 1,
"width": 1,
}
class ShowHLine(Scene):
def construct(self):
line = Line(LEFT, RIGHT)
line.set_color(BLUE)
self.play(ShowCreationThenFadeOut(line))
class ShowCross(Scene):
def construct(self):
cross = Cross(Square())
cross.set_width(3)
cross.set_height(1, stretch=True)
self.play(ShowCreation(cross))
class TwoBodyEquations(Scene):
def construct(self):
kw = {
"tex_to_color_map": {
"x_1": LIGHT_GREY,
"y_1": LIGHT_GREY,
"x_2": BLUE,
"y_2": BLUE,
"=": WHITE,
}
}
equations = VGroup(
TexMobject(
"{d^2 x_1 \\over dt^2}",
"=",
"{x_2 - x_1 \\over m_1 \\left(",
"(x_2 - x_1)^2 + (y_2 - y_1)^2",
"\\right)^{3/2}",
**kw
),
TexMobject(
"{d^2 y_1 \\over dt^2}",
"=",
"{y_2 - y_1 \\over m_1 \\left(",
"(x_2 - x_1)^2 + (y_2 - y_1)^2",
"\\right)^{3/2}",
**kw
),
TexMobject(
"{d^2 x_2 \\over dt^2}",
"=",
"{x_1 - x_2 \\over m_2 \\left(",
"(x_2 - x_1)^2 + (y_2 - y_1)^2",
"\\right)^{3/2}",
**kw
),
TexMobject(
"{d^2 y_2 \\over dt^2}",
"=",
"{y_1 - y_2 \\over m_2 \\left(",
"(x_2 - x_1)^2 + (y_2 - y_1)^2",
"\\right)^{3/2}",
**kw
),
)
equations.arrange(DOWN, buff=LARGE_BUFF)
equations.set_height(6)
equations.to_edge(LEFT)
variables = VGroup()
lhss = VGroup()
rhss = VGroup()
for equation in equations:
variable = equation[1]
lhs = equation[:4]
rhs = equation[4:]
variables.add(variable)
lhss.add(lhs)
rhss.add(rhs)
lhss_copy = lhss.copy()
for variable, lhs in zip(variables, lhss):
variable.save_state()
variable.match_height(lhs)
variable.scale(0.7)
variable.move_to(lhs, LEFT)
self.play(LaggedStart(*[
FadeInFrom(v, RIGHT)
for v in variables
]))
self.wait()
self.play(
LaggedStartMap(Restore, variables),
FadeIn(
lhss_copy,
remover=True,
lag_ratio=0.1,
run_time=2,
)
)
self.add(lhss)
self.wait()
self.play(LaggedStartMap(
FadeIn, rhss
))
self.wait()
self.play(
LaggedStart(*[
ShowCreationThenFadeAround(lhs[:3])
for lhs in lhss
])
)
self.wait()
self.play(
LaggedStartMap(
ShowCreationThenFadeAround,
rhss,
)
)
self.wait()
class LaplacianIntuition(SpecialThreeDScene):
CONFIG = {
"three_d_axes_config": {
"x_min": -5,
"x_max": 5,
"y_min": -5,
"y_max": 5,
},
"surface_resolution": 32,
}
def construct(self):
axes = self.get_axes()
axes.scale(0.5, about_point=ORIGIN)
self.set_camera_to_default_position()
self.begin_ambient_camera_rotation()
def func(x, y):
return np.array([
x, y,
2.7 + 0.5 * (np.sin(x) + np.cos(y)) -
0.025 * (x**2 + y**2)
])
surface_config = {
"u_min": -5,
"u_max": 5,
"v_min": -5,
"v_max": 5,
"resolution": self.surface_resolution,
}
# plane = ParametricSurface(
# lambda u, v: np.array([u, v, 0]),
# **surface_config
# )
# plane.set_stroke(WHITE, width=0.1)
# plane.set_fill(WHITE, opacity=0.1)
plane = Square(
side_length=10,
stroke_width=0,
fill_color=WHITE,
fill_opacity=0.1,
)
plane.center()
plane.set_shade_in_3d(True)
surface = ParametricSurface(
func, **surface_config
)
surface.set_stroke(BLUE, width=0.1)
surface.set_fill(BLUE, opacity=0.25)
self.add(axes, plane, surface)
point = VectorizedPoint(np.array([2, -2, 0]))
dot = Dot()
dot.set_color(GREEN)
dot.add_updater(lambda d: d.move_to(point))
line = always_redraw(lambda: DashedLine(
point.get_location(),
func(*point.get_location()[:2]),
background_image_file="VerticalTempGradient",
))
circle = Circle(radius=0.25)
circle.set_color(YELLOW)
circle.insert_n_curves(20)
circle.add_updater(lambda m: m.move_to(point))
circle.set_shade_in_3d(True)
surface_circle = always_redraw(
lambda: circle.copy().apply_function(
lambda p: func(*p[:2])
).shift(
0.02 * IN
).color_using_background_image("VerticalTempGradient")
)
self.play(FadeInFromLarge(dot))
self.play(ShowCreation(line))
self.play(TransformFromCopy(dot, circle))
self.play(
Transform(
circle.copy(),
surface_circle.copy().clear_updaters(),
remover=True,
)
)
self.add(surface_circle)
self.wait()
for vect in [4 * LEFT, DOWN, 4 * RIGHT, UP]:
self.play(
point.shift, vect,
run_time=3,
)
class StrogatzMention(PiCreatureScene):
def construct(self):
self.show_book()
self.show_motives()
self.show_pages()
def show_book(self):
morty = self.pi_creature
book = ImageMobject("InfinitePowers")
book.set_height(5)
book.to_edge(LEFT)
steve = ImageMobject("Strogatz_by_bricks")
steve.set_height(5)
steve.to_edge(LEFT)
name = TextMobject("Steven Strogatz")
name.match_width(steve)
name.next_to(steve, DOWN)
self.think(
"Hmm...many good\\\\lessons here...",
run_time=1
)
self.wait()
self.play(FadeInFromDown(steve))
self.wait()
self.play(
FadeInFrom(book, DOWN),
steve.shift, 4 * RIGHT,
RemovePiCreatureBubble(
morty, target_mode="thinking"
)
)
self.wait(3)
self.play(
FadeOut(steve),
FadeOut(morty),
)
self.book = book
def show_motives(self):
motives = VGroup(
TextMobject("1) Scratch and itch"),
TextMobject("2) Make people love math"),
)
motives.scale(1.5)
motives.arrange(
DOWN, LARGE_BUFF,
aligned_edge=LEFT,
)
motives.move_to(
Line(
self.book.get_right(),
FRAME_WIDTH * RIGHT / 2
)
)
motives.to_edge(UP)
for motive in motives:
self.play(FadeInFromDown(motive))
self.wait(2)
self.play(FadeOut(motives))
def show_pages(self):
book = self.book
pages = Group(*[
ImageMobject("IP_Sample_Page{}".format(i))
for i in range(1, 4)
])
for page in pages:
page.match_height(book)
page.next_to(book, RIGHT)
last_page = VectorizedPoint()
for page in pages:
self.play(
FadeOut(last_page),
FadeIn(page)
)
self.wait()
last_page = page
self.play(FadeOut(last_page))
def create_pi_creature(self):
return Mortimer().to_corner(DR)
class Thumbnail(Scene):
def construct(self):
image = ImageMobject("HeatSurfaceExampleFlipped")
image.set_height(6.5)
image.to_edge(DOWN, buff=-SMALL_BUFF)
self.add(image)
equation = TexMobject(
"{\\partial {T} \\over \\partial {t}}", "=",
"\\alpha", "\\nabla^2 {T}",
tex_to_color_map={
"{t}": YELLOW,
"{T}": RED,
}
)
equation.scale(2)
equation.to_edge(UP)
self.add(equation)
Group(equation, image).shift(1.5 * RIGHT)
question = TextMobject("What is\\\\this?")
question.scale(2.5)
question.to_edge(LEFT)
arrow = Arrow(
question.get_top(),
equation.get_left(),
buff=0.5,
path_arc=-90 * DEGREES,
)
arrow.set_stroke(width=5)
self.add(question, arrow)
class ShowNewton(Scene):
def construct(self):
pass
class ShowCupOfWater(Scene):
def construct(self):
pass

View File

@@ -1,785 +0,0 @@
from manimlib.imports import *
class WriteHeatEquationTemplate(Scene):
CONFIG = {
"tex_mobject_config": {
"tex_to_color_map": {
"{T}": WHITE,
"{t}": YELLOW,
"{x}": GREEN,
"{y}": RED,
"{z}": BLUE,
"\\partial": WHITE,
"2": WHITE,
},
},
}
def get_d1_equation(self):
return TexMobject(
"{\\partial {T} \\over \\partial {t}}({x}, {t})", "=",
"\\alpha \\cdot",
"{\\partial^2 {T} \\over \\partial {x}^2} ({x}, {t})",
**self.tex_mobject_config
)
def get_d1_equation_without_inputs(self):
return TexMobject(
"{\\partial {T} \\over \\partial {t}}", "=",
"\\alpha \\cdot",
"{\\partial^2 {T} \\over \\partial {x}^2}",
**self.tex_mobject_config
)
def get_d3_equation(self):
return TexMobject(
"{\\partial {T} \\over \\partial {t}}", "=",
"\\alpha \\left(",
"{\\partial^2 {T} \\over \\partial {x}^2} + ",
"{\\partial^2 {T} \\over \\partial {y}^2} + ",
"{\\partial^2 {T} \\over \\partial {z}^2}",
"\\right)",
**self.tex_mobject_config
)
def get_general_equation(self):
return TexMobject(
"{\\partial {T} \\over \\partial {t}}", "=",
"\\alpha", "\\nabla^2 {T}",
**self.tex_mobject_config,
)
def get_d3_equation_with_inputs(self):
return TexMobject(
"{\\partial {T} \\over \\partial {t}}",
"({x}, {y}, {z}, {t})", "=",
"\\alpha \\left(",
"{\\partial^2 {T} \\over \\partial {x}^2}",
"({x}, {y}, {z}, {t}) + ",
"{\\partial^2 {T} \\over \\partial {y}^2}",
"({x}, {y}, {z}, {t}) + ",
"{\\partial^2 {T} \\over \\partial {z}^2}",
"({x}, {y}, {z}, {t})",
"\\right)",
**self.tex_mobject_config
)
def get_d1_words(self):
return TextMobject("Heat equation\\\\", "(1 dimension)")
def get_d3_words(self):
return TextMobject("Heat equation\\\\", "(3 dimensions)")
def get_d1_group(self):
group = VGroup(
self.get_d1_words(),
self.get_d1_equation(),
)
group.arrange(DOWN, buff=MED_LARGE_BUFF)
return group
def get_d3_group(self):
group = VGroup(
self.get_d3_words(),
self.get_d3_equation(),
)
group.arrange(DOWN, buff=MED_LARGE_BUFF)
return group
class HeatEquationIntroTitle(WriteHeatEquationTemplate):
def construct(self):
scale_factor = 1.25
title = TextMobject("The Heat Equation")
title.scale(scale_factor)
title.to_edge(UP)
equation = self.get_general_equation()
equation.scale(scale_factor)
equation.next_to(title, DOWN, MED_LARGE_BUFF)
equation.set_color_by_tex("{T}", RED)
self.play(
FadeInFrom(title, DOWN),
FadeInFrom(equation, UP),
)
self.wait()
class BringTogether(Scene):
def construct(self):
arrows = VGroup(Vector(2 * RIGHT), Vector(2 * LEFT))
arrows.arrange(RIGHT, buff=2)
words = TextMobject("Bring together")[0]
words.next_to(arrows, DOWN)
words.save_state()
words.space_out_submobjects(1.2)
self.play(
VFadeIn(words),
Restore(words),
arrows.arrange, RIGHT, {"buff": SMALL_BUFF},
VFadeIn(arrows),
)
self.play(FadeOut(words), FadeOut(arrows))
class FourierSeriesIntro(WriteHeatEquationTemplate):
def construct(self):
title_scale_value = 1.5
title = TextMobject(
"Fourier ", "Series",
)
title.scale(title_scale_value)
title.to_edge(UP)
title.generate_target()
details_coming = TextMobject("Details coming...")
details_coming.next_to(title.get_corner(DR), DOWN)
details_coming.set_color(LIGHT_GREY)
# physics = TextMobject("Physics")
heat = TextMobject("Heat")
heat.scale(title_scale_value)
physics = self.get_general_equation()
physics.set_color_by_tex("{T}", RED)
arrow1 = Arrow(LEFT, RIGHT)
arrow2 = Arrow(LEFT, RIGHT)
group = VGroup(
heat, arrow1, physics, arrow2, title.target
)
group.arrange(RIGHT)
# physics.align_to(title.target, UP)
group.to_edge(UP)
rot_square = Square()
rot_square.fade(1)
rot_square.add_updater(lambda m, dt: m.rotate(dt))
def update_heat_colors(heat):
colors = [YELLOW, RED]
vertices = rot_square.get_vertices()
letters = heat.family_members_with_points()
for letter, vertex in zip(letters, vertices):
alpha = (normalize(vertex)[0] + 1) / 2
i, sa = integer_interpolate(0, len(colors) - 1, alpha)
letter.set_color(interpolate_color(
colors[i], colors[i + 1], alpha,
))
heat.add_updater(update_heat_colors)
image = ImageMobject("Joseph Fourier")
image.set_height(5)
image.next_to(title, DOWN, LARGE_BUFF)
image.to_edge(LEFT)
name = TextMobject("Joseph", "Fourier")
name.next_to(image, DOWN)
bubble = ThoughtBubble(
height=2,
width=2.5,
direction=RIGHT,
)
bubble.set_fill(opacity=0)
bubble.set_stroke(WHITE)
bubble.set_stroke(BLACK, 5, background=True)
bubble.shift(heat.get_center() - bubble.get_bubble_center())
bubble[:-1].shift(LEFT + 0.2 * DOWN)
bubble[:-1].rotate(-20 * DEGREES)
for mob in bubble[:-1]:
mob.rotate(20 * DEGREES)
# self.play(FadeInFromDown(title))
self.add(title)
self.play(
FadeInFromDown(image),
TransformFromCopy(
title.get_part_by_tex("Fourier"),
name.get_part_by_tex("Fourier"),
path_arc=90 * DEGREES,
),
FadeIn(name.get_part_by_tex("Joseph")),
)
self.play(Write(details_coming, run_time=1))
self.play(LaggedStartMap(FadeOut, details_coming[0], run_time=1))
self.wait()
self.add(rot_square)
self.play(
FadeInFrom(physics, RIGHT),
GrowArrow(arrow2),
FadeInFrom(heat, RIGHT),
GrowArrow(arrow1),
MoveToTarget(title),
)
self.play(ShowCreation(bubble))
self.wait(10)
class CompareODEToPDE(Scene):
def construct(self):
pass
class TodaysTargetWrapper(Scene):
def construct(self):
pass
class TwoGraphTypeTitles(Scene):
def construct(self):
left_title = TextMobject(
"Represent time\\\\with actual time"
)
left_title.shift(FRAME_WIDTH * LEFT / 4)
right_title = TextMobject(
"Represent time\\\\with an axis"
)
right_title.shift(FRAME_WIDTH * RIGHT / 4)
titles = VGroup(left_title, right_title)
for title in titles:
title.scale(1.25)
title.to_edge(UP)
self.play(FadeInFromDown(right_title))
self.wait()
self.play(FadeInFromDown(left_title))
self.wait()
class ShowPartialDerivativeSymbols(Scene):
def construct(self):
t2c = {
"{x}": GREEN,
"{t}": YELLOW,
}
d_derivs, del_derivs = VGroup(*[
VGroup(*[
TexMobject(
"{" + sym, "T", "\\over", sym, var + "}",
"(", "{x}", ",", "{t}", ")",
).set_color_by_tex_to_color_map(t2c)
for var in ("{x}", "{t}")
])
for sym in ("d", "\\partial")
])
dTdx, dTdt = d_derivs
delTdelx, delTdelx = del_derivs
dels = VGroup(*it.chain(*[
del_deriv.get_parts_by_tex("\\partial")
for del_deriv in del_derivs
]))
dTdx.to_edge(UP)
self.play(FadeInFrom(dTdx, DOWN))
self.wait()
self.play(ShowCreationThenFadeAround(dTdx[3:5]))
self.play(ShowCreationThenFadeAround(dTdx[:2]))
self.wait()
dTdt.move_to(dTdx)
self.play(
dTdx.next_to, dTdt, RIGHT, {"buff": 1.5},
dTdx.set_opacity, 0.5,
FadeInFromDown(dTdt)
)
self.wait()
for m1, m2 in zip(d_derivs, del_derivs):
m2.move_to(m1)
pd_words = TextMobject("Partial derivatives")
pd_words.next_to(del_derivs, DOWN, MED_LARGE_BUFF)
self.play(
Write(pd_words),
dTdx.set_opacity, 1,
run_time=1,
)
self.wait()
self.play(
ReplacementTransform(d_derivs, del_derivs)
)
self.play(
LaggedStartMap(
ShowCreationThenFadeAround,
dels,
surrounding_rectangle_config={
"color": BLUE,
"buff": 0.5 * SMALL_BUFF,
"stroke_width": 2,
}
)
)
self.wait()
num_words = VGroup(*[
TextMobject(
"Change in $T$\\\\caused by {}",
"$\\partial$", "${}$".format(var),
arg_separator="",
).set_color_by_tex_to_color_map(t2c)
for var in ("{x}", "{t}")
])
num_words.scale(0.8)
for word, deriv in zip(num_words, del_derivs):
num = deriv[:2]
word.move_to(num, UP)
word.to_edge(UP, buff=MED_SMALL_BUFF)
deriv.rect = SurroundingRectangle(
num,
buff=SMALL_BUFF,
stroke_width=2,
color=word[-1].get_color(),
)
deriv.rect.mob = num
deriv.rect.add_updater(lambda r: r.move_to(r.mob))
self.play(
Write(num_words[1]),
VGroup(del_derivs, pd_words).shift, DOWN,
ShowCreation(del_derivs[1].rect),
)
self.play(
Write(num_words[0]),
ShowCreation(del_derivs[0].rect),
)
self.wait()
class WriteHeatEquation(WriteHeatEquationTemplate):
def construct(self):
title = TextMobject("The Heat Equation")
title.to_edge(UP)
equation = self.get_d1_equation()
equation.next_to(title, DOWN)
eq_i = equation.index_of_part_by_tex("=")
dt_part = equation[:eq_i]
dx_part = equation[eq_i + 3:]
dt_rect = SurroundingRectangle(dt_part)
dt_rect.set_stroke(YELLOW, 2)
dx_rect = SurroundingRectangle(dx_part)
dx_rect.set_stroke(GREEN, 2)
two_outlines = equation.get_parts_by_tex("2").copy()
two_outlines.set_stroke(YELLOW, 2)
two_outlines.set_fill(opacity=0)
to_be_explained = TextMobject(
"To be explained shortly..."
)
to_be_explained.scale(0.7)
to_be_explained.next_to(equation, RIGHT, MED_LARGE_BUFF)
to_be_explained.fade(1)
pde = TextMobject("Partial Differential Equation")
pde.move_to(title)
del_outlines = equation.get_parts_by_tex("\\partial").copy()
del_outlines.set_stroke(YELLOW, 2)
del_outlines.set_fill(opacity=0)
self.play(
FadeInFrom(title, 0.5 * DOWN),
FadeInFrom(equation, 0.5 * UP),
)
self.wait()
self.play(ShowCreation(dt_rect))
self.wait()
self.play(TransformFromCopy(dt_rect, dx_rect))
self.play(ShowCreationThenDestruction(two_outlines))
self.wait()
self.play(Write(to_be_explained, run_time=1))
self.wait(2)
self.play(
ShowCreationThenDestruction(
del_outlines,
lag_ratio=0.1,
)
)
self.play(
FadeOutAndShift(title, UP),
FadeInFrom(pde, DOWN),
FadeOut(dt_rect),
FadeOut(dx_rect),
)
self.wait()
class Show3DEquation(WriteHeatEquationTemplate):
def construct(self):
equation = self.get_d3_equation_with_inputs()
equation.set_width(FRAME_WIDTH - 1)
inputs = VGroup(*it.chain(*[
equation.get_parts_by_tex(s)
for s in ["{x}", "{y}", "{z}", "{t}"]
]))
inputs.sort()
equation.to_edge(UP)
self.add(equation)
self.play(LaggedStartMap(
ShowCreationThenFadeAround, inputs,
surrounding_rectangle_config={
"buff": 0.05,
"stroke_width": 2,
}
))
self.wait()
class Show1DAnd3DEquations(WriteHeatEquationTemplate):
def construct(self):
d1_group = self.get_d1_group()
d3_group = self.get_d3_group()
d1_words, d1_equation = d1_group
d3_words, d3_equation = d3_group
groups = VGroup(d1_group, d3_group)
for group in groups:
group.arrange(DOWN, buff=MED_LARGE_BUFF)
groups.arrange(RIGHT, buff=1.5)
groups.to_edge(UP)
d3_rhs = d3_equation[9:-2]
d3_brace = Brace(d3_rhs, DOWN)
nabla_words = TextMobject("Sometimes written as")
nabla_words.match_width(d3_brace)
nabla_words.next_to(d3_brace, DOWN)
nabla_exp = TexMobject(
"\\nabla^2 {T}",
**self.tex_mobject_config,
)
nabla_exp.next_to(nabla_words, DOWN)
# nabla_group = VGroup(nabla_words, nabla_exp)
d1_group.save_state()
d1_group.center().to_edge(UP)
self.play(
Write(d1_words),
FadeInFrom(d1_equation, UP),
run_time=1,
)
self.wait(2)
self.play(
Restore(d1_group),
FadeInFrom(d3_group, LEFT)
)
self.wait()
self.play(
GrowFromCenter(d3_brace),
Write(nabla_words),
TransformFromCopy(d3_rhs, nabla_exp),
run_time=1,
)
self.wait()
class D1EquationNoInputs(WriteHeatEquationTemplate):
def construct(self):
equation = self.get_d1_equation_without_inputs()
equation.to_edge(UP)
# i1 = equation.index_of_part_by_tex("\\partial")
# i2 = equation.index_of_part_by_tex("\\cdot")
# equation[i1:i1 + 2].set_color(RED)
# equation[i2 + 1:i2 + 6].set_color(RED)
equation.set_color_by_tex("{T}", RED)
self.add(equation)
class AltHeatRHS(Scene):
def construct(self):
formula = TexMobject(
"{\\alpha \\over 2}", "\\Big(",
"T({x} - 1, {t}) + T({x} + 1, {t})"
"\\Big)",
tex_to_color_map={
"{x}": GREEN,
"{t}": YELLOW,
}
)
self.add(formula)
class CompareInputsOfGeneralCaseTo1D(WriteHeatEquation):
def construct(self):
three_d_expr, one_d_expr = [
TexMobject(
"{T}(" + inputs + ", {t})",
**self.tex_mobject_config,
)
for inputs in ["{x}, {y}, {z}", "{x}"]
]
for expr in three_d_expr, one_d_expr:
expr.scale(2)
expr.to_edge(UP)
x, y, z = [
three_d_expr.get_part_by_tex(letter)
for letter in ["x", "y", "z"]
]
self.play(FadeInFromDown(three_d_expr))
self.play(LaggedStartMap(
ShowCreationThenFadeAround,
VGroup(x, y, z)
))
self.wait()
low = 3
high = -3
self.play(
ReplacementTransform(three_d_expr[:low], one_d_expr[:low]),
ReplacementTransform(three_d_expr[high:], one_d_expr[high:]),
three_d_expr[low:high].scale, 0,
)
self.wait()
class ShowLaplacian(WriteHeatEquation):
def construct(self):
equation = self.get_d3_equation()
equation.to_edge(UP, buff=MED_SMALL_BUFF)
parts = VGroup()
plusses = VGroup()
for char in "xyz":
index = equation.index_of_part_by_tex(
"{" + char + "}"
)
part = equation[index - 6:index + 3]
rect = SurroundingRectangle(part)
rect.match_color(equation[index])
parts.add(part)
part.rect = rect
if char in "yz":
plus = equation[index - 8]
part.plus = plus
plusses.add(plus)
lp = equation.get_part_by_tex("(")
rp = equation.get_part_by_tex(")")
for part in parts:
part.rp = rp.copy()
part.rp.next_to(part, RIGHT, SMALL_BUFF)
part.rp.align_to(lp, UP)
rp.become(parts[0].rp)
# Show new second derivatives
self.add(*equation)
self.remove(*plusses, *parts[1], *parts[2])
for part in parts[1:]:
self.play(
rp.become, part.rp,
FadeInFrom(part, LEFT),
Write(part.plus),
ShowCreation(part.rect),
)
self.play(
FadeOut(part.rect),
)
self.wait()
# Show laplacian
brace = Brace(parts, DOWN)
laplacian = TexMobject("\\nabla^2", "T")
laplacian.next_to(brace, DOWN)
laplacian_name = TextMobject(
"``Laplacian''"
)
laplacian_name.next_to(laplacian, DOWN)
T_parts = VGroup(*[part[3] for part in parts])
non_T_parts = VGroup(*[
VGroup(*part[:3], *part[4:])
for part in parts
])
self.play(GrowFromCenter(brace))
self.play(Write(laplacian_name))
self.play(
TransformFromCopy(non_T_parts, laplacian[0])
)
self.play(
TransformFromCopy(T_parts, laplacian[1])
)
self.wait(3)
class AskAboutActuallySolving(WriteHeatEquationTemplate):
def construct(self):
equation = self.get_d1_equation()
equation.center()
q1 = TextMobject("Solve for T?")
q1.next_to(equation, UP, LARGE_BUFF)
q2 = TextMobject("What does it \\emph{mean} to solve this?")
q2.next_to(equation, UP, LARGE_BUFF)
formula = TexMobject(
"T({x}, {t}) = \\sin\\big(a{x}\\big) e^{-\\alpha \\cdot a^2 {t}}",
tex_to_color_map={
"{x}": GREEN,
"{t}": YELLOW,
}
)
formula.next_to(equation, DOWN, LARGE_BUFF)
q3 = TextMobject("Is this it?")
arrow = Vector(LEFT, color=WHITE)
arrow.next_to(formula, RIGHT)
q3.next_to(arrow, RIGHT)
self.add(equation)
self.play(FadeInFromDown(q1))
self.wait()
self.play(
FadeInFromDown(q2),
q1.shift, 1.5 * UP,
)
self.play(FadeInFrom(formula, UP))
self.play(
GrowArrow(arrow),
FadeInFrom(q3, LEFT)
)
self.wait()
class PDEPatreonEndscreen(PatreonEndScreen):
CONFIG = {
"specific_patrons": [
"Juan Benet",
"Vassili Philippov",
"Burt Humburg",
"Matt Russell",
"Scott Gray",
"soekul",
"Tihan Seale",
"Richard Barthel",
"Ali Yahya",
"dave nicponski",
"Evan Phillips",
"Graham",
"Joseph Kelly",
"Kaustuv DeBiswas",
"LambdaLabs",
"Lukas Biewald",
"Mike Coleman",
"Peter Mcinerney",
"Quantopian",
"Roy Larson",
"Scott Walter, Ph.D.",
"Yana Chernobilsky",
"Yu Jun",
"Jordan Scales",
"D. Sivakumar",
"Lukas -krtek.net- Novy",
"John Shaughnessy",
"Britt Selvitelle",
"David Gow",
"J",
"Jonathan Wilson",
"Joseph John Cox",
"Magnus Dahlström",
"Randy C. Will",
"Ryan Atallah",
"Luc Ritchie",
"1stViewMaths",
"Adrian Robinson",
"Alexis Olson",
"Andreas Benjamin Brössel",
"Andrew Busey",
"Ankalagon",
"Antoine Bruguier",
"Antonio Juarez",
"Arjun Chakroborty",
"Art Ianuzzi",
"Awoo",
"Bernd Sing",
"Boris Veselinovich",
"Brian Staroselsky",
"Chad Hurst",
"Charles Southerland",
"Chris Connett",
"Christian Kaiser",
"Clark Gaebel",
"Cooper Jones",
"Danger Dai",
"Dave B",
"Dave Kester",
"David B. Hill",
"David Clark",
"DeathByShrimp",
"Delton Ding",
"eaglle",
"emptymachine",
"Eric Younge",
"Eryq Ouithaqueue",
"Federico Lebron",
"Giovanni Filippi",
"Hal Hildebrand",
"Hitoshi Yamauchi",
"Isaac Jeffrey Lee",
"j eduardo perez",
"Jacob Magnuson",
"Jameel Syed",
"Jason Hise",
"Jeff Linse",
"Jeff Straathof",
"John Griffith",
"John Haley",
"John V Wertheim",
"Jonathan Eppele",
"Kai-Siang Ang",
"Kanan Gill",
"L0j1k",
"Lee Beck",
"Lee Redden",
"Linh Tran",
"Ludwig Schubert",
"Magister Mugit",
"Mark B Bahu",
"Mark Heising",
"Martin Price",
"Mathias Jansson",
"Matt Langford",
"Matt Roveto",
"Matthew Bouchard",
"Matthew Cocke",
"Michael Faust",
"Michael Hardel",
"Mirik Gogri",
"Mustafa Mahdi",
"Márton Vaitkus",
"Nero Li",
"Nikita Lesnikov",
"Omar Zrien",
"Owen Campbell-Moore",
"Peter Ehrnstrom",
"RedAgent14",
"rehmi post",
"Richard Burgmann",
"Richard Comish",
"Ripta Pasay",
"Rish Kundalia",
"Robert Teed",
"Roobie",
"Ryan Williams",
"Sachit Nagpal",
"Solara570",
"Stevie Metke",
"Tal Einav",
"Ted Suzman",
"Thomas Tarler",
"Tom Fleming",
"Valeriy Skobelev",
"Xavier Bernard",
"Yavor Ivanov",
"Yaw Etse",
"YinYangBalance.Asia",
"Zach Cardwell",
],
}

View File

@@ -1,303 +0,0 @@
from manimlib.imports import *
from active_projects.diffyq.part2.heat_equation import *
class ShowNewRuleAtDiscreteBoundary(DiscreteSetup):
CONFIG = {
"axes_config": {
"x_min": 0,
"stroke_width": 1,
"x_axis_config": {
"include_tip": False,
},
},
"freq_amplitude_pairs": [
(1, 0.5),
(2, 1),
(3, 0.5),
(4, 0.3),
],
"v_line_class": DashedLine,
"v_line_config": {
},
"step_size": 1,
"wait_time": 15,
"alpha": 0.25,
}
def construct(self):
self.add_axes()
self.set_points()
self.show_boundary_point_influenced_by_neighbor()
self.add_clock()
self.let_evolve()
def set_points(self):
axes = self.axes
for mob in axes.family_members_with_points():
if isinstance(mob, Line):
mob.set_stroke(width=1)
step_size = self.step_size
xs = np.arange(
axes.x_min,
axes.x_max + step_size,
step_size
)
dots = self.dots = self.get_dots(axes, xs)
self.v_lines = self.get_v_lines(dots)
self.rod_pieces = self.get_rod_pieces(dots)
# rod_pieces
self.add(self.dots)
self.add(self.v_lines)
self.add(self.rod_pieces)
def show_boundary_point_influenced_by_neighbor(self):
dots = self.dots
ld = dots[0]
ld_in = dots[1]
rd = dots[-1]
rd_in = dots[-2]
v_len = 0.75
l_arrow = Vector(v_len * LEFT)
l_arrow.move_to(ld.get_left(), RIGHT)
r_arrow = Vector(v_len * RIGHT)
r_arrow.move_to(rd.get_right(), LEFT)
arrows = VGroup(l_arrow, r_arrow)
q_marks = VGroup(*[
TexMobject("?").scale(1.5).next_to(
arrow, arrow.get_vector()
)
for arrow in arrows
])
arrows.set_color(YELLOW)
q_marks.set_color(YELLOW)
blocking_rects = VGroup(*[
BackgroundRectangle(VGroup(
*dots[i:-i],
*self.rod_pieces[i:-i]
))
for i in [1, 2]
])
for rect in blocking_rects:
rect.stretch(1.1, dim=1, about_edge=UP)
self.play(FadeIn(blocking_rects[0]))
self.play(
LaggedStartMap(ShowCreation, arrows),
LaggedStart(*[
FadeInFrom(q_mark, -arrow.get_vector())
for q_mark, arrow in zip(q_marks, arrows)
]),
run_time=1.5
)
self.wait()
# Point to inward neighbor
new_arrows = VGroup(*[
Arrow(
d1.get_center(),
VGroup(d1, d2).get_center(),
buff=0,
).match_style(l_arrow)
for d1, d2 in [(ld, ld_in), (rd, rd_in)]
])
new_arrows.match_style(arrows)
l_brace = Brace(VGroup(ld, ld_in), DOWN)
r_brace = Brace(VGroup(rd, rd_in), DOWN)
braces = VGroup(l_brace, r_brace)
for brace in braces:
brace.align_to(
self.axes.x_axis.get_center(), UP
)
brace.shift(SMALL_BUFF * DOWN)
brace.add(brace.get_tex("\\Delta x"))
self.play(
ReplacementTransform(arrows, new_arrows),
FadeOut(q_marks),
ReplacementTransform(*blocking_rects)
)
self.wait()
self.play(FadeInFrom(braces, UP))
self.wait()
self.play(
FadeOut(new_arrows),
FadeOut(blocking_rects[1]),
FadeOut(braces),
)
def add_clock(self):
super().add_clock()
self.time_label.add_updater(
lambda d, dt: d.increment_value(dt)
)
VGroup(
self.clock,
self.time_label
).shift(2 * LEFT)
def let_evolve(self):
dots = self.dots
dots.add_updater(self.update_dots)
wait_time = self.wait_time
self.play(
ClockPassesTime(
self.clock,
run_time=wait_time,
hours_passed=wait_time,
),
)
#
def get_dots(self, axes, xs):
dots = VGroup(*[
Dot(axes.c2p(x, self.temp_func(x, 0)))
for x in xs
])
max_width = 0.8 * self.step_size
for dot in dots:
dot.add_updater(self.update_dot_color)
if dot.get_width() > max_width:
dot.set_width(max_width)
return dots
def get_v_lines(self, dots):
return always_redraw(lambda: VGroup(*[
self.get_v_line(dot)
for dot in dots
]))
def get_v_line(self, dot):
x_axis = self.axes.x_axis
bottom = dot.get_bottom()
x = x_axis.p2n(bottom)
proj_point = x_axis.n2p(x)
return self.v_line_class(
proj_point, bottom,
**self.v_line_config,
)
def get_rod_pieces(self, dots):
axis = self.axes.x_axis
factor = 1 - np.exp(-(0.8 / self.step_size)**2)
width = factor * self.step_size
pieces = VGroup()
for dot in dots:
piece = Line(ORIGIN, width * RIGHT)
piece.set_stroke(width=5)
piece.move_to(dot)
piece.set_y(axis.get_center()[1])
piece.dot = dot
piece.add_updater(
lambda p: p.match_color(p.dot)
)
pieces.add(piece)
return pieces
def update_dot_color(self, dot):
y = self.axes.y_axis.p2n(dot.get_center())
dot.set_color(self.y_to_color(y))
def update_dots(self, dots, dt):
for ds in zip(dots, dots[1:], dots[2:]):
points = [d.get_center() for d in ds]
x0, x1, x2 = [p[0] for p in points]
dx = x1 - x0
y0, y1, y2 = [p[1] for p in points]
self.update_dot(
dot=ds[1],
dt=dt,
mean_diff=0.5 * (y2 - 2 * y1 + y0) / dx
)
if ds[0] is dots[0]:
self.update_dot(
dot=ds[0],
dt=dt,
mean_diff=(y1 - y0) / dx
)
elif ds[-1] is dots[-1]:
self.update_dot(
dot=ds[-1],
dt=dt,
mean_diff=(y1 - y2) / dx
)
def update_dot(self, dot, dt, mean_diff):
dot.shift(mean_diff * self.alpha * dt * UP)
class DiscreteEvolutionPoint25(ShowNewRuleAtDiscreteBoundary):
CONFIG = {
"step_size": 0.25,
"alpha": 0.5,
"wait_time": 30,
}
def construct(self):
self.add_axes()
self.set_points()
self.add_clock()
self.let_evolve()
class DiscreteEvolutionPoint1(DiscreteEvolutionPoint25):
CONFIG = {
"step_size": 0.1,
"v_line_config": {
"stroke_width": 1,
},
"wait_time": 30,
}
class FlatEdgesForDiscreteEvolution(DiscreteEvolutionPoint1):
CONFIG = {
"wait_time": 20,
"step_size": 0.1,
}
def let_evolve(self):
lines = VGroup(*[
Line(LEFT, RIGHT)
for x in range(2)
])
lines.set_width(1.5)
lines.set_stroke(WHITE, 5, opacity=0.5)
lines.add_updater(self.update_lines)
turn_animation_into_updater(
ShowCreation(lines, run_time=2)
)
self.add(lines)
super().let_evolve()
def update_lines(self, lines):
dots = self.dots
for line, dot in zip(lines, [dots[0], dots[-1]]):
line.move_to(dot)
class FlatEdgesForDiscreteEvolutionTinySteps(FlatEdgesForDiscreteEvolution):
CONFIG = {
"step_size": 0.025,
"wait_time": 10,
"v_line_class": Line,
"v_line_config": {
"stroke_opacity": 0.5,
}
}

View File

@@ -1,175 +0,0 @@
from manimlib.imports import *
from active_projects.diffyq.part2.wordy_scenes import *
class IveHeardOfThis(TeacherStudentsScene):
def construct(self):
point = VectorizedPoint()
point.move_to(3 * RIGHT + 2 * UP)
self.student_says(
"I've heard\\\\", "of this!",
student_index=1,
target_mode="hooray",
bubble_kwargs={
"height": 3,
"width": 3,
"direction": RIGHT,
},
run_time=1,
)
self.change_student_modes(
"thinking", "hooray", "thinking",
look_at_arg=point,
added_anims=[self.teacher.change, "happy"]
)
self.wait(3)
self.student_says(
"But who\\\\", "cares?",
student_index=1,
target_mode="maybe",
bubble_kwargs={
"direction": RIGHT,
"width": 3,
"height": 3,
},
run_time=1,
)
self.change_student_modes(
"pondering", "maybe", "pondering",
look_at_arg=point,
added_anims=[self.teacher.change, "guilty"]
)
self.wait(5)
class InFouriersShoes(PiCreatureScene, WriteHeatEquationTemplate):
def construct(self):
randy = self.pi_creature
fourier = ImageMobject("Joseph Fourier")
fourier.set_height(4)
fourier.next_to(randy, RIGHT, LARGE_BUFF)
fourier.align_to(randy, DOWN)
equation = self.get_d1_equation()
equation.next_to(fourier, UP, MED_LARGE_BUFF)
decades = list(range(1740, 2040, 20))
time_line = NumberLine(
x_min=decades[0],
x_max=decades[-1],
tick_frequency=1,
tick_size=0.05,
longer_tick_multiple=4,
unit_size=0.2,
numbers_with_elongated_ticks=decades,
numbers_to_show=decades,
decimal_number_config={
"group_with_commas": False,
},
stroke_width=2,
)
time_line.add_numbers()
time_line.move_to(ORIGIN, RIGHT)
time_line.to_edge(UP)
triangle = ArrowTip(start_angle=-90 * DEGREES)
triangle.set_height(0.25)
triangle.move_to(time_line.n2p(2019), DOWN)
triangle.set_color(WHITE)
self.play(FadeInFrom(fourier, 2 * LEFT))
self.play(randy.change, "pondering")
self.wait()
self.play(
DrawBorderThenFill(triangle, run_time=1),
FadeInFromDown(equation),
FadeIn(time_line),
)
self.play(
Animation(triangle),
ApplyMethod(
time_line.shift,
time_line.n2p(2019) - time_line.n2p(1822),
run_time=5
),
)
self.wait()
class SineCurveIsUnrealistic(TeacherStudentsScene):
def construct(self):
self.student_says(
"But that would\\\\never happen!",
student_index=1,
bubble_kwargs={
"direction": RIGHT,
"height": 3,
"width": 4,
},
target_mode="angry"
)
self.change_student_modes(
"guilty", "angry", "hesitant",
added_anims=[
self.teacher.change, "tease"
]
)
self.wait(3)
self.play(
RemovePiCreatureBubble(self.students[1]),
self.teacher.change, "raise_right_hand"
)
self.change_all_student_modes(
"pondering",
look_at_arg=3 * UP,
)
self.wait(5)
class IfOnly(TeacherStudentsScene):
def construct(self):
self.teacher_says(
"If only!",
target_mode="angry"
)
self.change_all_student_modes(
"confused",
look_at_arg=self.screen
)
self.wait(3)
class SoWeGotNowhere(TeacherStudentsScene):
def construct(self):
self.student_says(
"So we've gotten\\\\nowhere!",
target_mode="angry",
added_anims=[
self.teacher.change, "guilty"
]
)
self.change_all_student_modes("angry")
self.wait()
text = TexMobject(
"&\\text{Actually,}\\\\",
"&\\sin\\left({x}\\right)"
"e^{-\\alpha {t}}\\\\",
"&\\text{isn't far off.}",
tex_to_color_map={
"{x}": GREEN,
"{t}": YELLOW,
}
)
text.scale(0.8)
self.teacher_says(
text,
content_introduction_class=FadeIn,
bubble_kwargs={
"width": 4,
"height": 3.5,
}
)
self.change_all_student_modes(
"pondering",
look_at_arg=self.screen
)
self.wait(3)

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,919 +0,0 @@
from manimlib.imports import *
from active_projects.diffyq.part2.wordy_scenes import *
class ThreeMainObservations(Scene):
def construct(self):
fourier = ImageMobject("Joseph Fourier")
name = TextMobject("Joseph Fourier")
name.match_width(fourier)
name.next_to(fourier, DOWN, SMALL_BUFF)
fourier.add(name)
fourier.set_height(5)
fourier.to_corner(DR)
fourier.shift(LEFT)
bubble = ThoughtBubble(
direction=RIGHT,
height=3,
width=4,
)
bubble.move_tip_to(fourier.get_corner(UL) + 0.5 * DR)
observations = VGroup(
TextMobject(
"1)",
"Sine = Nice",
),
TextMobject(
"2)",
"Linearity"
),
TextMobject(
"3)",
"Fourier series"
),
)
# heart = SuitSymbol("hearts")
# heart.replace(observations[0][2])
# observations[0][2].become(heart)
# observations[0][1].add(happiness)
# observations[2][2].align_to(
# observations[2][1], LEFT,
# )
observations.arrange(
DOWN,
aligned_edge=LEFT,
buff=2 * LARGE_BUFF,
)
observations.set_height(FRAME_HEIGHT - 2)
observations.to_corner(UL, buff=LARGE_BUFF)
self.add(fourier)
self.play(ShowCreation(bubble))
self.wait()
self.play(LaggedStart(*[
TransformFromCopy(bubble, observation[0])
for observation in observations
], lag_ratio=0.2))
self.play(
FadeOut(fourier),
FadeOut(bubble),
)
self.wait()
for obs in observations:
self.play(FadeInFrom(obs[1], LEFT))
self.wait()
class LastChapterWrapper(Scene):
def construct(self):
full_rect = FullScreenFadeRectangle(
fill_color=DARK_GREY,
fill_opacity=1,
)
rect = ScreenRectangle(height=6)
rect.set_stroke(WHITE, 2)
rect.set_fill(BLACK, 1)
title = TextMobject("Last chapter")
title.scale(2)
title.to_edge(UP)
rect.next_to(title, DOWN)
self.add(full_rect)
self.play(
FadeIn(rect),
Write(title, run_time=2),
)
self.wait()
class ThreeConstraints(WriteHeatEquationTemplate):
def construct(self):
self.cross_out_solving()
self.show_three_conditions()
def cross_out_solving(self):
equation = self.get_d1_equation()
words = TextMobject("Solve this equation")
words.to_edge(UP)
equation.next_to(words, DOWN)
cross = Cross(words)
self.add(words, equation)
self.wait()
self.play(ShowCreation(cross))
self.wait()
self.equation = equation
self.to_remove = VGroup(words, cross)
def show_three_conditions(self):
equation = self.equation
to_remove = self.to_remove
title = TexMobject(
"\\text{Constraints }"
"T({x}, {t})"
"\\text{ must satisfy:}",
**self.tex_mobject_config
)
title.to_edge(UP)
items = VGroup(
TextMobject("1)", "The PDE"),
TextMobject("2)", "Boundary condition"),
TextMobject("3)", "Initial condition"),
)
items.scale(0.7)
items.arrange(RIGHT, buff=LARGE_BUFF)
items.set_width(FRAME_WIDTH - 2)
items.next_to(title, DOWN, LARGE_BUFF)
items[1].set_color(MAROON_B)
items[2].set_color(RED)
bc_paren = TextMobject("(Explained soon)")
bc_paren.scale(0.7)
bc_paren.next_to(items[1], DOWN)
self.play(
FadeInFromDown(title),
FadeOutAndShift(to_remove, UP),
equation.scale, 0.6,
equation.next_to, items[0], DOWN,
equation.shift_onto_screen,
LaggedStartMap(FadeIn, [
items[0],
items[1][0],
items[2][0],
])
)
self.wait()
self.play(Write(items[1][1]))
bc_paren.match_y(equation)
self.play(FadeInFrom(bc_paren, UP))
self.wait(2)
self.play(Write(items[2][1]))
self.wait(2)
self.title = title
self.items = items
self.pde = equation
self.bc_paren = bc_paren
class RectAroundEquation(WriteHeatEquationTemplate):
def construct(self):
eq = self.get_d1_equation()
self.play(ShowCreationThenFadeAround(eq))
class BorderRect(Scene):
def construct(self):
rect = FullScreenFadeRectangle()
rect.set_stroke(WHITE, 3)
rect.set_fill(opacity=0)
self.add(rect)
class SeekIdealized(Scene):
def construct(self):
phrases = VGroup(*[
TextMobject(
"Seek", text, "problems",
tex_to_color_map={
"realistic": GREEN,
"{idealized}": YELLOW,
"over-idealized": YELLOW,
"general": BLUE,
}
)
for text in [
"realistic",
"{idealized}",
"over-idealized",
"general",
]
])
phrases.scale(2)
words = VGroup()
for phrase in phrases:
phrase.center()
word = phrase[1]
words.add(word)
phrase.remove(word)
arrow = Vector(DOWN)
arrow.set_stroke(WHITE, 6)
arrow.next_to(words[3], UP)
low_arrow = arrow.copy()
low_arrow.next_to(words[3], DOWN)
solutions = TextMobject("solutions")
solutions.scale(2)
solutions.move_to(phrases[3][1], UL)
models = TextMobject("models")
models.scale(2)
models.next_to(
words[0], RIGHT, buff=0.35,
aligned_edge=DOWN
)
phrases.center()
phrase = phrases[0]
self.add(phrase)
self.add(words[0])
self.wait()
words[0].save_state()
self.play(
words[0].to_edge, DOWN,
words[0].set_opacity, 0.5,
Transform(phrase, phrases[1]),
FadeInFrom(words[1], UP)
)
self.wait()
# self.play(
# words[1].move_to, words[2], RIGHT,
# FadeIn(words[2]),
# Transform(phrase, phrases[2])
# )
# self.wait()
self.play(
words[1].next_to, arrow, UP,
ShowCreation(arrow),
MaintainPositionRelativeTo(
phrase, words[1]
),
FadeInFrom(solutions, LEFT),
FadeIn(words[3]),
)
self.wait()
words[0].generate_target()
words[0].target.next_to(low_arrow, DOWN)
words[0].target.set_opacity(1)
models.shift(
words[0].target.get_center() -
words[0].saved_state.get_center()
)
self.play(
MoveToTarget(words[0]),
ShowCreation(low_arrow),
FadeInFrom(models, LEFT)
)
self.wait()
class SecondDerivativeOfSine(Scene):
def construct(self):
equation = TexMobject(
"{d^2 \\over d{x}^2}",
"\\cos\\left({x}\\right) =",
"-\\cos\\left({x}\\right)",
tex_to_color_map={
"{x}": GREEN,
}
)
self.add(equation)
class EquationAboveSineAnalysis(WriteHeatEquationTemplate):
def construct(self):
equation = self.get_d1_equation()
equation.to_edge(UP)
equation.shift(2 * LEFT)
eq_index = equation.index_of_part_by_tex("=")
lhs = equation[:eq_index]
eq = equation[eq_index]
rhs = equation[eq_index + 1:]
t_terms = equation.get_parts_by_tex("{t}")[1:]
t_terms.save_state()
zeros = VGroup(*[
TexMobject("0").replace(t, dim_to_match=1)
for t in t_terms
])
zeros.align_to(t_terms, DOWN)
new_rhs = TexMobject(
"=", "-\\alpha \\cdot {T}", "({x}, 0)",
**self.tex_mobject_config
)
# new_rhs.move_to(equation.get_right())
# new_rhs.next_to(equation, DOWN, MED_LARGE_BUFF)
# new_rhs.align_to(eq, LEFT)
new_rhs.next_to(equation, RIGHT)
new_rhs.shift(SMALL_BUFF * DOWN)
self.add(equation)
self.play(ShowCreationThenFadeAround(rhs))
self.wait()
self.play(
FadeOutAndShift(t_terms, UP),
FadeInFrom(zeros, DOWN),
)
t_terms.fade(1)
self.wait()
self.play(
# VGroup(equation, zeros).next_to,
# new_rhs, LEFT,
FadeIn(new_rhs),
)
self.wait()
self.play(
VGroup(
lhs[6:],
eq,
rhs,
new_rhs[0],
new_rhs[-3:],
zeros,
).fade, 0.5,
)
self.play(ShowCreationThenFadeAround(lhs[:6]))
self.play(ShowCreationThenFadeAround(new_rhs[1:-3]))
self.wait()
class ExpVideoWrapper(Scene):
def construct(self):
self.add(FullScreenFadeRectangle(
fill_color=DARKER_GREY,
fill_opacity=1,
))
screen = ImageMobject("eoc_chapter5_thumbnail")
screen.set_height(6)
rect = SurroundingRectangle(screen, buff=0)
rect.set_stroke(WHITE, 2)
screen.add(rect)
title = TextMobject("Need a refresher?")
title.scale(1.5)
title.to_edge(UP)
screen.next_to(title, DOWN)
screen.center()
self.play(
# FadeInFrom(title, LEFT),
FadeInFrom(screen, DOWN),
)
self.wait()
class ShowSinExpDerivatives(WriteHeatEquationTemplate):
CONFIG = {
"tex_mobject_config": {
"tex_to_color_map": {
"{0}": WHITE,
"\\partial": WHITE,
"=": WHITE,
}
}
}
def construct(self):
pde = self.get_d1_equation_without_inputs()
pde.to_edge(UP)
pde.generate_target()
new_rhs = TexMobject(
"=- \\alpha \\cdot T",
**self.tex_mobject_config,
)
new_rhs.next_to(pde, RIGHT)
new_rhs.align_to(pde.get_part_by_tex("alpha"), DOWN)
equation1 = TexMobject(
"T({x}, {0}) = \\sin\\left({x}\\right)",
**self.tex_mobject_config
)
equation2 = TexMobject(
"T({x}, {t}) = \\sin\\left({x}\\right)",
"e^{-\\alpha{t}}",
**self.tex_mobject_config
)
for eq in equation1, equation2:
eq.next_to(pde, DOWN, MED_LARGE_BUFF)
eq2_part1 = equation2[:len(equation1)]
eq2_part2 = equation2[len(equation1):]
# Rectangles
exp_rect = SurroundingRectangle(eq2_part2)
exp_rect.set_stroke(RED, 3)
sin_rect = SurroundingRectangle(
eq2_part1[-3:]
)
sin_rect.set_color(BLUE)
VGroup(pde.target, new_rhs).center().to_edge(UP)
# Show proposed solution
self.add(pde)
self.add(equation1)
self.wait()
self.play(
MoveToTarget(pde),
FadeInFrom(new_rhs, LEFT)
)
self.wait()
self.play(
ReplacementTransform(equation1, eq2_part1),
FadeIn(eq2_part2),
)
self.play(ShowCreation(exp_rect))
self.wait()
self.play(FadeOut(exp_rect))
# Take partial derivatives wrt x
q_mark = TexMobject("?")
q_mark.next_to(pde.get_part_by_tex("="), UP)
q_mark.set_color(RED)
arrow1 = Vector(3 * DOWN + 1 * RIGHT, color=WHITE)
arrow1.scale(1.2 / arrow1.get_length())
arrow1.next_to(
eq2_part2.get_corner(DL),
DOWN, MED_LARGE_BUFF
)
ddx_label1 = TexMobject(
"\\partial \\over \\partial {x}",
**self.tex_mobject_config,
)
ddx_label1.scale(0.7)
ddx_label1.next_to(
arrow1.point_from_proportion(0.8),
UR, SMALL_BUFF
)
pde_ddx = VGroup(
*pde.get_parts_by_tex("\\partial")[2:],
pde.get_parts_by_tex("\\over")[1],
pde.get_part_by_tex("{x}"),
)
pde_ddx_rect = SurroundingRectangle(pde_ddx)
pde_ddx_rect.set_color(GREEN)
eq2_part2_rect = SurroundingRectangle(eq2_part2)
dx = TexMobject(
"\\cos\\left({x}\\right)", "e^{-\\alpha {t}}",
**self.tex_mobject_config
)
ddx = TexMobject(
"-\\sin\\left({x}\\right)", "e^{-\\alpha {t}}",
**self.tex_mobject_config
)
dx.next_to(arrow1, DOWN)
dx.align_to(eq2_part2, RIGHT)
x_shift = arrow1.get_end()[0] - arrow1.get_start()[0]
x_shift *= 2
dx.shift(x_shift * RIGHT)
arrow2 = arrow1.copy()
arrow2.next_to(dx, DOWN)
arrow2.shift(MED_SMALL_BUFF * RIGHT)
dx_arrows = VGroup(arrow1, arrow2)
ddx_label2 = ddx_label1.copy()
ddx_label2.shift(
arrow2.get_center() - arrow1.get_center()
)
ddx.next_to(arrow2, DOWN)
ddx.align_to(eq2_part2, RIGHT)
ddx.shift(2 * x_shift * RIGHT)
rhs = equation2[-6:]
self.play(
FadeInFromDown(q_mark)
)
self.play(
ShowCreation(pde_ddx_rect)
)
self.wait()
self.play(
LaggedStart(
GrowArrow(arrow1),
GrowArrow(arrow2),
),
TransformFromCopy(
pde_ddx[0], ddx_label1
),
TransformFromCopy(
pde_ddx[0], ddx_label2
),
)
self.wait()
self.play(
TransformFromCopy(rhs, dx)
)
self.wait()
self.play(
FadeIn(eq2_part2_rect)
)
self.play(
Transform(
eq2_part2_rect,
SurroundingRectangle(dx[-3:])
)
)
self.play(
FadeOut(eq2_part2_rect)
)
self.wait()
self.play(
TransformFromCopy(dx, ddx)
)
self.play(
FadeIn(
SurroundingRectangle(ddx).match_style(
pde_ddx_rect
)
)
)
self.wait()
# Take partial derivative wrt t
pde_ddt = pde[:pde.index_of_part_by_tex("=") - 1]
pde_ddt_rect = SurroundingRectangle(pde_ddt)
dt_arrow = Arrow(
arrow1.get_start(),
arrow2.get_end() + RIGHT,
buff=0
)
dt_arrow.flip(UP)
dt_arrow.next_to(dx_arrows, LEFT, MED_LARGE_BUFF)
dt_label = TexMobject(
"\\partial \\over \\partial {t}",
**self.tex_mobject_config,
)
dt_label.scale(1)
dt_label.next_to(
dt_arrow.get_center(), UL,
SMALL_BUFF,
)
rhs_copy = rhs.copy()
rhs_copy.next_to(dt_arrow.get_end(), DOWN)
rhs_copy.shift(MED_LARGE_BUFF * LEFT)
rhs_copy.match_y(ddx)
minus_alpha_in_exp = rhs_copy[-3][1:].copy()
minus_alpha_in_exp.set_color(RED)
minus_alpha = TexMobject("-\\alpha")
minus_alpha.next_to(rhs_copy, LEFT)
minus_alpha.align_to(rhs_copy[0][0], DOWN)
dot = TexMobject("\\cdot")
dot.move_to(midpoint(
minus_alpha.get_right(),
rhs_copy.get_left(),
))
self.play(
TransformFromCopy(
pde_ddx_rect,
pde_ddt_rect,
)
)
self.play(
GrowArrow(dt_arrow),
TransformFromCopy(
pde_ddt,
dt_label,
)
)
self.wait()
self.play(TransformFromCopy(rhs, rhs_copy))
self.play(FadeIn(minus_alpha_in_exp))
self.play(
ApplyMethod(
minus_alpha_in_exp.replace, minus_alpha,
path_arc=TAU / 4
),
FadeIn(dot),
)
self.play(
FadeIn(minus_alpha),
FadeOut(minus_alpha_in_exp),
)
self.wait()
rhs_copy.add(minus_alpha, dot)
self.play(
FadeIn(SurroundingRectangle(rhs_copy))
)
self.wait()
#
checkmark = TexMobject("\\checkmark")
checkmark.set_color(GREEN)
checkmark.move_to(q_mark, DOWN)
self.play(
FadeInFromDown(checkmark),
FadeOutAndShift(q_mark, UP)
)
self.wait()
class DerivativesOfLinearFunction(WriteHeatEquationTemplate):
CONFIG = {
"tex_mobject_config": {
"tex_to_color_map": {
"{c}": WHITE,
}
}
}
def construct(self):
func = TexMobject(
"T({x}, {t}) = {c} \\cdot {x}",
**self.tex_mobject_config
)
dx_T = TexMobject("{c}", **self.tex_mobject_config)
ddx_T = TexMobject("0")
dt_T = TexMobject("0")
for mob in func, dx_T, ddx_T, dt_T:
mob.scale(1.5)
func.generate_target()
arrows = VGroup(*[
Vector(1.5 * RIGHT, color=WHITE)
for x in range(3)
])
dx_arrows = arrows[:2]
dt_arrow = arrows[2]
dt_arrow.rotate(-TAU / 4)
dx_group = VGroup(
func.target,
dx_arrows[0],
dx_T,
dx_arrows[1],
ddx_T,
)
dx_group.arrange(RIGHT)
for arrow, char, vect in zip(arrows, "xxt", [UP, UP, RIGHT]):
label = TexMobject(
"\\partial \\over \\partial {%s}" % char,
**self.tex_mobject_config
)
label.scale(0.7)
label.next_to(arrow.get_center(), vect)
arrow.add(label)
dt_arrow.shift(
func.target[-3:].get_bottom() + MED_SMALL_BUFF * DOWN -
dt_arrow.get_start(),
)
dt_T.next_to(dt_arrow.get_end(), DOWN)
self.play(FadeInFromDown(func))
self.wait()
self.play(
MoveToTarget(func),
LaggedStartMap(Write, dx_arrows),
run_time=1,
)
self.play(
TransformFromCopy(func[-3:], dx_T),
path_arc=-TAU / 4,
)
self.play(
TransformFromCopy(dx_T, ddx_T),
path_arc=-TAU / 4,
)
self.wait()
# dt
self.play(Write(dt_arrow))
self.play(
TransformFromCopy(func[-3:], dt_T)
)
self.wait()
class FlatAtBoundaryWords(Scene):
def construct(self):
words = self.get_bc_words()
self.play(Write(words))
self.wait()
def get_bc_words(self):
return TextMobject(
"Flat at boundary\\\\"
"for all", "${t}$", "$> 0$",
)
class WriteOutBoundaryCondition(FlatAtBoundaryWords, ThreeConstraints, MovingCameraScene):
def construct(self):
self.force_skipping()
ThreeConstraints.construct(self)
self.revert_to_original_skipping_status()
self.add_ic()
self.write_bc_words()
self.write_bc_equation()
def add_ic(self):
image = ImageMobject("temp_initial_condition_example")
image.set_width(3)
border = SurroundingRectangle(image, buff=SMALL_BUFF)
border.shift(SMALL_BUFF * UP)
border.set_stroke(WHITE, 2)
group = Group(image, border)
group.next_to(self.items[2], DOWN)
self.add(group)
def write_bc_words(self):
bc_paren = self.bc_paren
bc_words = self.get_bc_words()
bc_words.match_width(self.items[1][1])
bc_words.move_to(bc_paren, UP)
bc_words.set_color_by_tex("{t}", YELLOW)
self.play(ShowCreationThenFadeAround(
VGroup(self.items[0], self.pde)
))
self.play(
FadeOutAndShift(bc_paren, UP),
FadeInFrom(bc_words, DOWN),
)
self.wait()
self.bc_words = bc_words
def write_bc_equation(self):
bc_words = self.bc_words
equation = TexMobject(
"{\\partial {T} \\over \\partial {x}}(0, {t}) = ",
"{\\partial {T} \\over \\partial {x}}(L, {t}) = ",
"0",
**self.tex_mobject_config,
)
equation.next_to(bc_words, DOWN, MED_LARGE_BUFF)
self.play(
self.camera_frame.shift, 0.8 * DOWN,
)
self.play(FadeInFrom(equation, UP))
self.wait()
class HeatEquationFrame(WriteHeatEquationTemplate):
def construct(self):
equation = self.get_d1_equation()
equation.to_edge(UP, buff=MED_SMALL_BUFF)
ddx = equation[-11:]
dt = equation[:11]
full_rect = FullScreenFadeRectangle(
fill_color=DARK_GREY,
fill_opacity=1,
)
smaller_rect = ScreenRectangle(
height=6,
fill_color=BLACK,
fill_opacity=1,
stroke_color=WHITE,
stroke_width=2,
)
smaller_rect.next_to(equation, DOWN)
self.add(full_rect)
self.add(smaller_rect)
self.add(equation)
self.wait()
self.play(ShowCreationThenFadeAround(
ddx,
surrounding_rectangle_config={
"stroke_color": GREEN,
}
))
self.wait()
self.play(ShowCreationThenFadeAround(dt))
self.wait()
class CompareFreqDecays1to2(Scene):
CONFIG = {
"freqs": [1, 2]
}
def construct(self):
background = FullScreenFadeRectangle(
fill_color=DARKER_GREY,
fill_opacity=1,
)
screens = VGroup(*[
ScreenRectangle(
height=4,
fill_color=BLACK,
fill_opacity=1,
stroke_width=1,
stroke_color=WHITE,
)
for x in range(2)
])
screens.arrange(RIGHT)
screens.set_width(FRAME_WIDTH - 1)
formulas = VGroup(*[
self.get_formula(freq)
for freq in self.freqs
])
for formula, screen in zip(formulas, screens):
formula.next_to(screen, UP)
self.add(background)
self.add(screens)
self.add(formulas)
self.wait()
def get_formula(self, freq):
f_str = str(freq)
return TexMobject(
"\\cos\\left(%s \\cdot {x}\\right)" % f_str,
"e^{-\\alpha \\cdot %s^2 \\cdot {t}}" % f_str,
tex_to_color_map={
"{x}": GREEN,
"{t}": YELLOW,
f_str: MAROON_B,
}
)
class CompareFreqDecays1to4(CompareFreqDecays1to2):
CONFIG = {
"freqs": [1, 4],
}
class CompareFreqDecays2to4(CompareFreqDecays1to2):
CONFIG = {
"freqs": [2, 4],
}
class WorryAboutGenerality(TeacherStudentsScene, WriteHeatEquationTemplate):
def construct(self):
eq = self.get_d1_equation()
diffyq = self.get_diffyq_set()
is_in = TexMobject("\\in")
is_in.scale(2)
group = VGroup(eq, is_in, diffyq)
group.arrange(RIGHT, buff=MED_LARGE_BUFF)
group.to_edge(UP)
arrow = Vector(DOWN)
arrow.set_stroke(WHITE, 5)
arrow.next_to(eq, DOWN)
themes = TextMobject("Frequent themes")
themes.scale(1.5)
themes.next_to(arrow, DOWN)
self.play(
self.get_student_changes(
"sad", "tired", "pleading"
),
self.teacher.change, "raise_right_hand",
FadeInFromDown(eq)
)
self.play(Write(group[1:]))
self.wait(2)
self.play(
ShowCreation(arrow),
self.get_student_changes(*3 * ["pondering"]),
)
self.play(
FadeInFrom(themes, UP),
self.get_student_changes(*3 * ["thinking"]),
self.teacher.change, "happy"
)
self.wait(4)
# def get_d1_equation(self):
# result = super().get_d1_equation()
# lp, rp = parens = TexMobject("(", ")")
# parens.match_height(result)
# lp.next_to(result, LEFT, SMALL_BUFF)
# rp.next_to(result, RIGHT, SMALL_BUFF)
# result.add_to_back(lp)
# result.add(rp)
# return result
def get_diffyq_set(self):
words = TextMobject(
"Differential\\\\equations"
)
words.scale(1.5)
words.set_color(BLUE)
lb = Brace(words, LEFT)
rb = Brace(words, RIGHT)
return VGroup(lb, words, rb)

View File

@@ -1,712 +0,0 @@
from manimlib.imports import *
class GeneralizeToComplexFunctions(Scene):
CONFIG = {
"axes_config": {
"x_min": 0,
"x_max": 10,
"x_axis_config": {
"stroke_width": 2,
},
"y_min": -2.5,
"y_max": 2.5,
"y_axis_config": {
"tick_frequency": 0.25,
"unit_size": 1.5,
"include_tip": False,
"stroke_width": 2,
},
},
"complex_plane_config": {
"axis_config": {
"unit_size": 2
}
},
}
def construct(self):
self.show_cosine_wave()
self.transition_to_complex_plane()
self.add_rotating_vectors_making_cos()
def show_cosine_wave(self):
axes = Axes(**self.axes_config)
axes.shift(2 * LEFT - axes.c2p(0, 0))
y_axis = axes.y_axis
y_labels = y_axis.get_number_mobjects(
*range(-2, 3),
number_config={"num_decimal_places": 1},
)
t_tracker = ValueTracker(0)
t_tracker.add_updater(lambda t, dt: t.increment_value(dt))
get_t = t_tracker.get_value
def func(x):
return 2 * np.cos(x)
cos_x_max = 20
cos_wave = axes.get_graph(func, x_max=cos_x_max)
cos_wave.set_color(YELLOW)
shown_cos_wave = cos_wave.copy()
shown_cos_wave.add_updater(
lambda m: m.pointwise_become_partial(
cos_wave, 0,
np.clip(get_t() / cos_x_max, 0, 1),
),
)
dot = Dot()
dot.set_color(PINK)
dot.add_updater(lambda d: d.move_to(
y_axis.n2p(func(get_t())),
))
h_line = always_redraw(lambda: Line(
dot.get_right(),
shown_cos_wave.get_end(),
stroke_width=1,
))
real_words = TextMobject(
"Real number\\\\output"
)
real_words.to_edge(LEFT)
real_words.shift(2 * UP)
real_arrow = Arrow()
real_arrow.add_updater(
lambda m: m.put_start_and_end_on(
real_words.get_corner(DR),
dot.get_center(),
).scale(0.9),
)
self.add(t_tracker)
self.add(axes)
self.add(y_labels)
self.add(shown_cos_wave)
self.add(dot)
self.add(h_line)
self.wait(2)
self.play(
FadeInFrom(real_words, RIGHT),
FadeIn(real_arrow),
)
self.wait(5)
y_axis.generate_target()
y_axis.target.rotate(-90 * DEGREES)
y_axis.target.center()
y_axis.target.scale(2 / 1.5)
y_labels.generate_target()
for label in y_labels.target:
label.next_to(
y_axis.target.n2p(label.get_value()),
DOWN, MED_SMALL_BUFF,
)
self.play(
FadeOut(shown_cos_wave),
FadeOut(axes.x_axis),
FadeOut(h_line),
)
self.play(
MoveToTarget(y_axis),
MoveToTarget(y_labels),
real_words.shift, 2 * RIGHT + UP,
)
self.wait()
self.y_axis = y_axis
self.y_labels = y_labels
self.real_words = real_words
self.real_arrow = real_arrow
self.dot = dot
self.t_tracker = t_tracker
def transition_to_complex_plane(self):
y_axis = self.y_axis
y_labels = self.y_labels
plane = self.get_complex_plane()
plane_words = plane.label
self.add(plane, *self.get_mobjects())
self.play(
FadeOut(y_labels),
FadeOut(y_axis),
ShowCreation(plane),
)
self.play(Write(plane_words))
self.wait()
self.plane = plane
self.plane_words = plane_words
def add_rotating_vectors_making_cos(self):
plane = self.plane
real_words = self.real_words
real_arrow = self.real_arrow
t_tracker = self.t_tracker
get_t = t_tracker.get_value
v1 = Vector(2 * RIGHT)
v2 = Vector(2 * RIGHT)
v1.set_color(BLUE)
v2.set_color(interpolate_color(GREY_BROWN, WHITE, 0.5))
v1.add_updater(
lambda v: v.set_angle(get_t())
)
v2.add_updater(
lambda v: v.set_angle(-get_t())
)
v1.add_updater(
lambda v: v.shift(plane.n2p(0) - v.get_start())
)
# Change?
v2.add_updater(
lambda v: v.shift(plane.n2p(0) - v.get_start())
)
ghost_v1 = v1.copy()
ghost_v1.set_opacity(0.5)
ghost_v1.add_updater(
lambda v: v.shift(
v2.get_end() - v.get_start()
)
)
ghost_v2 = v2.copy()
ghost_v2.set_opacity(0.5)
ghost_v2.add_updater(
lambda v: v.shift(
v1.get_end() - v.get_start()
)
)
circle = Circle(color=GREY_BROWN)
circle.set_stroke(width=1)
circle.set_width(2 * v1.get_length())
circle.move_to(plane.n2p(0))
formula = TexMobject(
# "\\cos(x) ="
# "{1 \\over 2}e^{ix} +"
# "{1 \\over 2}e^{-ix}",
"2\\cos(x) =",
"e^{ix}", "+", "e^{-ix}",
tex_to_color_map={
"e^{ix}": v1.get_color(),
"e^{-ix}": v2.get_color(),
}
)
formula.next_to(ORIGIN, UP, buff=0.75)
# formula.add_background_rectangle()
formula.set_stroke(BLACK, 3, background=True)
formula.to_edge(LEFT, buff=MED_SMALL_BUFF)
formula_brace = Brace(formula[1:], UP)
formula_words = formula_brace.get_text(
"Sum of\\\\rotations"
)
formula_words.set_stroke(BLACK, 3, background=True)
randy = Randolph()
randy.to_corner(DL)
randy.look_at(formula)
self.play(
FadeOut(real_words),
FadeOut(real_arrow),
)
self.play(
FadeIn(v1),
FadeIn(v2),
FadeIn(circle),
FadeIn(ghost_v1),
FadeIn(ghost_v2),
)
self.wait(3)
self.play(FadeInFromDown(formula))
self.play(
GrowFromCenter(formula_brace),
FadeIn(formula_words),
)
self.wait(2)
self.play(FadeIn(randy))
self.play(randy.change, "pleading")
self.play(Blink(randy))
self.wait()
self.play(randy.change, "confused")
self.play(Blink(randy))
self.wait()
self.play(FadeOut(randy))
self.wait(20)
#
def get_complex_plane(self):
plane = ComplexPlane(**self.complex_plane_config)
plane.add_coordinates()
plane.label = TextMobject("Complex plane")
plane.label.scale(1.5)
plane.label.to_corner(UR, buff=MED_SMALL_BUFF)
return plane
class ClarifyInputAndOutput(GeneralizeToComplexFunctions):
CONFIG = {
"input_space_rect_config": {
"stroke_color": WHITE,
"stroke_width": 1,
"fill_color": DARKER_GREY,
"fill_opacity": 1,
"width": 6,
"height": 2,
},
}
def construct(self):
self.setup_plane()
self.setup_input_space()
self.setup_input_trackers()
self.describe_input()
self.describe_output()
def setup_plane(self):
plane = self.get_complex_plane()
plane.sublabel = TextMobject("(Output space)")
plane.sublabel.add_background_rectangle()
plane.sublabel.next_to(plane.label, DOWN)
self.add(plane, plane.label)
self.plane = plane
def setup_input_space(self):
rect = Rectangle(**self.input_space_rect_config)
rect.to_corner(UL, buff=SMALL_BUFF)
input_line = self.get_input_line(rect)
input_words = TextMobject("Input space")
input_words.next_to(
rect.get_bottom(), UP,
SMALL_BUFF,
)
self.add(rect)
self.add(input_line)
self.input_rect = rect
self.input_line = input_line
self.input_words = input_words
def setup_input_trackers(self):
plane = self.plane
input_line = self.input_line
input_tracker = ValueTracker(0)
get_input = input_tracker.get_value
input_dot = Dot()
input_dot.set_color(PINK)
f_always(
input_dot.move_to,
lambda: input_line.n2p(get_input())
)
input_decimal = DecimalNumber()
input_decimal.scale(0.7)
always(input_decimal.next_to, input_dot, UP)
f_always(input_decimal.set_value, get_input)
path = self.get_path()
def get_output_point():
return path.point_from_proportion(
get_input()
)
output_dot = Dot()
output_dot.match_style(input_dot)
f_always(output_dot.move_to, get_output_point)
output_vector = Vector()
output_vector.set_color(WHITE)
output_vector.add_updater(
lambda v: v.put_start_and_end_on(
plane.n2p(0),
get_output_point()
)
)
output_decimal = DecimalNumber()
output_decimal.scale(0.7)
always(output_decimal.next_to, output_dot, UR, SMALL_BUFF)
f_always(
output_decimal.set_value,
lambda: plane.p2n(get_output_point()),
)
self.input_tracker = input_tracker
self.input_dot = input_dot
self.input_decimal = input_decimal
self.path = path
self.output_dot = output_dot
self.output_vector = output_vector
self.output_decimal = output_decimal
def describe_input(self):
input_tracker = self.input_tracker
self.play(FadeInFrom(self.input_words, UP))
self.play(
FadeInFromLarge(self.input_dot),
FadeIn(self.input_decimal),
)
for value in 1, 0:
self.play(
input_tracker.set_value, value,
run_time=2
)
self.wait()
def describe_output(self):
path = self.path
output_dot = self.output_dot
output_decimal = self.output_decimal
input_dot = self.input_dot
input_tracker = self.input_tracker
plane = self.plane
real_line = plane.x_axis.copy()
real_line.set_stroke(RED, 4)
real_words = TextMobject("Real number line")
real_words.next_to(ORIGIN, UP)
real_words.to_edge(RIGHT)
traced_path = TracedPath(output_dot.get_center)
traced_path.match_style(path)
self.play(
ShowCreation(real_line),
FadeInFrom(real_words, DOWN)
)
self.play(
FadeOut(real_line),
FadeOut(real_words),
)
self.play(
FadeInFrom(plane.sublabel, UP)
)
self.play(
FadeIn(output_decimal),
TransformFromCopy(input_dot, output_dot),
)
kw = {
"run_time": 10,
"rate_func": lambda t: smooth(t, 1),
}
self.play(
ApplyMethod(input_tracker.set_value, 1, **kw),
ShowCreation(path.copy(), remover=True, **kw),
)
self.add(path)
self.add(output_dot)
self.wait()
# Flatten to 1d
real_function_word = TextMobject(
"Real-valued function"
)
real_function_word.next_to(ORIGIN, DOWN, MED_LARGE_BUFF)
path.generate_target()
path.target.stretch(0, 1)
path.target.move_to(plane.n2p(0))
self.play(
FadeIn(real_function_word),
MoveToTarget(path),
)
input_tracker.set_value(0)
self.play(
input_tracker.set_value, 1,
**kw
)
#
def get_input_line(self, input_rect):
input_line = UnitInterval()
input_line.move_to(input_rect)
input_line.shift(0.25 * UP)
input_line.set_width(
input_rect.get_width() - 1
)
input_line.add_numbers(0, 0.5, 1)
return input_line
def get_path(self):
# mob = SVGMobject("BatmanLogo")
mob = TexMobject("\\pi")
path = mob.family_members_with_points()[0]
path.set_height(3.5)
path.move_to(2 * DOWN, DOWN)
path.set_stroke(YELLOW, 2)
path.set_fill(opacity=0)
return path
class GraphForFlattenedPi(ClarifyInputAndOutput):
CONFIG = {
"camera_config": {"background_color": DARKER_GREY},
}
def construct(self):
self.setup_plane()
plane = self.plane
self.remove(plane, plane.label)
path = self.get_path()
axes = Axes(
x_min=0,
x_max=1,
x_axis_config={
"unit_size": 7,
"include_tip": False,
"tick_frequency": 0.1,
},
y_min=-1.5,
y_max=1.5,
y_axis_config={
"include_tip": False,
"unit_size": 2.5,
"tick_frequency": 0.5,
},
)
axes.set_width(FRAME_WIDTH - 1)
axes.set_height(FRAME_HEIGHT - 1, stretch=True)
axes.center()
axes.x_axis.add_numbers(
0.5, 1.0,
number_config={"num_decimal_places": 1},
)
axes.y_axis.add_numbers(
-1.0, 1.0,
number_config={"num_decimal_places": 1},
)
def func(t):
return plane.x_axis.p2n(
path.point_from_proportion(t)
)
graph = axes.get_graph(func)
graph.set_color(PINK)
v_line = always_redraw(lambda: Line(
axes.x_axis.n2p(axes.x_axis.p2n(graph.get_end())),
graph.get_end(),
stroke_width=1,
))
self.add(axes)
self.add(v_line)
kw = {
"run_time": 10,
"rate_func": lambda t: smooth(t, 1),
}
self.play(ShowCreation(graph, **kw))
self.wait()
class SimpleComplexExponentExample(ClarifyInputAndOutput):
CONFIG = {
"input_space_rect_config": {
"width": 14,
"height": 1.5,
},
"input_line_config": {
"unit_size": 0.5,
"x_min": 0,
"x_max": 25,
"stroke_width": 2,
},
"input_numbers": range(0, 30, 5),
"input_tex_args": ["t", "="],
}
def construct(self):
self.setup_plane()
self.setup_input_space()
self.setup_input_trackers()
self.setup_output_trackers()
# Testing
time = self.input_line.x_max
self.play(
self.input_tracker.set_value, time,
run_time=time,
rate_func=linear,
)
def setup_plane(self):
plane = ComplexPlane()
plane.scale(2)
plane.add_coordinates()
plane.shift(DOWN)
self.plane = plane
self.add(plane)
def setup_input_trackers(self):
input_line = self.input_line
input_tracker = ValueTracker(0)
get_input = input_tracker.get_value
input_tip = ArrowTip(start_angle=-TAU / 4)
input_tip.scale(0.5)
input_tip.set_color(PINK)
f_always(
input_tip.move_to,
lambda: input_line.n2p(get_input()),
lambda: DOWN,
)
input_label = VGroup(
TexMobject(*self.input_tex_args),
DecimalNumber(),
)
input_label[0].set_color_by_tex("t", PINK)
input_label.scale(0.7)
input_label.add_updater(
lambda m: m.arrange(RIGHT, buff=SMALL_BUFF)
)
input_label.add_updater(
lambda m: m[1].set_value(get_input())
)
input_label.add_updater(
lambda m: m.next_to(input_tip, UP, SMALL_BUFF)
)
self.input_tracker = input_tracker
self.input_tip = input_tip
self.input_label = input_label
self.add(input_tip, input_label)
def setup_output_trackers(self):
plane = self.plane
get_input = self.input_tracker.get_value
def get_output():
return np.exp(complex(0, get_input()))
def get_output_point():
return plane.n2p(get_output())
output_label, static_output_label = [
TexMobject(
"e^{i t}" + s,
tex_to_color_map={"t": PINK},
background_stroke_width=3,
)
for s in ["", "\\approx"]
]
output_label.scale(1.2)
output_label.add_updater(
lambda m: m.shift(
-m.get_bottom() +
get_output_point() +
rotate_vector(
0.35 * RIGHT,
get_input(),
)
)
)
output_vector = Vector()
output_vector.set_opacity(0.75)
output_vector.add_updater(
lambda m: m.put_start_and_end_on(
plane.n2p(0), get_output_point(),
)
)
t_max = 40
full_output_path = ParametricFunction(
lambda t: plane.n2p(np.exp(complex(0, t))),
t_min=0,
t_max=t_max
)
output_path = VMobject()
output_path.set_stroke(YELLOW, 2)
output_path.add_updater(
lambda m: m.pointwise_become_partial(
full_output_path,
0, get_input() / t_max,
)
)
static_output_label.next_to(plane.c2p(1, 1), UR)
output_decimal = DecimalNumber(
include_sign=True,
)
output_decimal.scale(0.8)
output_decimal.set_stroke(BLACK, 3, background=True)
output_decimal.add_updater(
lambda m: m.set_value(get_output())
)
output_decimal.add_updater(
lambda m: m.next_to(
static_output_label,
RIGHT, 2 * SMALL_BUFF,
aligned_edge=DOWN,
)
)
self.add(output_path)
self.add(output_vector)
self.add(output_label)
self.add(static_output_label)
self.add(BackgroundRectangle(output_decimal))
self.add(output_decimal)
#
def get_input_line(self, input_rect):
input_line = NumberLine(**self.input_line_config)
input_line.move_to(input_rect)
input_line.set_width(
input_rect.get_width() - 1.5,
stretch=True,
)
input_line.add_numbers(*self.input_numbers)
return input_line
class TRangingFrom0To1(SimpleComplexExponentExample):
CONFIG = {
"input_space_rect_config": {
"width": 6,
"height": 2,
},
}
def construct(self):
self.setup_input_space()
self.setup_input_trackers()
self.play(
self.input_tracker.set_value, 1,
run_time=10,
rate_func=linear
)
def get_input_line(self, rect):
result = ClarifyInputAndOutput.get_input_line(self, rect)
result.stretch(0.9, 0)
result.set_stroke(width=2)
for sm in result.get_family():
if isinstance(sm, DecimalNumber):
sm.stretch(1 / 0.9, 0)
sm.set_stroke(width=0)
return result

File diff suppressed because it is too large Load Diff

View File

@@ -1,242 +0,0 @@
from manimlib.imports import *
from active_projects.diffyq.part4.fourier_series_scenes import ComplexFourierSeriesExample
from manimlib.once_useful_constructs.fractals import HilbertCurve
class FourierSeriesExampleWithRectForZoom(ComplexFourierSeriesExample):
CONFIG = {
"n_vectors": 100,
"slow_factor": 0.01,
"rect_scale_factor": 0.1,
"start_drawn": True,
"drawing_height": 7,
"rect_stroke_width": 1,
}
def construct(self):
self.add_vectors_circles_path()
self.circles.set_stroke(opacity=0.5)
rect = self.rect = self.get_rect()
rect.set_height(self.rect_scale_factor * FRAME_HEIGHT)
rect.add_updater(lambda m: m.move_to(
self.get_rect_center()
))
self.add(rect)
self.run_one_cycle()
def get_rect_center(self):
return center_of_mass([
v.get_end()
for v in self.vectors
])
def get_rect(self):
return ScreenRectangle(
color=BLUE,
stroke_width=self.rect_stroke_width,
)
class ZoomedInFourierSeriesExample(FourierSeriesExampleWithRectForZoom, MovingCameraScene):
CONFIG = {
"vector_config": {
"max_tip_length_to_length_ratio": 0.15,
"tip_length": 0.05,
},
"parametric_function_step_size": 0.001,
}
def setup(self):
ComplexFourierSeriesExample.setup(self)
MovingCameraScene.setup(self)
def get_rect(self):
return self.camera_frame
def add_vectors_circles_path(self):
super().add_vectors_circles_path()
for v in self.vectors:
if v.get_stroke_width() < 1:
v.set_stroke(width=1)
class ZoomedInFourierSeriesExample100x(ZoomedInFourierSeriesExample):
CONFIG = {
"vector_config": {
"max_tip_length_to_length_ratio": 0.15 * 0.4,
"tip_length": 0.05 * 0.2,
"max_stroke_width_to_length_ratio": 80,
"stroke_width": 3,
},
"max_circle_stroke_width": 0.5,
"rect_scale_factor": 0.01,
# "parametric_function_step_size": 0.01,
}
def get_rect_center(self):
return self.vectors[-1].get_end()
# def get_drawn_path(self, vectors, stroke_width=2, **kwargs):
# return self.get_path_end(vectors, stroke_width, **kwargs)
class TrebleClefFourierSeriesExampleWithRectForZoom(FourierSeriesExampleWithRectForZoom):
CONFIG = {
"file_name": "TrebleClef",
"drawn_path_stroke_width": 10,
}
class TrebleClefZoomedInFourierSeriesExample(ZoomedInFourierSeriesExample):
CONFIG = {
"file_name": "TrebleClef",
}
class NailAndGearFourierSeriesExampleWithRectForZoom(FourierSeriesExampleWithRectForZoom):
CONFIG = {
"file_name": "Nail_And_Gear",
"n_vectors": 200,
"drawn_path_color": "#39FF14",
}
class NailAndGearZoomedInFourierSeriesExample(ZoomedInFourierSeriesExample):
CONFIG = {
"file_name": "Nail_And_Gear",
"n_vectors": 200,
"drawn_path_color": "#39FF14",
}
class SigmaFourierSeriesExampleWithRectForZoom(FourierSeriesExampleWithRectForZoom):
CONFIG = {
"n_vectors": 200,
"drawn_path_color": PINK,
"rect_stroke_width": 0,
}
def get_shape(self):
return TexMobject("\\Sigma")
class SigmaZoomedInFourierSeriesExample(SigmaFourierSeriesExampleWithRectForZoom, ZoomedInFourierSeriesExample):
pass
class FourierOfFourier(FourierSeriesExampleWithRectForZoom):
CONFIG = {
"file_name": "FourierOneLine",
"n_vectors": 300,
"rect_stroke_width": 1,
}
class FourierOfFourierZoomedIn(ZoomedInFourierSeriesExample):
CONFIG = {
"file_name": "FourierOneLine",
"max_circle_stroke_width": 0.3,
"n_vectors": 300,
}
class FourierOfFourier100xZoom(ZoomedInFourierSeriesExample100x):
CONFIG = {
"file_name": "FourierOneLine",
"max_circle_stroke_width": 0.3,
"n_vectors": 300,
"slow_factor": 0.001,
}
def run_one_cycle(self):
self.vector_clock.set_value(0.3)
self.wait(40)
class FourierOfHilbert(FourierSeriesExampleWithRectForZoom):
CONFIG = {
"n_vectors": 300,
"rect_stroke_width": 1,
"drawn_path_stroke_width": 4,
"drawn_path_color": BLUE,
}
def get_path(self):
path = HilbertCurve(order=5)
path.set_height(self.drawing_height)
path.to_edge(DOWN)
combined_path = VMobject()
for sm in path.family_members_with_points():
combined_path.append_vectorized_mobject(sm)
start = combined_path.get_start()
end = combined_path.get_end()
points = [
interpolate(end, start, alpha)
for alpha in np.linspace(0, 1, 10)
]
for point in points:
combined_path.add_line_to(point)
combined_path.set_stroke(width=0)
return combined_path
class FourierOfHilbertZoomedIn(FourierOfHilbert, ZoomedInFourierSeriesExample):
pass
class FourierOfBritain(FourierSeriesExampleWithRectForZoom):
CONFIG = {
"file_name": "Britain",
"n_vectors": 500,
"drawn_path_color": RED,
}
class FourierOfBritainZoomedIn(FourierOfBritain, ZoomedInFourierSeriesExample):
pass
class FourierOfSeattle(FourierSeriesExampleWithRectForZoom):
CONFIG = {
"file_name": "SeattleSkyline",
"drawing_height": 7,
"n_vectors": 400,
"drawn_path_color": TEAL,
"drawn_path_stroke_width": 5,
}
class FourierOfSeattleZoomedIn(ZoomedInFourierSeriesExample):
CONFIG = {
"file_name": "SeattleSkyline",
"drawing_height": 7,
"n_vectors": 400,
"drawn_path_color": TEAL,
"drawn_path_stroke_width": 5,
"max_circle_stroke_width": 0.3,
}
class VideoWrapper(Scene):
def construct(self):
fade_rect = FullScreenFadeRectangle()
fade_rect.set_fill(DARK_GREY, 1)
screen_rect = ScreenRectangle()
screen_rect.set_height(4)
screen_rect.set_fill(BLACK, 1)
screen_rect.set_stroke(width=0)
boundary = AnimatedBoundary(screen_rect)
title = TextMobject("Learn the math")
title.scale(1.5)
title.next_to(screen_rect, UP)
self.add(fade_rect)
self.add(screen_rect)
self.add(boundary)
self.play(FadeInFromDown(title))
self.wait(19)

View File

@@ -1,235 +0,0 @@
from manimlib.imports import *
class WhyWouldYouCare(TeacherStudentsScene):
def construct(self):
self.student_says(
"Who cares!",
target_mode="sassy",
student_index=2,
added_anims=[self.teacher.change, "guilty"],
)
self.wait()
self.play(
RemovePiCreatureBubble(self.students[2]),
self.teacher.change, "raise_right_hand",
self.get_student_changes(
"pondering", "erm", "thinking",
look_at_arg=self.screen,
)
)
self.look_at(self.screen)
self.wait(5)
class SolveForWavesNothingElse(TeacherStudentsScene):
def construct(self):
self.student_says(
"Sure, we can\\\\solve it for\\\\sums of waves...",
target_mode="sassy",
student_index=2,
added_anims=[self.teacher.change, "guilty"]
)
self.change_student_modes("pondering", "pondering", "sassy")
self.look_at(self.screen)
self.wait(4)
self.student_says(
"But nothing else!",
target_mode="angry",
)
self.change_student_modes(
"concerned_musician",
"concerned_musician",
"angry",
)
self.wait(5)
class HangOnThere(TeacherStudentsScene):
def construct(self):
student = self.students[2]
axes1 = Axes(
x_min=0,
x_max=1,
y_min=-1.5,
y_max=1.5,
x_axis_config={
"tick_frequency": 0.25,
"include_tip": False,
"unit_size": 3,
},
y_axis_config={
"tick_frequency": 0.5,
"include_tip": False,
},
)
axes1.set_stroke(width=2)
axes2 = axes1.deepcopy()
neq = TexMobject("\\neq")
neq.scale(2)
group = VGroup(axes1, neq, axes2)
group.arrange(RIGHT)
group.set_height(4)
group.next_to(
student.get_corner(UL), UP,
buff=LARGE_BUFF,
)
step_graph = axes1.get_graph(
lambda x: (1 if x < 0.5 else -1),
discontinuities=[0.5],
)
step_graph.set_color(YELLOW)
wave_graphs = VGroup(*[
axes2.get_graph(
lambda x: (4 / PI) * np.sum([
(u / n) * np.cos(n * PI * x)
for u, n in zip(
it.cycle([1, -1]),
range(1, max_n, 2),
)
]),
)
for max_n in range(3, 103, 2)
])
wave_graphs.set_stroke(width=3)
wave_graphs.set_color_by_gradient(WHITE, PINK)
last_wave_graph = wave_graphs[-1]
last_wave_graph.set_stroke(PINK, 2)
wave_graphs.remove(last_wave_graph)
# wave_graphs[-1].set_stroke(width=3)
# wave_graphs[-1].set_stroke(BLACK, 5, background=True)
group.add(step_graph)
self.student_says(
"Hang on\\\\hang on\\\\hang on...",
target_mode="surprised",
content_introduction_class=FadeIn,
student_index=2,
added_anims=[
self.teacher.change, "guilty"
],
run_time=1,
)
self.wait()
self.play(
RemovePiCreatureBubble(
student,
target_mode="raise_left_hand",
look_at_arg=group,
),
FadeInFromDown(group),
)
last_wg = VectorizedPoint()
n_first_fades = 4
for wg in wave_graphs[:n_first_fades]:
self.play(
last_wg.set_stroke, {"width": 0.1},
FadeIn(wg),
)
last_wg = wg
self.play(
LaggedStart(
*[
UpdateFromAlphaFunc(
wg,
lambda m, a: m.set_stroke(
width=(3 * there_and_back(a) + 0.1 * a)
),
)
for wg in wave_graphs[n_first_fades:]
],
run_time=5,
lag_ratio=0.2,
),
ApplyMethod(
last_wg.set_stroke, {"width": 0.1},
run_time=0.25,
),
FadeIn(
last_wave_graph,
rate_func=squish_rate_func(smooth, 0.9, 1),
run_time=5,
),
self.teacher.change, "thinking",
)
self.change_student_modes(
"confused", "confused", "angry"
)
self.wait(3)
class YouSaidThisWasEasier(TeacherStudentsScene):
def construct(self):
self.change_all_student_modes(
"confused", look_at_arg=self.screen,
)
self.student_says(
"I'm sorry, you said\\\\this was easier?",
target_mode="sassy"
)
self.play(self.teacher.change, "guilty")
self.wait(3)
self.teacher_says(
"Bear with\\\\me",
bubble_kwargs={"height": 3, "width": 3},
)
self.look_at(self.screen)
self.wait(3)
class LooseWithLanguage(TeacherStudentsScene):
def construct(self):
terms = VGroup(
TextMobject("``Complex number''"),
TextMobject("``Vector''"),
)
colors = [YELLOW, BLUE]
for term, color in zip(terms, colors):
term.set_color(color)
terms.scale(1.5)
terms.arrange(DOWN, buff=LARGE_BUFF)
terms.to_edge(UP)
terms.match_x(self.students)
self.teacher_says(
"Loose with\\\\language",
bubble_kwargs={"width": 3, "height": 3},
run_time=2,
)
self.play(
FadeInFrom(terms[1], DOWN),
self.get_student_changes(
"thinking", "pondering", "erm",
look_at_arg=terms,
)
)
self.play(FadeInFromDown(terms[0]))
self.wait()
self.play(Swap(*terms))
self.wait(3)
class FormulaOutOfContext(TeacherStudentsScene):
def construct(self):
formula = TexMobject(
"c_{n} = \\int_0^1 e^{-2\\pi i {n} {t}}f({t}){dt}",
tex_to_color_map={
"{n}": YELLOW,
"{t}": PINK,
}
)
formula.scale(1.5)
formula.next_to(self.students, UP, LARGE_BUFF)
self.add(formula)
self.change_all_student_modes(
"horrified",
look_at_arg=formula,
)
self.play(self.teacher.change, "tease")
self.wait(3)

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More