Published release 0.2.1. Unreleased PR #2 reference.
LOOM 0.2.1 / ANIMATION
DiagonalShine
A caller-driven diagonal brightness sample. Sample at the suggested 12 Hz cadence; opacity is a clamped 0…1 amount for blending resting and highlight colors. Coordinates run from lower left (0) to upper right (1). Non-finite/negative time starts at zero.
Standard inherited Swift protocol operations such as synthesized equality and OptionSet set operations are not repeated. The public declarations below are extracted from the exact source revision listed in the coverage manifest.
Example
let amount = DiagonalShine.opacity(diagonal: 0.5, seconds: 1.0)
_ = Color.rgb(237, 166, 98).blended(toward: .rgb(255, 255, 255), amount: amount)
_ = DiagonalShine.delayUntilNextFrame(after: 1.0)Members on this page
Feature guides and release status
DiagonalShine
enum DiagonalShineA slow diagonal sheen for a braille mark.
Opacity is 0 at the resting color and 1 at the highlight. A raised-cosine band
travels from the lower left to the upper right, then rests off the mark. A shallow
pulse remains during that rest. The phase is wall-clock time, so the speed does not
follow the redraw rate. framesPerSecond is only the cadence at which a caller
needs to sample it.
framesPerSecond
static let framesPerSecond: DoubleSuggested sampling cadence.
Source · DiagonalShine.swift:11frame(at:)
static func frame(at seconds: Double) -> IntReturns the quantized sample index at framesPerSecond × nonnegative finite seconds.
Parameters (1)
at- Argument type and any default are shown in the declaration; see the behavior notes above.
Returns Int.
delayUntilNextFrame(after:)
static func delayUntilNextFrame(after seconds: Double) -> DoubleSeconds until the next quantized sample.
Callers sleep this long instead of redrawing continuously.
Parameters (1)
after- Argument type and any default are shown in the declaration; see the behavior notes above.
Returns Double.
opacity(diagonal:seconds:)
static func opacity(diagonal: Double, seconds: Double) -> Doublediagonal is 0 at the lower left and 1 at the upper right.
Parameters (2)
diagonal- Normalized position: lower left 0, upper right 1.
seconds- Elapsed time in seconds.
Returns Double.