Skip to content
프로젝트

소개

Origami와 같은 편집기를 한 시간 만에 만드는 방법을 궁금해한 적이 있나요?

기타 프로젝트

이 수치를 측정하는 방법

측정된 스타 증가

in 24h
0
in 7 days
0
in 15 days
0
in 1 month
기록 수집 중

서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.

README.md

Original

KZNodes - editors like Origami made easy.

Version License Platform

Watch demo

Have you ever wondered how you could create an editor like Origami? How about creating a subset of Origami in less than 100 lines of code?

Joining nodes is like functional programming, only visual.

Features:

  • Domain agnostic, can be used to create editors for:
    • Animations
    • 3D Graphics
    • Image processing
    • Data Processing
    • Artificial Inteligence
    • Anything that you can express as a data / function pipeline?
  • Sockets have data types, you specify what classes are supported, that way you never get unsupported connections.
  • Fully native with 0 dependencies
  • Slick looking out of the box
  • Ultra simple to create new node classes, want to add class that can be used to apply sqrtf to it's input? 3 lines of code.

NodeType creation

Think of NodeTypes like objc classes, they define common behaviour for all instances. You can create a new node class as follows:

[KZNNodeType registerType:@"sqrtf" inputs:@{ @"Input" : NSNumber.class } outputs:@{ @"Output" : NSNumber.class } processingBlock:^(KZNNode *node, NSDictionary *inputs, NSMutableDictionary *outputs) {
    outputs[@"Output"] = @(sqrtf([inputs[@"Input"] floatValue]));
  }];
  • sqrtf is the name
  • it has input socket "Input" that accepts NSNumbers
  • it has output socket "Output" that generates NSNumbers
  • Output = sqrtf(input)

There are also 2 more advanced creator functions:

  1. KZNNodeType withClass allows you to change base class used for a node, eg. use node with slider.
  2. KZNNodeType withBuilder allows you to use builder pattern instead of simplified syntax.

Setup block

You can also add setup block which will allow you to further configure new instances of your NodeType, eg. disable continuous slider.

Node evaluation mode

Nodes are lazy evaluated by default, they will only evaluate when there is a change on their sockets or connected nodes. Changes propagate to connections, so if you modify a node in the beginning of a graph it will propagate to all connected nodes.

If you mark node type to use continuous evaluation, it will evaluate 60 times per second if possible, eg. time node in sample app.

Built-in node classes

KZNNodeWithSlider

KZNNodeWithText

Adding new node classes

It's simple:

  1. Create a subclass of KZNNode
  2. Do whatever you want with it
  3. when you register Node type you can specify your class as baseClass, and reference it in processingBlock.

Installation and setup

KZNodes is distributed as a CocoaPod: pod 'KZNodes' so you can either add it to your existing project or clone this repository and play with it.

Roadmap & Contributing

  • Serialization of workspaces.
  • Idiot-proofing.
  • Lazy evaluation of sockets.

Pull-requests are welcomed.

It took me around 18h to get from idea to release so the code is likely to change before 1.0 release.

If you'd like to get specific features I'm available for iOS consulting.

Changelog

0.1.1

  • much nicer bezier curves, based on the-graph

0.1.0

  • initial release

License

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

Author

Krzysztof Zablocki, [email protected]

Follow me on twitter.

Check-out my blog or GitHub profile for more cool stuff.

관련 프로젝트 살펴보기

불러오는 중…