All Projects → tonsser → Cirque

tonsser / Cirque

Licence: MIT License
An iOS component that enables you to draw multi color circle strokes with gradient trasitions between colors

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Cirque

Swiftfortunewheel
The ultimate spinning wheel view that supports dynamic content and rich customization.
Stars: ✭ 114 (+395.65%)
Mutual labels:  circle, circular
Mkringprogressview
⭕️ Ring progress view similar to Activity app on Apple Watch
Stars: ✭ 1,140 (+4856.52%)
Mutual labels:  circle, gradient
Bubblepictures
Bubble Pictures for iOS done in Swift
Stars: ✭ 434 (+1786.96%)
Mutual labels:  circle, circular
leaflet-paintpolygon
Leaflet plugin to create polygon with circle as paint
Stars: ✭ 38 (+65.22%)
Mutual labels:  draw, circle
Hgcircularslider
A custom reusable circular / progress slider control for iOS application.
Stars: ✭ 2,240 (+9639.13%)
Mutual labels:  circle, circular
Jocircularslider
A highly customisable and reusable circular slider for iOS applications.
Stars: ✭ 128 (+456.52%)
Mutual labels:  circle, circular
Rwidgethelper
Android UI 快速开发,专治原生控件各种不服
Stars: ✭ 996 (+4230.43%)
Mutual labels:  circle, gradient
Circle Flags
A collection of 300+ minimal circular SVG country flags
Stars: ✭ 139 (+504.35%)
Mutual labels:  circle, circular
Maker.js
📐⚙ 2D vector line drawing and shape modeling for CNC and laser cutters.
Stars: ✭ 1,185 (+5052.17%)
Mutual labels:  draw, circle
rn-circular-slider
React Native circular slider based on react-native-svg
Stars: ✭ 25 (+8.7%)
Mutual labels:  circle, circular
Ring
圆环进度条,环形进度条
Stars: ✭ 52 (+126.09%)
Mutual labels:  circle
cypress-example-circleci-orb
Demo of using the Cypress CircleCI Orb
Stars: ✭ 26 (+13.04%)
Mutual labels:  circle
Adam-optimizer
Implemented Adam optimizer in python
Stars: ✭ 43 (+86.96%)
Mutual labels:  gradient
ngx-animated-gradient
Angular Directive that animates the gradient background
Stars: ✭ 16 (-30.43%)
Mutual labels:  gradient
geometer
A simple drawing program to replicate construction with a compass and straightedge
Stars: ✭ 19 (-17.39%)
Mutual labels:  circle
isometric
A lightweight JavaScript library, written in TypeScript to create isometric projections using SVGs
Stars: ✭ 53 (+130.43%)
Mutual labels:  draw
RainbowTaskbar
Customizable Windows taskbar effects.
Stars: ✭ 39 (+69.57%)
Mutual labels:  gradient
mixed-precision-pytorch
Training with FP16 weights in PyTorch
Stars: ✭ 72 (+213.04%)
Mutual labels:  gradient
autodiff
A .NET library that provides fast, accurate and automatic differentiation (computes derivative / gradient) of mathematical functions.
Stars: ✭ 69 (+200%)
Mutual labels:  gradient
gridder
A Grid based 2D Graphics library
Stars: ✭ 51 (+121.74%)
Mutual labels:  draw

cirque icon 2

Cirque

Swift Version License Platform

Cirque is an iOS component that enables you to draw multi color circle strokes with gradient trasitions between colors.

Why?

CAGradientLayer currently only supports linear gradients, and most solutions out there only support two colors. However, we needed a modular, configurable component that could handle any number of colors at any size.

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

First create a data structure that implements CirqueDataType (an enum would make sense), then create a new CirqueView and set the dataPoints property with an array of CirqueDataType.

let cirque = CirqueView(frame: CGRect(x: 0, y: 0, width: 110, height: 110))
cirque.dataPoints = [RankingGroup.match(value: 0.3), 
                     RankingGroup.achievements(value: 0.2), 
                     RankingGroup.votes(value: 0.2)]
view.addSubview(cirque)

and boom 💥

Example

Customization

You can further customize the appearance be tweaking

Property Description Default value
transitionSize A Float between 0 and 1 indicating the percentage of the circle circumference that should be used to transition fully from one color to the next. 0.05
stepSize A Float between 0 and 1 indicating the percentage of the transitionSize that each gradient step should fill. So with a value of 0.1, each color step is 10% of the transitionSize, meaning there will be 10 steps in total. 0.1
lineWidth A Float indicating the stroke width of the circle. 5

Expainer

How it works

The idea is to draw as much as possible with ordinary strokes on a bezier arc. Then when it's time to shift color, 1/stepSize little arcs are drawn which each go one step closer to the next color. This is illustrated below:

Example

Animation

I have implemented a working prototype that can animate the progress of the circle, while keeping the relative proportions of the circle as it expands.

The challenge is that in order to draw many small arc segments, the most feasible thing is to do it directly in drawRect:, which means there are no layers to animate.

My working prototype supports custom duration and timing functions. If you would to se this supported directly in this component, please throw a 👍 on this issue.

Installation

Cirque is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "Cirque"

Requirements

  • Xcode 8.0
  • Swift 3.0+

Author

Mr. Engberg, Lead Mobile Developer @ Tonsser

Contribution

Contributions are more than welcome!

License

Cirque is available under the MIT license. See the LICENSE file for more info.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].