Skip to content

nthState/ShapeWarp

Repository files navigation

Chris's SwiftUI Shape Warp

ShapeWarp modifies a shape and produces a new shape where the control points have been shifted by an amount. We also provide a seed value for pseudo-randomness

Overview

Warping shapes is straight forward with PathWarp

Rectangle()
  .warp(amount: 10, seed: 45678)
Before After
Warped Warped

We've written an extension

extension Shape {
  func warp(amount: CGFloat, seed: UInt64, include: PointType = .all) -> some Shape {}
}

Animation

I've spent time getting this package to a point where the shapes themselves animate nicely between different settings. This has been done by implementing VectorArithmetic on a custom AnimatablePathElement type

Documentation

Doc website here: https://nthstate.github.io/ShapeWarp/documentation/shapewarp/

Building the docs

swift build
PACKAGE_NAME=ShapeWarp
REPOSITORY_NAME=ShapeWarp
OUTPUT_PATH=./docs

swift package --allow-writing-to-directory $OUTPUT_PATH \
    generate-documentation --target $PACKAGE_NAME \
    --disable-indexing \
    --transform-for-static-hosting \
    --hosting-base-path $REPOSITORY_NAME \
    --output-path $OUTPUT_PATH

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages