You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
;; When wrapping a Movable Point in a mafs/Transform, the point will be
;; transformed too. However, your constrain function will be passed the
;; untransformed point, and its return value will be transformed back into the
;; currently applied transform. In other words, Mafs takes care of the math for
;; you.
;; Let's see a more complex example where we combine more interesting constraint
;; functions with transforms. On the left, we have a point that can only move in
;; whole-number increments within a square, and on the right, a point that can
;; only move in $\pi / 16$ increments in a circle.
;; TODO demo
;; #### Dynamic Movable Points
;; useMovablePoint is a hook that helps you instantiate and manage the state of
;; a MovablePoint. However, if need be, you can also use MovablePoint directly.
;; This can be useful if you need to work with a dynamic number of movable
;; points (since the React "rules of hooks" ban you from dynamically calling
;; hooks).
;; TODO
;; ### Accessing transforms in JavaScript
;; Here's an example of a custom component that uses the hooks approach to
;; render a grid of points. Because we want the grid's points to have a radius
;; of 3 pixels (regardless of the viewport or any transforms), we use the
;; mafs/useTransformContext hook to get the user and view transforms and apply
;; them to the circles' x and y coordinates, but not to their radius (which
;; is in pixels). We also cannot use the CSS transforms approach here, because
;; that would distort each circle.
;; TODO demo
;; ## Animation
;; useStopwatch allows you to start and stop a real-time clock for doing neat
;; things like physics simulations.
;; Pass :startTime (defaults to 0) or :endTime (defaults to Infinity) to
;; constrain the stopwatch.
;; #### Transformations and constraints
;; When wrapping a Movable Point in a
mafs/Transform
, the point will be;; transformed too. However, your constrain function will be passed the
;; untransformed point, and its return value will be transformed back into the
;; currently applied transform. In other words, Mafs takes care of the math for
;; you.
;; Let's see a more complex example where we combine more interesting constraint$\pi / 16$ increments in a circle.
;; functions with transforms. On the left, we have a point that can only move in
;; whole-number increments within a square, and on the right, a point that can
;; only move in
;; TODO demo
;; #### Dynamic Movable Points
;; useMovablePoint is a hook that helps you instantiate and manage the state of
;; a MovablePoint. However, if need be, you can also use MovablePoint directly.
;; This can be useful if you need to work with a dynamic number of movable
;; points (since the React "rules of hooks" ban you from dynamically calling
;; hooks).
;; TODO
;; ### Accessing transforms in JavaScript
;; Here's an example of a custom component that uses the hooks approach to
;; render a grid of points. Because we want the grid's points to have a radius
;; of 3 pixels (regardless of the viewport or any transforms), we use the
;;
mafs/useTransformContext
hook to get the user and view transforms and apply;; them to the circles'
x
andy
coordinates, but not to their radius (which;; is in pixels). We also cannot use the CSS transforms approach here, because
;; that would distort each circle.
;; TODO demo
;; ## Animation
;;
useStopwatch
allows you to start and stop a real-time clock for doing neat;; things like physics simulations.
;; Pass
:startTime
(defaults to 0) or:endTime
(defaults to Infinity) to;; constrain the stopwatch.
;; TODO not working yet!
;; ## Examples
;; ### Bézier curves
;; ### Riemann sums
;; ### Fancy parabola
;; ### Projectile motion
The text was updated successfully, but these errors were encountered: