Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
lcs-rgordon committed Jul 25, 2019
2 parents ae8b553 + d123342 commit d148bcd
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,38 @@ To see your animation, build and run the Animation application:

<img width="334" alt="Screen Shot 2019-07-24 at 9 48 07 PM" src="https://user-images.githubusercontent.com/32135742/61842157-c9f4d200-ae5c-11e9-98e1-b66dcef76172.png">

## Documentation

Animation is designed to be an easy-to-use sketching environment.

Create an instance of the Canvas class and begin drawing:

```swift
import Cocoa
import PlaygroundSupport
import CanvasGraphics

// Create canvas
let canvas = Canvas(width: 300, height: 600)

// Show the canvas in the playground's live view
PlaygroundPage.current.liveView = canvas

// Draw a face
canvas.fillColor = .white
canvas.defaultBorderWidth = 5
canvas.drawEllipse(at: Point(x: 150, y: 300), width: 200, height: 200)

// Draw eyes
canvas.drawEllipse(at: Point(x: 125, y: 325), width: 10, height: 20)
canvas.drawEllipse(at: Point(x: 175, y: 325), width: 10, height: 20)

// Draw mouth
canvas.drawEllipse(at: Point(x: 150, y: 270), width: 100, height: 30)

// Turn mouth into a smile by covering up top half of mouth
canvas.drawShapesWithBorders = false
canvas.drawRectangle(at: Point(x: 150, y: 275), width: 125, height: 25, anchoredBy: .centre)
```

You can read through the [documentation for available drawing methods here](http://russellgordon.ca/CanvasGraphics/Documentation/Classes/Canvas.html).

0 comments on commit d148bcd

Please sign in to comment.