• Stars
    star
    415
  • Rank 104,301 (Top 3 %)
  • Language
    Swift
  • License
    Other
  • Created almost 10 years ago
  • Updated over 9 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Vector animation framework in Swift for iOS and OSX.

ShapeAnimation-Swift

Vector animation framework in Swift based on SwiftGraphics for iOS 9 and OSX. With ShapeAnimation you can easily create various animations with a nice Swift based syntax.

Travis

SVG animation development with SVGKit happens on the SVG branch. ShapeAnimation-ObjC is an alternative vector animation framework in Objective-C.

Also note this project has moved to Swift 2.0 which requires Xcode 7.0 and Mac OS X 10.10.

What's included

  • ShapeView class which contains vector shape layers.

    • Helper functions to add image, text, circle, regular polygon, lines and other shapes.
    • Support gradient fill with animation.
    • Enumerate, hit-test or find layers.
  • Animation extension functions of CALayer.

    • opacityAnimation, flashAnimation, backColorAnimation
    • scaleAnimation, tapAnimation, transformAnimation
    • rotate360Degrees, rotationAnimation
    • shakeAnimation, moveAnimation, moveOnPathAnimation
    • slideToRight, slideAnimation, flipHorizontally, flipVertically
    • Layer dragging: constrainCenterToSuperview, bringOnScreen
  • Animation extension functions of CAShapeLayer.

    • strokeStartAnimation, strokeEndAnimation, lineWidthAnimation
    • strokeColorAnimation, fillColorAnimation, dashPhaseAnimation
    • switchPathAnimation
  • Group animation and cascaded animation.

    • animationGroup for the same layer
    • applyAnimations for multiple layers
    • Use the block-based function in apply() to play cascaded animations.
    • Pause, resume or stop animations.
  • Animations with customized properties

Stroke Lines Move on Path Radar Circles

Rotate Polygons Jumping Ball

Animation with Sliders Drag Layers

Usage

Please see the examples in MasterViewController.swift.

let layer1 = self.addLinesLayer(view, points:[(10.0,20.0),(150.0,40.0),(120.0,320.0)])
layer1.strokeEndAnimation().apply() {
    layer1.shakeAnimation().apply()
}

let la2 = self.addLinesLayer(view, points:points2, color: UIColor.blueColor())
lla2.scaleAnimation(from:1, to:1.1, repeatCount:3).apply(duration:0.3)

let la3 = self.addLinesLayer(view, points:points3, color: UIColor.greenColor())
la3.flashAnimation(repeatCount:6).apply()

let la4 = self.addLinesLayer(view, points:[(10.0,20.0), (150.0,40.0), (120.0,120.0)])
let a1 = la4.moveOnPathAnimation(path).setDuration(1.6)
let a2 = la4.rotate360Degrees().setRepeatCount(2)
animationGroup([a1, a2]).autoreverses().apply()

Help Wanted

All of this code is very much a work in progress. I'm adding and changing functionality as needed.

Your help wanted. Please fork this project and submit pull requests or [issues][issues]. [issues]: https://github.com/rhcad/ShapeAnimation-Swift/issues

Contributions are always welcome in the following areas:

  • Header doc comments explaining what the functions do
  • Useful animation template or application examples
  • Fix issues about animation, Swift usage rules or translations

License

ShapeAnimation-Swift is released under a BSD License. See LICENSE file for details.

FAQ

  • Could not build Objective-C module 'ShapeAnimation':
    • Quit Xcode and delete the sub folders in ~/Library/Developer/Xcode/DerivedData/.

More Repositories

1

x3py

C++ Plugin Framework that can integrate with QT, Python, Java or C#.
C++
309
star
2

TouchVG

A lightweight 2D vector drawing framework mainly using C++ for iOS, Android and Windows.
C++
154
star
3

x3c

A plugin-framework that uses C++ and STL.
C++
154
star
4

vgios

A lightweight 2D vector drawing framework for iOS.
Objective-C++
81
star
5

vgcore

Cross-platform 2D vector drawing library using C++.
C++
68
star
6

geogebra_euclid

基于 GeoGebra 的尺规作图闯关游戏
JavaScript
43
star
7

vgandroid

A lightweight 2D vector drawing framework for Android.
C++
38
star
8

AndroidDrawing

基于vgandroid构建Android绘图应用
Java
37
star
9

geomedit

Online geometry editor based on AngularJS and JSXGraph.
JavaScript
24
star
10

touchvg-v0.6

A lightweight 2D vector drawing framework using C++.
C++
14
star
11

vgplay

A vector shape playing and animation framework for iOS and Android based on TouchVG
Objective-C++
14
star
12

ggblib

Interactive mathematics materials based on GeoGebra and AngularJS.
CSS
12
star
13

hello-react

React starter with ES6, grunt and webpack.
JavaScript
11
star
14

vgandroid-demo

Unit test and example project with TouchVG for Android.
Java
9
star
15

iOS-MagnifierGlass

A magnifying glass with shadow for iOS.
Objective-C
9
star
16

vglite

A lightweight 2D vector drawing framework using C++. (Stopped)
C++
8
star
17

vgios_examples

TouchVG examples for iOS.
Objective-C
7
star
18

xtpui

使用XTP实现的程序界面框架,基于x3py框架扩充界面内核插件
C++
6
star
19

ShapeAnimation-ObjC

Vector animation framework in Objective-C based on CoreAnimation for iOS and OS X.
Objective-C
4
star
20

ggb-dev

基于 GeoGebra 的动态数学二次开发技术介绍
4
star
21

iOSColorPad

A guide to creating a simple vector drawing app with TouchVG.
Objective-C++
3
star
22

vgwpf-demo

Unit test and example project with TouchVG for WPF (Windows).
C#
3
star
23

ggb-ml

Machine Learning Practices with GeoGebra and Python.
Python
3
star
24

vgwpf

A lightweight 2D vector drawing framework for Windows (WPF).
C#
3
star
25

InkpadDoxygen

Inkpad documentation generator with Doxygen.
Shell
2
star
26

lipi-android-toolkit-4

Toolkit for online Handwriting Recognition (HWR).
C++
2
star
27

DemoCmds

An example project containing customized shapes and commands.
C++
2
star
28

ggb-plot

Automated geometrical construction and highlighting based on GeoGebra.
JavaScript
1
star
29

vgplay-android

A vector shape playing and animation framework based for Android.
Java
1
star
30

touchvg.js

交互式矢量图形框架 TouchVG 的 Web 版,基于 WebAssembly 编译 C++ 内核
C++
1
star
31

vgios-demo

Unit test and example project with TouchVG for iOS.
Objective-C++
1
star
32

touchvg.github.io

Online document of TouchVG framework.
CSS
1
star
33

vgplay-ios

A vector shape playing and animation framework based on TouchVG for iOS.
Objective-C++
1
star