FabricSimulation class

Constructors

FabricSimulation({required double width, required double height, required int cols, required int rows, double tearRatio = 3.2, double pinBreakRatio = 2.0})

Properties

cols → int
final
gravityOn ↔ bool
Becomes true once anything tears / any pin lets go. From then on the cloth is affected by gravity and never returns to the flat state.
getter/setter pair
hashCode → int
The hash code for this object.
no setterinherited
height → double
final
isGrabbing → bool
no setter
maxOffset ↔ double
Largest distance of any visible node from its resting place.
getter/setter pair
motion ↔ double
Average per-node movement of the last step (used to detect rest).
getter/setter pair
nodes → List<PointMass>
final
pinBreakRatio → double
A pin lets go when a spring attached to it is stretched beyond this.
final
rows → int
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
springs → List<Spring>
final
tearRatio → double
A spring tears when stretched beyond this multiple of its rest length.
final
topologyVersion ↔ int
Increments whenever a spring tears (painter rebuilds its triangles).
getter/setter pair
width → double
final

Methods

beginGrab(double x, double y, {required double radius, required double pushDepth}) → bool
Grabs every free node around (x, y) with a smooth falloff. Returns false if nothing could be grabbed.
buildIndices() → Uint16List
Triangle indices; triangles that touch a torn spring are left out, which is what opens the holes / rips.
endGrab() → void
moveGrab(double x, double y) → void
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
releasePins({int spreadFrames = 45}) → void
"Pull the pins": the pins let go one after another, starting from the bottom-right corner, so the sheet peels off the wall and falls.
step() → void
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Constants

timeStep → const double
Fixed physics step (the widget runs this with an accumulator, so the feel is identical on 60 Hz and 120 Hz screens).