Canvas2DDisplay class
- Inheritance
-
- Object
- AbstractDisplay
- AbstractHTMLDisplay
- Canvas2DDisplay
Constructors
- Canvas2DDisplay(Element container)
Properties
- camera ↔ Camera
-
The camera is bound to the display with bindCamera.
getter/setter pairinherited
- canvas ↔ CanvasElement
-
The CanvasElement, an html canvas;
getter/setter pairinherited
- container ↔ Element
-
getter/setter pairinherited
- darkMode ↔ bool
-
When darkMode is set to
true
, all the colors are updated: their brightness is inverted but the hue doesn't changegetter/setter pairinherited - dragCurrentPosition ↔ Vector3
-
As described in createMouseDraggedEvent,
dragCurrentPosition is the position of the
cursor at the time of the event
getter/setter pairinherited
- dragStartPosition ↔ Vector3
-
As described in createMouseDraggedEvent,
dragStartPositon
is the position of the cursor when the drag startedgetter/setter pairinherited -
eventListeners
↔ List<
StreamSubscription> -
getter/setter pairinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- isDragging ↔ bool
-
As described in createMouseDraggedEvent,
isDragging is set to true when the canvas
receive the drag event
getter/setter pairinherited
- mouseButton ↔ MouseButton
-
mouseButton is the button who triggered the
mouse event.
getter/setter pairinherited
- mousePosition ↔ Vector3
-
getter/setter pairinherited
- previousTimeStep ↔ double
-
getter/setter pairinherited
- prevMousePosition ↔ Vector3
-
getter/setter pairinherited
- renderer ↔ AbstractRenderer
-
The renderer is responsible for rendering mobjects (Mobject).
It is created with createRenderer and is called from the constructor.
getter/setter pairinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
applyColorTransformation(
Color color) → Color -
Apply the darkMode if set to true
otherwise return the
color
inherited -
bindCamera(
Camera camera) → void -
Binds the
camera
inherited -
bindEventListeners(
) → void -
Binds all the eventListeners
All the events should be converted to Event and sent to
the onEvent method
This method needs to be implemented in subclasses
inherited
-
createKeyPressedEvent(
String keyPressed) → void -
inherited
-
createKeyReleasedEvent(
String keyReleased) → void -
inherited
-
createMouseDraggedEvent(
) → void -
Creates a MouseDraggedEvent
inherited
-
createMouseMovedEvent(
) → void -
inherited
-
createMousePressedEvent(
) → void -
inherited
-
createMouseReleasedEvent(
) → void -
inherited
-
createRenderer(
) → AbstractRenderer -
Creates a renderer (AbstractRenderer) used to render mobjects (Mobject).
This method needs to be implemented in subclasses
override
-
getCoordinates(
double pixelX, double pixelY) → Vector3 -
Converts the pixel coordinates (
pixelX
,pixelY
) to the manim coordinates The result is returned as a Vector3, but used as a vector2 containing the coordinates x and y of the corresponding point @parampixelX
from 0 to pixel width @parampixelY
from 0 to pixel heightinherited -
getMouseScreenPosition(
Point< num> pt) → Vector3 -
Get the position of the point
pt
in the canvas instead of the whole html document.inherited -
getPixelPosition(
Vector3 coords) → List< double> -
Converts the manim coordinates (Vector3
coords
) to the pixel coordinates The z component ofcoords
is ignored. It returns a list of 2 double containing the x and y pixel coordinatesinherited -
nextFrame(
) → Future< double> -
Waits for the next frame.
Returns a
Future
containing the time elapsed between frames (in seconds) This method needs to be implemented in subclassesinherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onEvent(
Event event) → void -
Dispatches the
event
to the corresponding EventListener by using the EventDispatcherinherited -
setDisplaySize(
int width, int height) → void -
Sets the width and the height of the canvas
inherited
-
setup(
) → void -
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
unbindEventListeners(
) → void -
Unbinds all the eventListeners
This method needs to be implemented in subclasses
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited