Morpholib

Latest version: v0.10.0

Safety actively analyzes 682361 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 1 of 3

0.10.0

Changes
- Modifiers will no longer be called for invisible (`visible=False`) figures.
- `Actor.segment()` has been reworked.
+ `edgeInterp` argument was replaced with `seamless`, and both `seamless` and `rezero` have been turned into keyword-only arguments.
- Actor key slicing is now done in a Pythonic way.
+ `myactor.key[start:stop]` now excludes the `stop` index (like how Python slices normally work).
- Removed toplevel `alpha` attribute from Paragraph classes.
+ Overall `alpha` is now set/computed the same way as for other MultiFigures like `MultiImage` and `MultiText`.

New Features
- Implemented new `wiggle()` actor action to virtually all figures that support a `rotation` attribute.
- Implemented `move()` actor action for all Figure types.
+ Only works on positionable figures, i.e. ones that have a `pos` or `origin` attribute. It will fail for figures that lack these (e.g. Skits).
- Path and MultiPaths now support a `toSpline()` method to convert them (mostly) into equivalent Spline/MultiSpline figures.
+ Certain properties won't transfer, though, such as arrow tips since Splines do not support them.
- Implemented `nodes()` method for Splines that returns a list of all the nodes in the Spline.
- 2D Paragraph figures now support the `alignOrigin()` method.
- Added `fixedLengthDecimal()` function to `morpho.text` which converts a floating point number to a string with the specified number of decimal digits, appending zeros as necessary to keep a fixed number of decimal digits in the returned string.
- The `align` keyword of the `MultiSpline.replaceTex()` can now optionally be set to a special `morpho.GAUGE` value to align the replacing MultiSpline such that the specified `gauge` glyph remains in the same position after replacement.
+ Example: `mytex.replaceTex(newtex, gauge=r"\pi", align=morpho.GAUGE)`
will align the newly created LaTeX such that the first match to the `\pi` glyph will remain unmoved.
- Many alignable figures now support a new `placeOrigin()` method which updates the `origin/pos` attribute to a new value while leaving the original figure visually unchanged.
- Added `overdraw` attribute to the `Animation` class which when set to `True` disables per-frame screen refreshes.
- Added `convertWidthFrom()` and `convertHeightFrom()` methods to the `Camera` class.
+ These do the same thing as `convertWidth()` and `convertHeight()` but reverses the roles of `self` and `other`.
- Added numerical derivative function `derivative()` to `morpho.calculus`.
- Added `boxFromDiagonal()` function to `morpho.tools.basics` that returns the standard 4-item list `[xmin, xmax, ymin, ymax]` for a box given only the positions (as complex numbers) of two of its opposite corners.
- Added `concat()` function to `morpho.tools.basics` that returns a list concatenating all of the elements in a collection of sequences. Helpful when trying to concatenate sequences of differing types (e.g. concatenating a list with a tuple).
- Added `aslist()` function to `morpho.tools.basics`.
- Added `rotationNd()` function to `morpho.matrix` that computes an N-dimensional rotation matrix given two vectors and an angle.

Improvements
- Added `toType()` method to Frame class and subclasses that can be used to help convert one Frame type into another.
- The filler feature of `figureGrid()` can now be used even if a name dict is passed in to `figureGrid()`.
- The `gauge` input for `replaceTex()` can now optionally be a Spline/MultiSpline figure.
- The `stagger` or `substagger` keywords as part of multi-action calls now accept sequences of numbers instead of just single numbers.
- The `morphFrom()` actor action can now be used more widely on most MultiFigure actors.
- `fadeIn()` actor action for Frames now ensures visibility of selected subfigures.
+ This resolves an undesired behavior where using `fadeOut()` followed by `fadeIn()` would cause the final keyfigure to still be invisible since `fadeOut()` sets subfigure visibilities to False.
- Added `applyModifier()`, `actualize()`, and `actualized()` methods to all Figures which enable figures that are set as keyfigures of an actor to have their modifiers applied *before* draw time.
+ `applyModifier()` simply applies the current modifier to the keyfigure IN PLACE but does not reset the `modifier` attribute.
+ `actualize()` does `applyModifier()` and then resets the `modifier` attribute to `None`.
+ `actualized()` applies `actualize()` to a copy of the keyfigure and returns it, leaving the original keyfigure unchanged.
- Added `timeOffset` optional keyword to `Actor.insert()` method.
- The `domain` input for `colorPattern()` can now optionally be a figure/actor, whereby its bounding box (if it exists) will be used as the domain box.
- Slightly reworked `EllipticalArc` and `Pie` `toPath()` and `toPolygon()` methods to make all angular steps the same size, though they may not exactly equal the specified `dTheta` value anymore.
- `Frame.partition()` method can now accept `slice` objects.
- Added `tancolor` nontweenable attribute to `Spline` class which can be used to change the color of tangents shown when `showTangents` is set to `True`.
- The endpoints given to `windingAngle()` can now be reversed.

Bug Fixes
- Fixed a bug where an error would be thrown when attempting to draw an empty FancyFrame with a background box.
- Fixed a bug with Frame Actor splitting that would cause features like subactions to misbehave sometimes.
- Fixed a bug with changing the alignment of a Paragraph figure after construction.
- `MultiSpline3D.toPath()` now correctly outputs a `MultiPath3D` figure instead of a 2D `MultiPath` figure.
- Fixed a bug with the `now()` method in which the cache would not invalidate based on a mismatched `useModifier` value.
- `rezero()` now works even for Actors with empty timelines.
- Paths with outlined arrows drawn in the classic style now render correctly when non-trivial `transform` values are set.
- `Path.s_inv()` will no longer throw a ZeroDivision error when a value of `0` is passed in.
- `EllipticalArc` rendering is now done in a more orientation-consistent way, in which clockwise-oriented arcs will be actually be drawn clockwise. This could be an issue when drawing a clockwise arc with a dash pattern.
- Modifiers that modify a visible figure into an invisible one will now no longer be drawn.
- Fixed a bug with `wait()` where given a non-integer `timeOffset`, the delay could be ignored in animation playback.

0.9.0

Changes
- The `enbox()`, `crossout()`, and `encircle()` functions in `gadgets` now return path actors that are centered using the `origin` attribute by default.
- The `index` keyword parameter of `MultiSpline.fromsvg()` now behaves like the `select` parameter for subactions; it can be given an index, a slice, a filter function, or any combination of them.
- Path `popIn/Out()` actions now act with `focus=0` by default, and can be told to do it centered by passing in `align=[0,0]`.
- MultiFigure `subpool` parameter no longer stores a set of literal index values, and instead stores a list of indices, slices, and filter functions which are used to determine the actual index set at tween time.
- `MultiPath.commitTransforms()` only commits the toplevel transformations to the subpaths' transformations, but does not further commit the transformations of the subpaths.
- The behavior of `box(raw=True)` for all figures has been modified so that it takes no transformation attributes into account (not even `origin`).
- Numpy array constants found in `tools.basics` are now unwriteable.
- The opacity of paragraph background boxes is now capped at the maximum `alpha` value of its subfigures.
- `Frame.combine()` now accounts for toplevel `origin` value of the host Frame.

New Features
- `newkey()` and `newendkey()` now support an optional `instant` boolean keyword. If set to `True`, the keyfigure immediately preceding the newly created keyfigure will have its `static` attribute set to `True` so that it will jump instantly to the new keyfigure instead of tweening.
+ Note that this behavior is disabled if a keyfigure already exists at the frame specified.
- Added `cross()` function to `grid` and `shapes` to generate (but not animate) an X-shaped path.
- Added `slash()` to `grid` to generate a path representing one slash in an X.
- New `TransformableFrame` (a.k.a `TFrame`), `AlignableTFrame`, and `FancyFrame` classes added to `combo`.
+ New `subalignOrigin()` method of `AlignableTFrame` and `FancyFrame` allows one to align the origins of a subset of subfigures according to the bounding box of the *entire* subset.
- New `underline()` function in `text` adds special characters to a string so that it will be rendered with an underline.
+ Note the effect is imperfect, especially with spaces. Underlined text is still not really supported yet.
- `figureGrid()` can accept a figure as input to new `filler` keyword to specify a figure that will "fill out" the given figure list if the specified array dimensions are incompatible.
- New `dup()` method added to all figure types which behaves exactly like `copy()` except it does not copy over metasettings like `visible`, `static`, `tweenMethod`, `transition`, `modifier`, or `delay`. They will be set to their default values instead.
+ Using `dup()` instead of `copy()` can help prevent hard-to-track bugs from appearing in which a copied figure behaves unexpectedly because the copied figure had unexpected metasettings unrelated to its normal parameters.

Improvements
- `popIn/Out()` actor actions now scale stroke widths.
- Added `rectPath()` and `ellipsePath()` to `grid` and `shapes` which behave exactly like `rect()` and `grid.ellipse()` except they return the Polygon's edge as a `Path` instead of the whole polygon.
- Added `I2` and `I3` identity matrices as constants to `tools.basics`.
- `fromsvg()` can more faithfully import stroke widths from SVG's if given a Layer object as input.
- Added a new `gauge` keyword to `replaceTex()` method which makes it easier to preserve glyph sizes between the old and new LaTeX MultiSplines.
+ Usage example: `mytex.replaceTex(r"A = \pi r^2", gauge=r"\pi")`
The new MultiSpline replacing `mytex` will be rescaled so that the glyphs corresponding to the latex code `\pi` will be the same size.
- `latex.matches()` no longer has to have multiple targets packaged as a list, and can instead have them enumerated directly as additional arguments.
- A 3D MultiSpline generated from `latex.parse3d()` can be given default orientation by supplying `orientable=True` to it instead of passing in the default orientation matrix into `orient`.
- The `width`, `color`, and `fill` parameters of the `highlight()` action can now optionally be given `None` values to have `highlight()` leave those values unchanged.
- Various improvements to the `partition()` method of Frame-like classes.
+ It can now be supplied an optional `cls` keyword to change the Frame type used to contain the partition.
+ It can now accept filter functions.
+ Relative indices can now be used by passing in `relative=True`.
- Added `raw` optional keyword to `Frame.box()`.
- `seq` can now be used as an alias for `vertices` for Polygon figures.
- Added optional keyword input `transform` to `paragraph()`.


Bug Fixes
- Fixed bug in interpolating Paths/Splines containing deadends.
- Fixed bug with `SpaceArrow` initialization where `color` would be assigned `None` by default.
- `partition()` can now take a tuple as input.
- `MultiPath3D` now has the `rotation` and `transform` attributes it should and will perform transforms correctly if there is a mix of `orient` and transformation values.
- For Frame/MultiFigure `fadeIn()` action, the `alpha` parameter will now only affected `select`ed subfigures instead of all of them.
- Fixed a bug with subactions that could occur if the latest keyfigure of a Frame actor has more subfigures than a past keyfigure.
- `text.space()` will no longer be rendered as double periods when used as part of a `fadeIn()` action.

0.8.1

Changes
- The default stroke width used for the `drawIn()` Path action was changed from 3 to 2.
- Frame tweening now checks for equal subfigure counts and throws an error if attempting to tween two Frames of unequal subfigure counts.

New Features
- All figures now possess a `modifier` attribute which can be set to a function that will modify (a copy of) the figure at draw time, enabling an organic way for a figure's state to change dynamically based on another figure's state.
- Added `FigureArray` which is like `Frame` but can be used to more easily create and manipulate figures laid out in a grid pattern.
- Added new `roundedRect()` function to `morpho.shapes` that returns a Spline in the shape of an (approximate) rounded rectangle---that is, a rectangle with circular arc corners.
- Added `substagger` option to the `drawIn()` MultiPath/MultiSpline action enabling more control over the time offset in animating adjacent glyphs being drawn in in (for example) a LaTeX figure.
- Added `popIn()` and `popOut()` actions for Paths and Splines and their Multi variants.
- New `pulse()` action for Point figures which causes a point to grow and then shrink again. Useful for drawing the viewer's eye to the point.
- New `waitUntilSec()` Animation method acts like `waitUntil()` but the inputted target time is in units of seconds instead of frames.
- New `timelineCoord()` Animation method which converts true playback times into local animation timeline coordinates, taking into account any animation delays. Kind of like an inverse `seconds()` method.
- New `listselect()` function added to `morpho.tools.basics` which takes a list and a collection of indices or index slices and returns a dict mapping individual indices to list elements.

Improvements
- `Frame.merge()` can now take an optional `beforeFigure` parameter that functions similar to how `beforeActor` and `beforeLayer` work for `Layer.merge()` and `Animation.merge()`.
- `Frame.setName()` now returns the Frame instance that calls it.
- Frame figures (and their derivatives like MultiFigures) are now considered BoundingBoxFigures, and so support methods like `box()`, `left()`, `right()`, `center()`, etc.
+ Note that these methods will fail if the Frame contains any subfigures that are not BoundingBoxFigures.
- Added optional `select` parameter to `Frame` and `MultiFigure` fade actions as well as MultiPath/MultiSpline `drawIn()` action.
- Added optional `straight` keyword parameter to Spline's and SpaceSpline's `close()` method which if set to `False` closes the spline not with a straight line segment but according to the current state of its tangent handles.
- Added `dash` and `dashOffset` attributes to Point figures.
- Multiactions can now be run from unregistered actions.
+ Previously to apply an actor action across a list of actors, the action had to be named and registered so that it could be accessed via the command `morpho.action.actionname(actorlist, ...)`. But now this functionality is available to unregistered (e.g. user-made) actions via the syntax `morpho.action(mycustomaction, actorlist, ...)`
- Optimized subaction substaggering.
- Implemented a collective subaction command `morpho.subaction` analogous to `morpho.action`.
- Streamlined the interface for multiactions and multisubactions.
+ The collective action commands `morpho.action.actionname` and `morpho.subaction.actionname` should now work on any action that is "standard", meaning the action only affects an actor by possibly modifying its current final keyfigure and/or adding new keyfigures after it; i.e. they affect only the present and future of an actor, not its past. Essentially all built-in actions are "standard" and so will work with the collective action commands.
- The `highlight()` and `flourish()` actions are now available for vanilla (i.e. non-Multi) Paths and Splines.
- The `highlight()` and `flourish()` actions can now take an explicit `None` input for its `fill` parameter, which will prevent the actions from modifying the `fill` parameter.
- Implemented `toPolygon()` and `toPath()` for the Ellipse class.
- All BoundingBoxFigures now possess a `boxDimensions()` method that returns both box width *and* box height as a tuple.
- `finitizeDelays()` can now accept a delay value of zero.
- If `waitUntil()` and `waitUntilSec()` throw an error for trying to wait a negative amount of time, they now report the undershot time in seconds in addition to frames.
- Optimized Actor `now()` method with caching so it's more efficient if called multiple times at the same point on the timeline.

Bug Fixes
- Fixed a bug with setting subfigure names for MultiFigures.
- Fixed a bug with Frame `fadeOut()` action in which the final keyfigure may not be set to be invisible if `select` is used to select a proper subset of the subfigures.
- Fixed a bug with MultiFigure subactions where using it with no substaggering *nor* special selections resulted in transitions being ignored.

0.8.0

Changes
- Overhauled how `Frame` figures are tweened.
+ Subfigure transitions are now ignored, and the toplevel transition of the Frame figure is used for everything. This behavior can still be circumnavigated by incorporating transitions directly into subfigure tween methods via a new function `morpho.transitions.incorporateTransition()`.
- The `box()` methods for Images and Text now account for transformation attributes by default.
- Tween method splitters have been reworked.
+ Instead of taking only the tsplit value, they must now take three additional required inputs: `beg`, `mid`, and `fin` representing the three keyfigures involved in a split.
+ They also no longer should return the two halves of the split tween method, but instead modify the tween methods in place (via `beg`, `mid`, and `fin`).
+ This change will only affect you if you have defined custom splitters. If you haven't (or you don't know what that means), nothing will have changed for you.
- Assigning a value directly to the `figures` attribute of a `Frame`-like figure now automatically typecasts it into a python list.

New Features
- Frame and MultiFigure actors now support a `subaction` property that allows you to apply certain actor actions along subfigures as well as specifying a `substagger` parameter to control time offsets between them.
+ e.g. `multispline.subaction.growIn(30, substagger=5)`
+ The `substagger` option has been incorporated into `fadeIn()` and `fadeOut()`, meaning it is unnecessary (and also not recommended) to use `subaction` to apply those particular actions to subfigures.
+ You can also use `subaction` with unregistered actor actions by directly calling it with this syntax:
python
myfilm.subaction(myCustomAction, ...)

+ Note: This feature has only been designed to work for actions that only need access to the final keyfigure of an actor and only modifies the actor by appending new keyfigures to the end of its timeline. These include actions like `fadeIn/Out()` and `growIn()/shrinkOut()` but notably not `rollback()` since it needs access to the first keyfigure.
- Added `popIn/Out()` actions for the `Ellipse` class.
- Implemented new `Actor.zip()` static method that takes a list of actors and "zips" them into a single `Frame` actor (a.k.a. a "Film").
- Implemented `drawIn()` actor action for MultiPaths and MultiSplines which allow for the actor to be "drawn in" Manim-style.
+ It's still a bit experimental and not well tested yet, and the API may still change. Use at your own risk.
- Added `incorporateTransition()` function to `morpho.transitions` which directly incorporates a transition function into a tween method.
- `FlowField` now supports multiple different offsets.
- Added `atFrame` optional keyword to `wait()` method.

Improvements
- Added `tickOffset` attribute to the `Track` class and `mathaxes()`.
- Added `dash` attributes to the various Elliptical classes in `morpho.shapes`.
- `rect()` can now take an Actor/Figure as input at it will infer a box from its bounding box (if possible).
- The various box methods within `morpho.tools.basics` now typecast Actors/Figures into boxes via their bounding boxes (if possible).
- `Frame.sub[]` now correctly transfers any subfigure names, and `Frame.cut[]` removes subfigure names from the dict.
- Indices to `partition()` can now also be supplied as individual positional arguments instead of packaged into a list.
- Additional keyword values supplied to the `highlight()` actor action for MultiPaths/MultiSplines are now set as attributes of the affected subpaths.
- `enboxHighlight()` has been renamed `enboxFlourish()`, though the old name is still usable.
- A closed path will now have a seamless connection between its ending and starting nodes.
- Added `spacing` option to `quadgrid()`.
- Improved function tweening (homotopy tweening). Tweening can now occur between numeric-valued functions of arbitrary input signatures as long as the starting and ending signatures match.
- Added `convertCoordsFrom()` method to `Camera` class.
+ It's identical to `convertCoords()`, but it reverses the roles of `self` and `other`.
- Added `dimensions()` method to `Camera` class which returns width and height of the viewbox all at once as a tuple.
- Added `aspectRatioWH` property to the `Animation` class.

Bug Fixes
- Setting `tipSize` property for `MultiPaths` and `MultiSplines` will now work even if head and tail sizes differ.
- `SpaceFrame` can now be initialized using keyword arguments to create named subfigures just like the vanilla `Frame` class can.
- Fixed a bug with `MultiImage/MultiText` `box()` method.
- Fixed a very old bug with `Path.concat()`.

0.7.1

