Latest 0.0.1
License MIT
Platforms ios 8.0, requires ARC



Lumen is an iOS library for managing sources of light and objects that interact with them.

GitHub Logo
GitHub Logo

Example Usage

  // Create a delegate
  self.lumenGroupDebugger = [[NPLumenGroupDebugger alloc] init];

  // Create a lumen group
  self.lumenGroup = [[NPLumenGroup alloc] init];
  self.lumenGroup.delegate = self.lumenGroupShadowCaster;

  // Add some light sources and views
  [self.lumenGroup addSourceView:self.mySourceView];
  [self.lumenGroup addViews:[self.view1, self.view2]];


The key class in Lumen is NPLumenGroup. A lumen group contains light sources and objects (each of which must be UIView objects). The lumen group’s job is to calculate light ray vectors for each object based on the light sources. Each object gets assigned an appropriate light vector. When a vector is updated the lumen group tells its delegate.


Any class that conforms to the NPLumenGroupDelegate protocol can act as the lumen group’s delegate. Here you have the opportunity to customize the behavior for each light vector applied to each view in a group.

For convenience (and demonstration purposes) I’ve included two delegates in this project: NPLumenGroupDebugger and NPLumenGroupShadowCaster. As their names suggest, the debugger overlays a line to indicate the vectors and the shadow caster adds a shadow to the view with the offset in the direction of the light vector. You can see an example of both of these in the animated gifs above.

To create your own delegate simply create a class and implement this method:

- (void)lumenGroup:(NPLumenGroup *)lumenGroup didUpdateLightVector:(CGPoint)lightVector forView:(UIView *)view {
  // Do something with the given view and vector (vectors are normalized).


Lumen requires iOS 8.0 and above.


NPLumen is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "NPLumen"


Nebojsa Petrovic, [email protected]


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

Latest podspec

    "name": "NPLumen",
    "version": "0.0.1",
    "summary": "Light source management",
    "description": "                       NPLumen is an iOS library that allows you to treatn                       UIViews as either light sources or objects which respondn                       to the sources. For example you can have one view cast an                       relative shadow on other views.n",
    "homepage": "",
    "license": "MIT",
    "authors": {
        "Nebojsa Petrovic": "[email protected]"
    "source": {
        "git": "",
        "tag": "0.0.1"
    "social_media_url": "",
    "platforms": {
        "ios": "8.0"
    "requires_arc": true,
    "source_files": "Pod/Classes/**/*.{h,m}",
    "resource_bundles": {
        "NPCricket": [
    "public_header_files": "Pod/Classes/**/*.h"

Pin It on Pinterest

Share This