Coder Social home page Coder Social logo

davinci's Introduction

Meet DaVinci

DaVinci

Author EMail MIT
Version PlatformType Swift
Build Passing Cocoapods Carthage SPM

๐Ÿต Introduction

DaVinci is a more modern CoreGraphics wrapper for iOS/macOS..

๐Ÿ“‹ Requirements

Type Requirement

Platform

iOS

10.0+

macOS

10.10

tvOS

N/A

watchOS

N/A

Linux

N/A

IDE

Xcode

9.3+

Language

Swift

4.1+

๐Ÿ“ฒ Installation

CocoaPods

DaVinci is available on CocoaPods.

use_frameworks!
pod 'DaVinci'

Manually

Copy all files in the DaVinci directory into your project.

๐Ÿ›Œ Dependency

N/A

โค๏ธ Contribution

You are welcome to fork and submit pull requests.

๐Ÿ”– License

DaVinci is open-sourced software, licensed under the MIT license.

๐Ÿ”ซ Usage

Sample.swift
import DaVinci

public func draw(in context: CGContext, rect: CGRect) {
    let fillColorOne: CGColor = #colorLiteral(red: 0.05, green:0.49, blue:0.98, alpha:0.8).cgColor
    func cal(_ ref: CGFloat, _ acu: CGFloat) -> CGFloat {
        let reference: CGFloat = 66
        return (ref / reference) * acu
    }

    let arrowPartTop = DaVinci.Path.init(point: CGPoint.init(x: cal(11, rect.width), y: rect.midY))
        .addLine(to: CGPoint.init(x: cal(44.5, rect.width), y: 0))
        .addLine(to: CGPoint.init(x: cal(54, rect.width), y: cal(9.5, rect.height)))
        .addLine(to: CGPoint.init(x: cal(30, rect.width), y: rect.midY))
        .close()
    let arrowPartBottom = arrowPartTop.flip(.vertically, by: rect.midY)
    let arrow = arrowPartTop + arrowPartBottom

    context.fill(path: arrow, color: fillColorOne)
}
Sample

davinci's People

Contributors

meniny avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.