Changes
- LaTeX code is now cached using template and preamble too.
+ As a result, all prior LaTeX caches will be invalidated after updating to this version, so it's a good idea to clear them out so they don't waste space.
- SciPy is now a soft requirement for Morpho (it's needed to use the new `FlowField` gadget, but nothing else currently). SciPy won't be automatically installed when Morpho is updated, but can be manually installed with the command `pip install scipy`.
- `SpacePolygon` default border color is now white, bringing it into alignment with what 2D `Polygon` does.
- Setting/getting attributes of a MultiFigure that are not top-level will now implicitly use `.all` to set/get it from all subfigures instead of just the first subfigure.

New Features
- 3D LaTeX is now supported via the `morpho.latex.parse3d()` function.
- Individual glyphs within a LaTeX figure can now be selected by character:
python
myTex.select[morpho.latex.matches(r"\pi")].set(fill=[1,0,0])

+ Note that this feature isn't perfect and will sometimes fail, particularly for symbols that are actually made up of two glyphs (e.g. `\implies`) or when a symbol may subtly change from its base version (e.g. by superscripting, so for example the "2" in `x^2` has to be matched with `^2` instead of just `2`).
- Added `matches()` function to `morpho.color` which checks if two normalized RGB triplets are close enough to be regarded as the same color.
- New `FlowField` gadget allows for the creation of streamer fields.
+ **Note:** This requires `scipy` to be installed.
- New `highlight()` and `flourish()` actor actions for LaTeX figures (i.e. `MultiPath`/`MultiSpline`).
- New `enboxHighlight()` function added to `morpho.gadgets` that does the same as `enbox()` but then immediately deboxes.
- New `locatorModifier` property to the Animation class that can be set to a function which will be applied to clicked locations before printing them to the console.
- New `mathaxes3d()` function added to `morpho.grid`.
- New functions `wedge()` and `tilt()` added to `morpho.matrix`.
- Frames can be partitioned into chunks and recombined with new `partition()` and `combine()` methods.
+ Can be useful in more precisely controlling LaTeX morphs.
- The subfigures copied when tweening between two MultiFigures with different subfigure counts can now be controlled using a new `subpool` property.
- Spiral Tween is now supported for many space figures.
+ e.g. `SpacePoint`, `SpacePath`
- `Polygon.toPath()` and `Pie.toPath()` are now implemented.
- New `Frame.cut[]` feature behaves like `.sub[]` except it also deletes the extracted subfigures from the `Frame`-like figure that called it.
- Subfigure attributes of MultiFigures can now be modified en masse with in-place operations like `+=` via the properties `.iall` and `.iselect[]`.

Improvements
- Optimized animation playback/rendering, meaning they should play smoother and render faster particularly for animations containing a lot of complex figures that aren't moving.
- Functions in `morpho.gadgets` that require a box to be given can now optionally take a Figure or Actor object as input instead and its bounding box will be used as the box (assuming it can be computed).
- New `morpho.text.space()` function can be used to insert spaces as individual subfigures in paragraphs. Can help control text spacing in a paragraph.
- Many `grid` submodule figures are now optionally accessible from `shapes`
+ e.g. `morpho.shapes.Path()` now works.
- MultiFigure `.select[]` feature can now take multiple index ranges.
+ e.g. `mytex.select[1:4, 6]`
- MultiFigure `.all` and `.select[]` have been made more robust and better behaved in general.
+ Specifically, calling `.set()` after either one is guaranteed to return the original `Frame`-like figure that invoked `.all` or `.select[]`.
- `morpho.tools.basics.totalBox()` can now accept an optional `pad` parameter.
- `padbox()` and `shiftBox()` can now optionally accept figures/actors as input and will attempt to infer their bounding boxes to use as the box.
- New `coast()` transition added to `morpho.transitions` which is identical to `glide()` except the second inflection point is now specified in terms of how far away it is from 1 instead of 0.
python
These two are equivalent:
glide(0.2, 0.7)
coast(0.2, 0.3)

- `morphFrom()` was refactored to hopefully make it work better with puppet skits.
- `morphFrom()` for LaTeX figures (i.e. `MultiPath`/`MultiSpline`) can now optionally take a list of figures/actors to morph from instead of just a single one.
- The number of subfigures in a `Frame`-like figure can be gotten more immediately using a new `numfigs` property.
- Attempting to set/get an attribute of a MultiFigure that is not top-level will now implicitly call `.all` instead of just operating on the first subfigure.
+ This makes changing, say, the transparency of a LaTeX MultiSpline more intuitive, as instead of doing `mytex.all.alpha = 0` you can just do `mytex.alpha = 0`.
- New `sel[]` feature in `morpho.tools.basics` allows for easier construction of index tuples. Identical to `numpy.s_`.
+ e.g. `sel[a:b:c] --> slice(a,b,c)`

Bug Fixes
- Fixed `SpacePath` default figure initialization.
- Fixed a bug with rendering certain empty `SpaceTrack` figures.
- Multiplying a `Mat` object by a singleton now treats a singleton np.array like `np.array(3+4j)` just like a regular complex number.
- Fixed a floating point bug that could cause paths to be drawn incorrectly.
- Fixed a bug where a background box for a Path could be drawn twice.
- Fixed a bug with drawing `MultiPath`/`MultiSpline` background boxes.
- All inputs to `basicgrid()` are now keyword only.
- Fixed a bug with passing in gradients to `mathgrid()`.
- The `tweenMethod` keyword for `mathgrid3d()` now works.
- `spacing` option for `mathgrid3d()` now exists.
- Invisible subfigures in a `SpaceFrame` will no longer be drawn.
- Conversion from 2D to 3D Paths and Polygons now copies all the non-tweenable attributes it's supposed to.
- Fixed a strange bug where 1-frame animations would sometimes crash Python when played.

0.7.0

Changes
- Added `svgelements` as a dependency. Should be automatically installed when updated thru pip.
- `Path.center()` now returns the center of the path's bounding box instead of the center of mass of its nodes. The center of mass can now instead be calculated by calling the `centroid()` method.
- Mask layers whose `visible` attribute is set to `False` are no longer applied.
- Figure delays, Layer time offsets, and Layer `start`/`end` features are now officially deprecated.
+ They're not being removed yet, but I will no longer be making much effort to support them such as bug fixes or ensuring they remain compatible with new features going forward.

New Features
- New actors can now be automatically created and affixed to a layer in a single line with the syntax `myactor = mylayer.Actor(myfigure)`
+ This streamlines the process of introducing new actors to the current end of the global animation timeline. Coupled with the `set()` method, new actors can be created, initialized, and affixed to a layer all in one line:
python
The return value of `Layer.Actor()` is the newly created Actor object itself
arrow = mylayer.Actor(morpho.grid.Arrow(1, 2+2j).set(width=5, color=[1,0,0], ...))

+ Placement on the timeline can still be modified by passing in the optional keyword inputs `timeOffset` or `atFrame`
python
myactor = mylayer.Actor(myfigure, timeOffset=10)
myactor2 = mylayer.Actor(myfigure2, atFrame=0)

- New `MultiSpline` figure enables Morpho to load many SVG files by calling `MultiSpline.fromsvg(filename)`
- Morpho can now parse LaTeX math code into a MultiSpline figure by calling `morpho.latex.parse(latexCode)`.
+ Note this requires you to have a LaTeX distribution installed, as well as dvisvgm.
- `PText` and physical paragraph figures have a new `toSpline()` method that converts a physical text figure into a MultiSpline.
+ Note this is still a pretty experimental feature and needs further improvement, especially for paragraphs where the output can sometimes look significantly off.
- Paths and Splines now support a `box()` method that returns the bounding box of the figure.
+ Also included are side methods `left()`, `right()`, `top()`, `bottom()` and corner methods `northwest()`, `southwest()`, `southeast()`, `northeast()`.
- Paths and Splines now support background boxes via setting the attributes `background`, `backAlpha`, and `backPad`.
- Paths and other Path-like figures have a new `dashOffset` attribute.
- New Spline `autosetHandles()` method converts Splines into Catmull-Rom Splines by modifying the tangent handles.
- `Spline.fimage()` now works.
- Paths and Splines now support an `align` property that works similarly to `align` for Images and Text figures. Mainly useful for aligning MultiSplines representing a math expression.
- Paths and Splines can now be "backstroked", meaning the stroke will appear behind the fill. This is done by setting a *negative* `width` value: `mypath.width = -6`.
- Arrows now have a `vector` property which returns/sets the tail-to-head vector:
python
myarrow.vector Returns myarrow.head - myarrow.tail
myarrow.vector = 2+3j Equivalent to myarrow.head = myarrow.tail + 2+3j

- New `morpho.grid.basicgrid()` function produces a grid better suited for when you don't need the grid to morph.
- `paragraph()` now has `xbuf` and `ybuf` optional inputs that work like a size-independent `xgap` and `ygap` in which the gap spacing is specified in units relative to the font size.
- New `select` property for `Frame` figures allows modifying all the attributes of a subset of subfigures.
+ Example: `myframe.select[2:5].set(pos=1+2j)` modifies the `pos` attribute of subfigures 2 thru 4 (inclusive).
+ A boolean-valued choice function can also be given to `select[]` to only select subfigures meeting a certain criterion:
python
myframe.select[lambda subfig: subfig.alpha == 0].set(alpha=1)

+ Note that `select[]` cannot be used to extract a sub-Frame. For that, use the `sub[]` property.
- New `sub` property for `Frame` figures allows extracting a subset of subfigures as a new `Frame` figure. The input syntax is the same as for `select[]`, but the returned value is a new `Frame` consisting of copies of the selected subfigures.
- Position of a keyfigure in an Actor's timeline can now be obtained by calling `myactor.timeof(keyfigure)`.
- New `morphFrom()` actor action provides an easy way to morph a copy of an actor into a new actor. Particularly useful when animating a new math formula morphing out of another math formula.
- Added various box functions to `morpho.tools.basics`:
+ `padbox()` adds horizontal/vertical padding to a box.
+ `totalBox()` computes the total bounding box of a list of boxes.
+ `shiftBox()` translates a box by a given vector.

Improvements
- The `endDelay()` and `endDelayUntil()` methods of the `Animation` class now have aliases `wait()` and `waitUntil()`.
- Non-physical paragraphs are now easier to initialize as providing `windowShape` is optional in most use cases now.
- Text array inputs to `paragraph()` are now much more tolerant, supporting a mix of `Text` figures, strings, and sublists.
+ Example:
python
morpho.text.paragraph(["Hello", morpho.text.Text("World", color=[1,0,0])], ...)

- `Actor.key[]` can now be accessed by object as well as by stack index enabling syntax like
python
myactor.key[keyfig] = newkeyfig
del myactor.key[keyfig]

- Paths/Splines with deadends are now properly tweenable.
- Path/Spline slicing now handles deadends correctly.
- `enbox()`, `encircle()`, and `crossout()` functions can now take an optional `pad` input to apply padding to the given box.
- Added new option for outlined path rendering.
- The `origin` attribute for Paths and Splines can now be accessed/modified using the alias `pos`, making them feel similar to Image and Text figures in that regard.
- Methods can now be called from `Frame.all`. Useful for calling a method that will modify each subfigure in place, e.g. `myframe.all.commitTransforms()`
- `Frame.merge()` now returns `self`, enabling method chaining after a merge call.
- `Polygon` now handles drawing bad vertex values (e.g. `nan` or `inf`) better.
- Temporary directories are now generated differently when exporting an animation, removing the need to set an export signature if exporting multiple animations in parallel.

Bug Fixes
- `Frame.merge()` should now correctly handle merging another `Frame` figure.
- Zero-length space arrows are now drawn.
- Fixed visual bug with cyclic paths with arrows.
- Fixed bug with `Spline.close()`
- `Spline` spiral and pivot tween methods now correctly tween the `origin` attribute.
- `SpaceSpline.newNode()` now has `relHandles` option.
- Fixed bug in color gradient detection for Paths.
- Fixed bug in bounding box methods for physical Text figures.
- Stroke widths below 0.5 are now ignored. This should fix some visual bugs.
- Fixed visual bug for Splines whose tangent handles were extremely close but not coincident with their positional nodes.
- Fixed bug with Paragraph tweening.

Page 1 of 3

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.