GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - DeveloperLx/LxThroughPointsBezier: A funny iOS library. Draw a smooth bezier through several points you designated. The curve‘s bend level is adjustable.

BranchesTags
Open more actions menu

Latest commit

 

History

19 Commits
19 Commits

Folders and files

NameName
Last commit message
Last commit date
LxThroughPointsBezier
LxThroughPointsBezier
 
 
LxThroughPointsBezierDemo
LxThroughPointsBezierDemo
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
LxThroughPointsBezier.podspec
LxThroughPointsBezier.podspec
 
 
README.md
README.md
 
 
demo.gif
demo.gif
 
 

Repository files navigation

LxThroughPointsBezier

Draw a smooth bezier through several points you designated. The curve‘s bend level is adjustable.

Installation

You only need drag UIBezierPath+LxThroughPointsBezier.h and UIBezierPath+LxThroughPointsBezier.m to your project.

Podfile

pod 'LxThroughPointsBezier', '~> 1.0.0'

Support

Minimum support iOS version: iOS 5.0

How to use

    #import "UIBezierPath+LxThroughPointsBezier.h"

    CGPoint point1 = CGPointMake(30, 180);
    CGPoint point2 = CGPointMake(90, 120);
    CGPoint point3 = CGPointMake(120, 200);
    CGPoint point4 = CGPointMake(160, 240);
    CGPoint point5 = CGPointMake(210, 160);
    CGPoint point6 = CGPointMake(240, 300);
    CGPoint point7 = CGPointMake(290, 140);
    
    NSValue * point1Value = [NSValue valueWithCGPoint:point1];
    NSValue * point2Value = [NSValue valueWithCGPoint:point2];
    NSValue * point3Value = [NSValue valueWithCGPoint:point3];
    NSValue * point4Value = [NSValue valueWithCGPoint:point4];
    NSValue * point5Value = [NSValue valueWithCGPoint:point5];
    NSValue * point6Value = [NSValue valueWithCGPoint:point6];
    NSValue * point7Value = [NSValue valueWithCGPoint:point7];
    
    _pointArray = [NSMutableArray array];
    [_pointArray addObjectsFromArray:@[point1Value, point2Value, point3Value, point4Value, point5Value, point6Value, point7Value]];
    
    _curve = [UIBezierPath bezierPath];
    _curve.contractionFactor = 0.6;
    [_curve moveToPoint:point1];
    [_curve addBezierThroughPoints:_pointArray];
    
    _shapeLayer = [CAShapeLayer layer];
    _shapeLayer.strokeColor = [UIColor blueColor].CGColor;
    _shapeLayer.fillColor = nil;
    _shapeLayer.lineWidth = 3;
    _shapeLayer.path = _curve.CGPath;
    [_view.layer addSublayer:_shapeLayer];

Effect

  • demo

Be careful

The good bend level is about 0.6 ~ 0.8. The default and recommended value is 0.7.
You must wrap CGPoint struct to NSValue object, and give at least 1 point for drawing the curve.

License

LxThroughPointsBezier is available under the Apache License 2.0. See the LICENSE file for more info.

About

A funny iOS library. Draw a smooth bezier through several points you designated. The curve‘s bend level is adjustable.

Resources

Readme
Apache-2.0 license
Activity

Stars

394 stars

Watchers

13 watching

Forks

39 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.