SHFingerTrail

type:
extension
author:
Shilo White
description:
A simple finger trail. (testing phase)
lastupdate:
2011-03-29
compatible:
v1.X
tag:
finger, trail, particle
homepage:
https://gist.github.com/893746
download:
https://gist.github.com/gists/893746/download
sample:
http://shilo.coarsemode.com/sparrow/extensions/shfingertrail/FingerTrailSample.zip

Description

Warning: This class is currently in testing phase. Performance, along with other issues, needs to be ironed out.

SHFingerTrail class will allow you to create finger trail effect with only a few lines of code. You can change the style, set the effect time, set the particle size. You can also set the inner and outer gradient color, or you can also set a solid color. You can also toggle “alwaysOnTop”, which will automatically keep the finger trail on top of other display objects; toggle “showOnTouchBegin” which will start the effect on touch begin; or toggle “fade” which will gradually fade the trail.

Sample

Example

//initialize an autoreleased object of finger trail, with time of half a second, and size of 20 pixels
SHFingerTrail *fingerTrail = [SHFingerTrail fingerTrailWithTime:0.5f size:20.0f];
 
//change the finger trail effect to bubbly
fingerTrail.style = SHFingerTrailStyleBubbly;
 
//add the finger trail to the stage
[self addChild:fingerTrail];

Instructions

To add into your Sparrow project

  1. Download the source files here: https://gist.github.com/gists/893746/download
  2. Open your desired Sparrow project
  3. Drag and drop the files into the “Groups & Files” pane
  4. Open “Game.h”
  5. Include the extension:
    #include "SHFingerTrail.h"
  6. Save “Game.h”

To add directly into Sparrow source

  1. Download the source files here: https://gist.github.com/gists/893746/download
  2. Save the files into Sparrow's “/Classes/” directory
    • Example: “/sparrow/src/Classes/”
  3. Navigate back one directory and open “Sparrow.xcodeproj”
    • Example: “/sparrow/src/Sparrow.xcodeproj”
  4. Inside the “Groups & Files” pane, locate the “Display” group folder
    • Example: “Sparrow → Classes → Display”
  5. Right click the “Display” group folder and click “Add → Existing Files..”
  6. Navigate into the “/Classes/” directory and select “SHFingerTrail.h” and “SHFingerTrail.m”, then click “add”
  7. On the next window, leave all options as default and click “add”
  8. In the “Groups & Files” pane, Open “Sparrow.h”
    • Example “Sparrow → Classes → Sparrow.h”
  9. At the bottom of the file, add:
    #import "SHFingerTrail.h"
  10. Save “Sparrow.h”
  11. Close “Sparrow.xcodeproj”

Source Code

Changelog

  • 2011-03-28: First version

Todo

  • Increase performance
  • Add smooth style
  • Add max finger limit
  • Add SHFingerTrailEvent

Special Thanks

  • Whoever would like to help me!
  users/shilo/extensions/shfingertrail.txt · Last modified: 2013/03/05 10:19 (external edit)
 
Powered by DokuWiki