LitFuseBasicPackage

Lit Fuse 效果可用于提供独特的艺术性和高度可定制的动画效果,您的用户会喜欢。 这些效果可用于提供引人注目的动画,以帮助您的用户注意到屏幕的特定区域。 这些效果可能用于游戏、社交媒体、广告或任何具有艺术内容的应用程序中。

请观看以下链接中 4 分钟的示例视频,并请注意,在实际设备上运行时,质量会更高。

https://drive.google.com/file/d/11Lk8fn9NS93S8RDFDb_2iusyy36QO67K/view

支持各种 Lit Fuse 效果,其中 fuse 粒子可以是任何大小的表情符号,甚至可以是短文本或所需的图像。 您可以控制发射单元的大小/比例。

我在可见的 API 中公开了对许多单元属性的控制,这使得这些 Lit Fuse 效果高度可定制且具有独特的艺术性。 您可以控制加速度、旋转等等! 许多单元属性参数都有默认值,以防您不想指定它。 X 和 Y 加速度默认为零,旋转也是如此。 只需查看 createLitFuseEffectForDesiredRangeOfEmitters 的 API。 它基本上是不言自明的。

在我们下面的术语中,当我们通常说表情符号时,请注意,如果您选择文本,或者为单元内容提供了您自己的图像,那么这一切仍然适用。 我们预计许多设计将使用表情符号。

非常小的表情符号看起来像彩色的火花。 大型表情符号将显示尽可能多的表情符号细节,从而使 fuse 效果成为一种表情符号艺术。

Lit Fuse 效果是通过在开发者指定的路径/形状上放置发射器轨迹来生成的。 这些路径可以很容易地被分配为跟随任何 UI 对象的框架! 路径也可以跟随指定的圆形、线条和矩形形状的任意组合。

发射的单元速度、单元比例和单元出生率受到控制,以模拟燃烧的 fuse 效果。 开发人员可以在放置 fuse 时控制初始单元速度、单元比例和单元出生率。 开发人员可以在 fuse 燃烧时指定不同的速度、比例和出生率。 并且他们可以在燃烧后指定结束速度、比例和出生率,从而通过指定结束比例为零来模拟残留物(或灰烬),或者根本不留下残留物或痕迹。

同样,您可以控制 X 和 Y 加速度、旋转等等。 在下面,请查找 createLitFuseEffectForDesiredRangeOfEmitters 的完整参数列表。 请注意,大多数参数都有合理的默认值,旋转和 X 和 Y 加速度等为零。

初始 fuse 路径本身可以是可见的或不可见的,具体取决于 cellInitialScale 的值。

有 3 个阶段您可以控制 fuse 粒子或单元的比例。 大小/比例可以在初始 fuse 路径放置时、fuse 实际燃烧时以及 fuse 燃烧后发射器粒子的结束比例时指定。

如果初始比例为零,则 fuse 本身在燃烧之前是不可见的。 燃烧时,比例需要大于零才能看到燃烧动作。 如果燃烧后发射器的结束比例被指定为非零,则燃烧路径将保留在屏幕上。

应该注意的是,保留在屏幕上的燃烧路径仍然由发射器组成,这些发射器以最后指定的出生率不断发射单元。 如果结束单元速度为零,则这些单元可以看起来是静止的。 这里有一个微妙之处,即结束单元出生率乘以结束单元寿命需要大于 1,以避免闪烁或频闪效应。

您可以在创建 lit fuse 效果的 API 中指定结束单元出生率和寿命。

Lit fuse 效果可以被命令为连续运行,或重复运行,燃烧之间有时间间隔,或作为所需动画的一次性显示运行。

您可以通过指定 stepsPerFrame 来指定 fuse 的燃烧速度。 它越大,fuse 燃烧得越快。

请注意,您可能需要考虑您的应用程序是在较旧和较慢的设备上运行还是在较新和更快的设备上运行,以及同时绘制到屏幕上的其他动画数量。 发射器动画会占用大量 CPU 和 GPU 处理能力。 您指定的池越大,您选择的 fuse 参数可能会影响性能并产生延迟。 首先,尝试在主要静态的屏幕上使用这些效果。 显示 fuse 效果,然后隐藏发射器足够长的时间,以允许所有先前发射的单元达到其寿命结束的设计可能会提高 fuse 性能。 隐藏发射器有助于释放资源。 请记住,屏幕上看到的每个表情符号单元都是因为发射器具有指定的出生率和寿命。 静止且不变的表情符号仍在后台出生和经历寿命,但它们只是恰好在同一位置。 如果您想要静止且不变的表情符号作为结束状态的外观,只需确保结束出生率乘以结束寿命大于 1。 允许稍微重叠。

使用 Swift Package Manager 安装

要在 Xcode 项目中实现,请选择“File(文件)”、“Swift Packages(Swift 包)”、“Add Package Dependency(添加包依赖项)”,并提供此 GitHub 链接:https://github.com/MichaelKucinski/LitFuseBasicPackage。 然后按照以下说明操作。

用法

要创建 lit fuse 效果,您必须创建一个发射器池,该池将处理您计划在路径上使用的最大数量的发射器。 我们建议 50 到 1000 个发射器之间的任何数量,具体取决于您的路径复杂性和所需的密度。

以下是代码片段,您可以使用这些代码片段快速使 Lit Fuse 效果在您的项目中工作。

首先导入 LitFuseBasicPackage

import LitFuseBasicPackage

声明一个 LitFuseBasicViewController 对象


let litFuse = LitFuseBasicViewController()

如果您的设计可以从拥有多个 lit fuse 对象中受益,您可以制作几个,如下所示。 但请注意,您需要为每个对象调用 viewDidLoad,为每个对象调用 createPoolOfEmitters 等。

let litFuse1 = LitFuseBasicViewController()
let litFuse2 = LitFuseBasicViewController()
let litFuse3 = LitFuseBasicViewController()
let litFuse4 = LitFuseBasicViewController()

确保从父视图的 viewDidLoad 中调用 litFuse.viewDidLoad()。

在调用 viewDidLoad 后立即创建您的发射器池。 不用担心传递给 someEmojiCharacter 的默认表情符号字符。 您可以随时指定和更改它。 但是,如果您的设计始终使用相同的表情符号字符,请在调用中指定它。 请注意,表情符号字符被指定为字符串。 我们负责在后台将该字符串转换为图像。

如果您提供自己的图像,我们有一个 API 可以覆盖表情符号字符。 我们在下面记录了这一点。

litFuse.viewDidLoad()

litFuse.createPoolOfEmitters(maxCountOfEmitters : 400, someEmojiCharacter: "🧠")

在 viewDidLoad 中,您还需要为发射器池中的每个元素添加一个子层。

for thisEmitter in litFuse.arrayOfEmitters { view.layer.addSublayer(thisEmitter) }

这就完成了 viewDidLoad 中需要的初始化

其余代码可以在以后根据任何所需的事件调用。

要显示 lit fuse 效果,您可能需要首先设置一个表情符号图案。


litFuse.setCellImageFromTextStringForDesiredRangeOfEmitters(desiredImageAsText: "🟡", startIndex: 1, endIndex: 300)
litFuse.setCellImageFromTextStringForDesiredRangeOfEmitters(desiredImageAsText: "🔵", startIndex: 301, endIndex: 400)

接下来,指定您的发射器在屏幕上的放置位置。 这是一个构建两个矩形并将它们用作 fuse 路径的示例。

var tempRect : CGRect = CGRect(
x: 100,
y: 300,
width: 300,
height: 300)

litFuse.placeEmittersOnSpecifiedRectangle(thisRectangle: tempRect,
startIndex: 1,
endIndex: 200)

tempRect = CGRect(
x: 500,
y: 300,
width: 300,
height: 300)

litFuse.placeEmittersOnSpecifiedRectangle(
thisRectangle: tempRect,
startIndex: 201,
endIndex: 400)

请注意,如果您在屏幕上已经有一个带有框架的对象,则会容易得多。 该框架是一个矩形,可以传递。 在我们的原型中,我们有一个名为 readMeTextView 的 UITextView,下面传递了它的框架,以便 fuse 路径实际上会跟踪它的边框。

litFuse.placeEmittersOnSpecifiedRectangle(thisRectangle: readMeTextView.frame, startIndex: 201, endIndex: 400)

请注意,scaleFactor 是一个可选参数。 scaleFactor 为 1.0 就在边框上,但是如果您想要一个 standOff 距离,以便发射器用缓冲空间环绕边框,请将比例因子设置为所需的大小,可能是 1.25 左右,以获得 25% 更大的 fuse 路径。

对于 placeEmittersOnSpecifiedRectangle,有一个可选参数,它将导致 fuse 逆时针而不是顺时针燃烧。

public func placeEmittersOnSpecifiedRectangle( thisRectangle : CGRect, startIndex : Int, endIndex : Int, scaleFactor : CGFloat = 1.0, counterClockwiseDesired : Bool = false)

最后,调用 createLitFuseEffectForDesiredRangeOfEmitters。 请注意,此示例未使用一些可选参数,因此如果需要,您可以获得更大的灵活性。 以下代码将连续显示 fuse 效果。


litFuse.createLitFuseEffectForDesiredRangeOfEmitters(
startIndex : 1,
endIndex : 400,
initialVelocity : 0,
initialBirthRate : 5,
initialScale : 1,
fuseBurningVelocity : 150,
fuseBurningBirthRate : 2200,
fuseBurningScale : 0.08,
endingVelocity : 0,
endingBirthRate : 2,
endingScale : 0,
stepsPerFrame : 1,
initialCellLifetime: 0.5,
fuseBurningCellLifetime: 0.5,
endingCellLifetime: 0.5,
continuousFuseDesired: true)

在某些时候,您可能想要隐藏 lit fuse 效果。 只需调用


litFuse.hideAllEmitters()

使用 hideAllEmitters 隐藏 fuse 效果会将所有寿命设置为零,这应该可以减轻 GPU 的任何/所有 fuse 处理。

以上应该可以让您开始使用!

您可以随时更改 fuse 位置,但在发射器隐藏时执行此操作可能看起来最好。

您可以随时更改表情符号,但在发射器隐藏时执行此操作可能看起来最好。

您可以随时调用 createLitFuseEffectForDesiredRangeOfEmitters,但在发射器隐藏时执行此操作可能看起来最好。

这是 API 的完整参数列表,该 API 执行实际的 fuse 燃烧,其中包括加速度、旋转、色调颜色等等


public func createLitFuseEffectForDesiredRangeOfEmitters(
startIndex                  : Int,
endIndex                    : Int,
initialVelocity             : CGFloat = 0,
initialVelocityRange        : CGFloat = 0,
initialBirthRate            : CGFloat = 1,
initialScale                : CGFloat = 0,
initialScaleSpeed           : CGFloat = 0,
initialScaleRange           : CGFloat = 0,
initialSpin                 : CGFloat = 0,
initialSpinRange            : CGFloat = 0,
initialAcceleration_X       : CGFloat = 0,
initialAcceleration_Y       : CGFloat = 0,
initialAlphaSpeed           : CGFloat = 0,
initialAlphaRange           : CGFloat = 0,
initialTint                 : UIColor = .white,
fuseBurningVelocity         : CGFloat = 300,
fuseBurningVelocityRange    : CGFloat = 0,
fuseBurningBirthRate        : CGFloat = 100,
fuseBurningScale            : CGFloat = 1,
fuseBurningScaleSpeed       : CGFloat = 0,
fuseBurningScaleRange       : CGFloat = 0,
fuseBurningSpin             : CGFloat = 0,
fuseBurningSpinRange        : CGFloat = 0,
fuseBurningAcceleration_X   : CGFloat = 0,
fuseBurningAcceleration_Y   : CGFloat = 0,
fuseBurningAlphaSpeed       : CGFloat = 0,
fuseBurningAlphaRange       : CGFloat = 0,
fuseBurningTint             : UIColor = .white,
endingVelocity              : CGFloat = 0,
endingVelocityRange         : CGFloat = 0,
endingBirthRate             : CGFloat = 1,
endingScale                 : CGFloat = 0,
endingScaleSpeed            : CGFloat = 0,
endingScaleRange            : CGFloat = 0,
endingSpin                  : CGFloat = 0,
endingSpinRange             : CGFloat = 0,
endingAcceleration_X        : CGFloat = 0,
endingAcceleration_Y        : CGFloat = 0,
endingAlphaRange            : CGFloat = 0,
endingAlphaSpeed            : CGFloat = 0,
endingTint                  : UIColor = .white,
stepsPerFrame               : Int = 1,
initialCellLifetime         : CGFloat, // all lifetimes expressed in seconds
initialCellLifetimeRange    : CGFloat = 0,
fuseBurningCellLifetime     : CGFloat,
fuseBurningCellLifetimeRange  : CGFloat = 0,
endingCellLifetime          : CGFloat ,
endingCellLifetimeRange     : CGFloat = 0,
continuousFuseDesired       : Bool = false,
repeatingFuseDesired        : Bool = false,
timeBetweenRepeatsInSeconds : CGFloat = 0.5)

如果您希望为您的 fuse 效果指定更复杂的表情符号图案,您可以构建一个表情符号数组。 该图案将在指定的索引范围内重复。 通常,您会让索引覆盖您的整个池。


var arrayOfEmoji = [String]()

arrayOfEmoji.removeAll() // removeAll just in case you already built the array with different emoji already

for _ in 1...4 { arrayOfEmoji.append("🦄") }
for _ in 1...3 { arrayOfEmoji.append("🐝") }
for _ in 1...2 { arrayOfEmoji.append("🐞") }
for _ in 1...1 { arrayOfEmoji.append("🦋") }

litFuse.alternateCellImagesWithGivenArrayOfEmojiOrTextForDesiredRangeOfEmitters(
desiredArrayAsText: arrayOfEmoji,
startIndex: 1,
endIndex: 400)

除了使用表情符号,您还可以指定一个短文本字符串,例如“Hi”,但这并不是一个经过彻底设计的功能。 它只有一种字体和一种颜色,白色。 但是,可以通过指定 tint 参数来调整颜色。 例如,要获得红色文本,请指定

endingTint: .red,

在此自述文件中搜索“endingTint”以查看我们如何使用它。

如果您想提供自己的图像,则需要在将其传递给我们的 API 之前缩放该图像。 大约 100 像素宽(或更小)是一个不错的起始大小。 这是我们 API 的示例调用


litFuse.useSpecifiedImageAsContentsForDesiredRangeOfEmitters(specifiedImage: tempImageToUseWhenChangingCellImages, startIndex: 1, endIndex: 400)

其中 tempImageToUseWhenChangingCellImages 是一个 UIImage。

如果您想将您的 fuse 路径放置在一条线上,这里有一些示例代码


let pointOne = CGPoint(x: 100, y: 100) 
let pointTwo = CGPoint(x: 200, y: 200)

litFuse.placeEmittersOnSpecifiedLine(
startingPoint: pointOne,
endingPoint: pointTwo,
startIndex: 1,
endIndex: 400)

如果您想将您的 fuse 路径放置在一个圆圈上,这里有一些示例代码


litFuse.placeEmittersOnSpecifiedCircleOrArc(
thisCircleCenter: CGPoint(x: 500, y: 700),
thisCircleRadius: 400,
thisCircleArcFactor: 1.0,
startIndex : 1,
endIndex: 400,
offsetAngleInDegrees: 45)

请注意,thisCircleArcFactor 为 1 时绘制一个完整的圆。 值 0.5 将绘制半圆的弧。 然后,offsetAngleInDegrees 将控制半圆在屏幕上显示的哪个角度。

对 thisCircleArcFactor 使用值 3 将使 fuse 路径环绕圆圈 3 次。

为了梳理发射器,使其路径从圆圈辐射出来,这里有一些示例代码


litFuse.placeEmittersOnSpecifiedCircleOrArc(thisCircleCenter: CGPoint(x: 512, y: 800), thisCircleRadius: 600, thisCircleArcFactor: 1, startIndex : 1, endIndex: 400, offsetAngleInDegrees: 123, scaleFactor: 0.5)

litFuse.setFuseEmitterPhases(onlyUseInitialPlacementLogic: true)

litFuse.combCircularEmittersToPointInDesiredDirections(desiredOffsetAngleForCellFlow : 180,
desiredOffsetAngleForShape : 123,
coneWideningFactorNormallyZero: 0,
combArcFactor: 1,
startIndex: 1,
endIndex: 400)

litFuse.createLitFuseEffectForDesiredRangeOfEmitters(
startIndex : 1,
endIndex : 400,
initialVelocity : 100,
initialVelocityRange : 100,
initialBirthRate : 50,
initialScale : 0.1,
fuseBurningVelocity : 100,
fuseBurningVelocityRange: 100,
fuseBurningBirthRate : 2800,
fuseBurningScale : 0.1,
endingVelocity : 100,
endingVelocityRange : 100,
endingBirthRate : 5,
endingScale : 0.1,
stepsPerFrame : 1,
initialCellLifetime: 1.0,
fuseBurningCellLifetime: 1.0,
endingCellLifetime: 1.0,
continuousFuseDesired: true)

如果您想停止梳理效果,您需要调用这些 API


litFuse.setFuseEmitterPhases(onlyUseInitialPlacementLogic: false)

// And stop the actual combing.
litFuse.stopCombingTheEmitters(startIndex : 1, endIndex: 400)

我们包含了一个 API,可让您的设计在任何指定的时间段自动更改表情符号。 请注意,您一次只能运行其中一个。 您的表情符号更改可以是任何长度,并且表情符号进入一个数组以作为参数传递。 这是代码


var thisArrayAsText = [String]()

thisArrayAsText.append("🦄")
thisArrayAsText.append("🐝")
thisArrayAsText.append("🐞")
thisArrayAsText.append("👀")

litFuse.cycleToNewCellImageFromTextStringForDesiredRangeOfEmittersAtDesiredRate(desiredArrayAsText: thisArrayAsText, startIndex: 1, endIndex: 400, timeBetweenChanges: 1.25)

许可

尚未为此项目指定许可。 它有点实验性质。 我正在与一些小组分享它,并允许他们进行实验以获得反馈。 这是我在 GitHub 上的第二个 Swift 包,对我来说是一个学习经验。 此项目将来可能会在 MIT 许可下共享。 如果您找到了此存储库,您可以随意进行实验。 如果您想使用它发布代码,请尽早通过电子邮件 engineermichigan@gmail.com 与我联系以获得批准。 如果您是小型企业,那么批准应该没问题,无需考虑。 但是任何大型组织都应该与我达成协议。 考虑申请专利、组建团队等可能是有意义的。 随时就改进或请求以及任何反馈与我联系。 我能很好地接受批评,并且欢迎好的建议。

电子邮件:engineermichigan@gmail.com

如果有任何学生或开发人员想要进行实验并进行改进或 fork 设计,我将考虑合作。

请注意,如果您为单元指定非常高的出生率(数千个),或者指定大量的发射器池(再次,数千个),或者您指定较长的单元寿命,或者您一次显示许多 lit fuse,则可能会使 GPU 过载并体验到延迟。 即使单元比例也可能会起作用,因为 GPU 尝试处理与较大单元图像相关的增加的工作负载。 因此,您可能首先尝试保守一点。

话虽如此,我认为您将很容易找到这些属性的合理值,以便实现一些有趣和艺术的效果。 在游戏、广告、社交媒体以及任何向用户展示艺术的应用程序中都有潜在的用例。

初始用例可能会选择在应用程序中所需事件处排队的短时持续效果。

如果您想在显示 fuse 后隐藏它,只需调用 hideAllEmitters,它会将寿命设置为零,从而有效地隐藏所有单元。


litFuse.hideAllEmitters()

尝试将这些效果与用户在屏幕上的滑动操作结合起来可能会很有趣。

让开发人员为发射器指定要遵循的真实路径,而不是指定的圆形、线条和矩形,这可能会很有趣。

现在有一些 API 具有实验性质。 它们将 alpha 速度或比例速度与单元的指定寿命耦合,以便单元将在指定的单元寿命内淡化为不可见,或者比例将缩小为零。

这是对这些实验性 API 的示例调用。 比例速度 API 比 alpha 速度 API 更稳定。


litFuse.syncAlphaSpeedToFadeOverLifetimeDesired(syncDesired: true)
litFuse.syncScaleSpeedToShrinkOverLifetimeDesired(syncDesired: true)

如果时间允许,我将尝试发布一些新的包,这些包依赖于 LitFuseBasicPackage,以协调来自包库的多个 lit fuse 效果。 我已经试验过一个可以让您在两端燃烧 fuse 的效果,它看起来非常艺术。

— Mike

附言:如果您想运行我的驱动程序代码,以下是我的整个 ViewController.swift 的复制粘贴。 不用担心照片丢失。 代码仍然可以构建和运行,但您不会像在我的视频链接中那样看到照片。 请注意,所有内容都针对 iPad Pro 进行了缩放,因此如果您只有 iPhone 可以进行实验,则需要更改一些值。 您可以将屏幕左下角显示的计数器关联起来,以找到每个绘制的 fuse 的驱动代码。 只需检查 touchesBegan 并将其与变量 countOfTouches 相关联。 如果您想复制视频中的效果,只需使用与显示的计数器相关的相同参数。


//
//  ViewController.swift
//  LitFuseBasicPackageDriver
//
//  Created by Michael Kucinski on 7/22/20.
//  Copyright © 2020 Michael Kucinski. All rights reserved.
//

import UIKit
import LitFuseBasicPackage

class ViewController: UIViewController {

var readMeTextView = UITextView()
var countView = UITextView()

let litFuse = LitFuseBasicViewController()

var arrayOfEmoji = [String]()

var kidsImageView = UIImageView()
var kidsCircleImageView = UIImageView()

override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.

kidsImageView.image =  UIImage(named: "kids.jpg")
kidsCircleImageView.image =  UIImage(named: "kidsCircle.png")

kidsImageView.frame = CGRect(x: 270, y:  920, width: 520, height: 390)
kidsCircleImageView.frame = CGRect(x: 260, y:  300, width: 500, height: 500)
self.view.addSubview(kidsImageView)
self.view.addSubview(kidsCircleImageView)

kidsCircleImageView.alpha = 0

readMeTextView.frame = CGRect(x: 100, y:  50, width: 845, height: 800)
readMeTextView.textAlignment = NSTextAlignment.justified
readMeTextView.backgroundColor = UIColor.purple
readMeTextView.layer.borderColor = UIColor.blue.cgColor
readMeTextView.layer.borderWidth = 10.0
readMeTextView.font = UIFont.systemFont(ofSize: 32.0)
readMeTextView.textContainerInset = UIEdgeInsets(top: 20, left: 20, bottom: 20, right: 20)
readMeTextView.textColor = .white
readMeTextView.text = "This library lets you trace a variety of shapes with any number of emitters.  The emitters are presented in a burning fuse like fashion.\n\nShapes currently supported are circles, rectangles, and lines.\n\nYou can specify the frame of a photo or the frame of any object to use with this lit fuse effect! 😎 \n\nThe emitted cells are highly configurable.\n\nThe cells can contain any combination of emoji or short text strings.\n\nThe emitters starting size, fuse burning size, and ending size are specified in a call to a single API.\n\nSimilarly, the emitted cell velocities for starting, fuse burning, and ending state can be specified."
self.view.addSubview(readMeTextView)
readMeTextView.isEditable = false
readMeTextView.allowsEditingTextAttributes = true // allows memoji
readMeTextView.isUserInteractionEnabled = false
readMeTextView.alpha = 0

countView.frame = CGRect(x: 20, y:  1300, width: 550, height: 50)
countView.textAlignment = NSTextAlignment.center
countView.backgroundColor = UIColor.blue
countView.layer.borderColor = UIColor.orange.cgColor
countView.layer.borderWidth = 5.0
countView.font = UIFont.systemFont(ofSize: 24.0)
countView.textContainerInset = UIEdgeInsets(top: 10, left: 4, bottom: 4, right: 4)
countView.textColor = .white
countView.text = "Tap screen to walk through examples."
self.view.addSubview(countView)
countView.isEditable = false
countView.allowsEditingTextAttributes = true // allows memoji
countView.isUserInteractionEnabled = false

litFuse.viewDidLoad()

litFuse.createPoolOfEmitters(maxCountOfEmitters : 400, someEmojiCharacter: "🧠")

for thisEmitter in litFuse.arrayOfEmitters { view.layer.addSublayer(thisEmitter) }

litFuse.setCellImageFromTextStringForDesiredRangeOfEmitters(
desiredImageAsText: "🟡",
startIndex: 1,
endIndex: 300)

litFuse.setCellImageFromTextStringForDesiredRangeOfEmitters(
desiredImageAsText: "🔵",
startIndex: 301,
endIndex: 400)

var tempRect : CGRect = CGRect(
x: 100,
y: 300,
width: 300,
height: 300)

litFuse.placeEmittersOnSpecifiedRectangle(thisRectangle: tempRect,
startIndex: 1,
endIndex: 200)

tempRect = CGRect(
x: 500,
y: 300,
width: 300,
height: 300)

litFuse.placeEmittersOnSpecifiedRectangle(
thisRectangle: tempRect,
startIndex: 201,
endIndex: 400)

litFuse.createLitFuseEffectForDesiredRangeOfEmitters( startIndex : 1,
endIndex : 400,
initialVelocity : 0,
initialBirthRate : 5,
initialScale : 0,
fuseBurningVelocity : 500,
fuseBurningBirthRate : 4800,
fuseBurningScale : 0.15,
endingVelocity : 0,
endingBirthRate : 5,
endingScale : 0.5,
stepsPerFrame : 1,
initialCellLifetime: 0.2,
fuseBurningCellLifetime: 0.2,
endingCellLifetime: 0.2,
continuousFuseDesired : true)

arrayOfEmoji.removeAll()

for _ in 1...4 { arrayOfEmoji.append("🦄") }
for _ in 1...3 { arrayOfEmoji.append("🐝") }
for _ in 1...2 { arrayOfEmoji.append("🐞") }
for _ in 1...1 { arrayOfEmoji.append("👀") }

litFuse.alternateImageContentsWithGivenArrayOfEmojiOrTextForDesiredRangeOfEmitters(
desiredArrayAsText: arrayOfEmoji,
startIndex: 1,
endIndex: 400)

litFuse.createLitFuseEffectForDesiredRangeOfEmitters( startIndex : 1,
endIndex : 400,
initialVelocity : 0,
initialBirthRate : 5,
initialScale : 0,
fuseBurningVelocity : 100,
fuseBurningBirthRate : 800,
fuseBurningScale : 0.4,
endingVelocity : 0,
endingBirthRate : 5,
endingScale : 0.5,
stepsPerFrame : 1,
initialCellLifetime: 0.2,
fuseBurningCellLifetime: 2.8,
endingCellLifetime: 0.2,
continuousFuseDesired: true)

let pointOne = CGPoint(x: 100, y: 100)

let pointTwo = CGPoint(x: 800, y: 1200)

litFuse.placeEmittersOnSpecifiedLine(
startingPoint: pointOne,
endingPoint: pointTwo,
startIndex: 1,
endIndex: 400)

/*
litFuse.placeEmittersOnSpecifiedCircleOrArc(
thisCircleCenter: CGPoint(x: 500, y: 700),
thisCircleRadius: 200,
thisCircleArcFactor: 1,
startIndex : 1,
endIndex: 400,
offsetAngleInDegrees: 45)
*/

litFuse.createLitFuseEffectForDesiredRangeOfEmitters( startIndex : 1,
endIndex : 400,
initialVelocity : 0,
initialBirthRate : 15,
initialScale : 0.7,
initialSpin: -1,

//initialAcceleration_Y: 0,
initialTint: .cyan,
fuseBurningVelocity : 100,
fuseBurningBirthRate : 200,
fuseBurningScale : 0.5,
fuseBurningSpin: 1,
fuseBurningTint: .green,
//fuseBurningAcceleration_Y: 135500,

endingVelocity : 80,
endingBirthRate : 5,
endingScale : 0.5,
endingSpin: -1,
endingTint: .red,
stepsPerFrame : 1,
initialCellLifetime: 1,
fuseBurningCellLifetime: 2,
endingCellLifetime: 1.2,
continuousFuseDesired: true)



//litFuse.syncAlphaSpeedToFadeOverLifetimeDesired(syncDesired: true)
//litFuse.syncScaleSpeedToShrinkOverLifetimeDesired(syncDesired: true)

//let textOrEmojiToUIImage = UILabel(frame: CGRect(x: 0, y: 0, width: 100, height: 100))

//textOrEmojiToUIImage.text = "🐷"
//textOrEmojiToUIImage.sizeToFit()

//let tempImageToUseWhenChangingCellImages  =  UIImage.imageWithLabel(label: textOrEmojiToUIImage)

//litFuse.useSpecifiedImageAsContentsForDesiredRangeOfEmitters(specifiedImage: tempImageToUseWhenChangingCellImages, startIndex: 1, endIndex: 400)

kidsImageView.alpha = 0

} // ends viewDidLoad

var countOfTouches = -1

// stub
//var countOfTouches = 27

// Detect touch
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?)
{
if countOfTouches == -1
{
litFuse.hideAllEmitters()

readMeTextView.alpha = 0
kidsImageView.alpha = 0

}
if countOfTouches == 0
{
kidsImageView.alpha = 1
readMeTextView.alpha = 1
readMeTextView.frame = CGRect(x: 100, y:  50, width: 845, height: 800)
readMeTextView.text = "This library lets you trace a variety of shapes with any number of emitters.  The emitters are presented in a burning fuse like fashion.\n\nShapes currently supported are circles, rectangles, and lines.\n\nYou can specify the frame of a photo or the frame of any object to use with this lit fuse effect! 😎 \n\nThe emitted cells are highly configurable.\n\nThe cells can contain any combination of emoji or short text strings.\n\nThe emitters starting size, fuse burning size, and ending size are specified in a call to a single API.\n\nThe emitted cell velocities for starting, fuse burning, and ending state can be specified."
kidsImageView.frame = CGRect(x: 270, y:  920, width: 520, height: 390)
kidsCircleImageView.frame = CGRect(x: 260, y:  300, width: 500, height: 500)

litFuse.setCellImageFromTextStringForDesiredRangeOfEmitters(desiredImageAsText: "🟡", startIndex: 1, endIndex: 300)
litFuse.setCellImageFromTextStringForDesiredRangeOfEmitters(desiredImageAsText: "🔵", startIndex: 301, endIndex: 400)

litFuse.placeEmittersOnSpecifiedRectangle(thisRectangle: readMeTextView.frame, startIndex: 1, endIndex: 300, scaleFactor: 1.0, counterClockwiseDesired: true)
litFuse.placeEmittersOnSpecifiedRectangle(thisRectangle: kidsImageView.frame, startIndex: 301, endIndex: 400, scaleFactor: 1.0)

litFuse.createLitFuseEffectForDesiredRangeOfEmitters(
startIndex : 1,
endIndex : 400,
initialVelocity : 0,
initialBirthRate : 5,
initialScale : 0,
fuseBurningVelocity : 500,
fuseBurningBirthRate : 5800,
fuseBurningScale : 0.15,
endingVelocity : 0,
endingBirthRate : 5,
endingScale : 0.5,
stepsPerFrame : 1,
initialCellLifetime: 0.2,
fuseBurningCellLifetime: 0.2,
endingCellLifetime: 0.2)

var thisArrayAsText = [String]()

thisArrayAsText.append("🦄")
thisArrayAsText.append("🐝")
thisArrayAsText.append("🐞")
thisArrayAsText.append("👀")

//litFuse.cycleToNewCellImageFromTextStringForDesiredRangeOfEmittersAtDesiredRate(desiredArrayAsText: thisArrayAsText, startIndex: 1, endIndex: 400, timeBetweenChanges: 1.25)

}

if countOfTouches == 1
{
litFuse.hideAllEmitters()
kidsImageView.alpha = 0

readMeTextView.alpha = 0

readMeTextView.frame = CGRect(x: 100, y:  30, width: 845, height: 190)
}
if countOfTouches == 2
{
kidsImageView.alpha = 1

readMeTextView.alpha = 1

readMeTextView.text = "The lit fuse effect works with both rectangular and circular photos and objects.  You can simply specify the frame of an object for any rectangle.  You can specify a radius and center point for a circle. "

kidsImageView.alpha = 1
kidsCircleImageView.alpha = 1

litFuse.setCellImageFromTextStringForDesiredRangeOfEmitters(desiredImageAsText: " ", startIndex: 1, endIndex: 70)
litFuse.setCellImageFromTextStringForDesiredRangeOfEmitters(desiredImageAsText: "🇺🇸", startIndex: 71, endIndex: 360)
litFuse.setCellImageFromTextStringForDesiredRangeOfEmitters(desiredImageAsText: "Hi", startIndex: 361, endIndex: 400)

litFuse.placeEmittersOnSpecifiedCircleOrArc(thisCircleCenter: kidsCircleImageView.center, thisCircleRadius: kidsCircleImageView.frame.width/2, thisCircleArcFactor: 1, startIndex : 71, endIndex: 360, offsetAngleInDegrees: 90, scaleFactor: 1.0)

litFuse.placeEmittersOnSpecifiedRectangle(thisRectangle: kidsImageView.frame, startIndex: 361, endIndex: 400, scaleFactor: 1.2)

litFuse.placeEmittersOnSpecifiedRectangle(thisRectangle: readMeTextView.frame, startIndex: 1, endIndex: 70, scaleFactor: 1.2)

litFuse.createLitFuseEffectForDesiredRangeOfEmitters(
startIndex : 1,
endIndex : 400,
initialVelocity : 0,
initialBirthRate : 5,
initialScale : 1.3,
initialTint: .yellow,
fuseBurningVelocity : 500,
fuseBurningBirthRate : 800,
fuseBurningScale : 0.45,
fuseBurningTint: .white,
endingVelocity : 0,
endingBirthRate : 5,
endingScale : 1.3,
endingTint: .red,
stepsPerFrame : 1,
initialCellLifetime: 0.2,
fuseBurningCellLifetime: 0.2,
endingCellLifetime: 0.2,
repeatingFuseDesired   : true,
timeBetweenRepeatsInSeconds: 3.5)
}

if countOfTouches == 3
{
litFuse.hideAllEmitters()
kidsImageView.alpha = 0
kidsCircleImageView.alpha = 0
kidsCircleImageView.frame = CGRect(x: 260, y:  400, width: 500, height: 500)

readMeTextView.alpha = 0

readMeTextView.frame = CGRect(x: 100, y:  50, width: 845, height: 150)
}
if countOfTouches == 4
{
readMeTextView.alpha = 1

readMeTextView.text = "Circular and rectangular based emitter shapes can be drawn with any desired scale factor.  Here we used 4 different scale factors on half sections of circles."

kidsImageView.alpha = 0
kidsCircleImageView.alpha = 1

//litFuse.desiredRangeOfVisibleEmitters(startIndex: 1, endIndex: 400)

litFuse.setCellImageFromTextStringForDesiredRangeOfEmitters(desiredImageAsText: "😎", startIndex: 1, endIndex: 100)
litFuse.setCellImageFromTextStringForDesiredRangeOfEmitters(desiredImageAsText: "⏰", startIndex: 101, endIndex: 200)
litFuse.setCellImageFromTextStringForDesiredRangeOfEmitters(desiredImageAsText: "🤯", startIndex: 201, endIndex: 300)
litFuse.setCellImageFromTextStringForDesiredRangeOfEmitters(desiredImageAsText: "🌎", startIndex: 301, endIndex: 400)

litFuse.placeEmittersOnSpecifiedCircleOrArc(thisCircleCenter: kidsCircleImageView.center, thisCircleRadius: kidsCircleImageView.frame.width/4, thisCircleArcFactor: 0.5, startIndex : 1, endIndex: 100, offsetAngleInDegrees: -90, scaleFactor: 2.0)
litFuse.placeEmittersOnSpecifiedCircleOrArc(thisCircleCenter: kidsCircleImageView.center, thisCircleRadius: kidsCircleImageView.frame.width/4, thisCircleArcFactor: -0.5, startIndex : 101, endIndex: 200, offsetAngleInDegrees: 90, scaleFactor: 2.3)
litFuse.placeEmittersOnSpecifiedCircleOrArc(thisCircleCenter: kidsCircleImageView.center, thisCircleRadius: kidsCircleImageView.frame.width/4, thisCircleArcFactor: 0.5, startIndex : 201, endIndex: 300, offsetAngleInDegrees: -90, scaleFactor: 2.6)
litFuse.placeEmittersOnSpecifiedCircleOrArc(thisCircleCenter: kidsCircleImageView.center, thisCircleRadius: kidsCircleImageView.frame.width/4, thisCircleArcFactor: -0.5, startIndex : 301, endIndex: 400, offsetAngleInDegrees: 90, scaleFactor: 2.9)

litFuse.createLitFuseEffectForDesiredRangeOfEmitters(
startIndex : 1,
endIndex : 400,
initialVelocity : 0,
initialBirthRate : 5,
initialScale : 1,
fuseBurningVelocity : 150,
fuseBurningBirthRate : 2200,
fuseBurningScale : 0.08,
endingVelocity : 0,
endingBirthRate : 2,
endingScale : 0,
stepsPerFrame : 1,
initialCellLifetime: 0.5,
fuseBurningCellLifetime: 0.5,
endingCellLifetime: 0.5,
continuousFuseDesired: true)
}
if countOfTouches == 5
{
litFuse.hideAllEmitters()

readMeTextView.alpha = 0
}
if countOfTouches == 6
{
readMeTextView.alpha = 1

readMeTextView.text = "You can specify any scale factor in the API calls that result in any desired standoff distance from any object or any shape."

kidsImageView.alpha = 1
kidsCircleImageView.alpha = 0
kidsImageView.frame = CGRect(x: 270, y:  520, width: 520, height: 390)

litFuse.setCellImageFromTextStringForDesiredRangeOfEmitters(desiredImageAsText: "🅰️", startIndex: 1, endIndex: 80)
litFuse.setCellImageFromTextStringForDesiredRangeOfEmitters(desiredImageAsText: "🆗", startIndex: 81, endIndex: 160)
litFuse.setCellImageFromTextStringForDesiredRangeOfEmitters(desiredImageAsText: "☮️", startIndex: 161, endIndex: 240)
litFuse.setCellImageFromTextStringForDesiredRangeOfEmitters(desiredImageAsText: "🚼", startIndex: 241, endIndex: 320)
litFuse.setCellImageFromTextStringForDesiredRangeOfEmitters(desiredImageAsText: "🅿️", startIndex: 321, endIndex: 400)

litFuse.placeEmittersOnSpecifiedRectangle(thisRectangle: kidsImageView.frame, startIndex: 1, endIndex: 80, scaleFactor: 1.1)
litFuse.placeEmittersOnSpecifiedRectangle(thisRectangle: kidsImageView.frame, startIndex: 81, endIndex: 160, scaleFactor: 1.3)
litFuse.placeEmittersOnSpecifiedRectangle(thisRectangle: kidsImageView.frame, startIndex: 161, endIndex: 240, scaleFactor: 1.5)
litFuse.placeEmittersOnSpecifiedRectangle(thisRectangle: kidsImageView.frame, startIndex: 241, endIndex: 320, scaleFactor: 1.67)
litFuse.placeEmittersOnSpecifiedRectangle(thisRectangle: kidsImageView.frame, startIndex: 321, endIndex: 400, scaleFactor: 1.85)

litFuse.createLitFuseEffectForDesiredRangeOfEmitters(
startIndex : 1,
endIndex : 400,
initialVelocity : 0,
initialBirthRate : 5,
initialScale : 0,
fuseBurningVelocity : 150,
fuseBurningBirthRate : 1500,
fuseBurningScale : 0.1,
endingVelocity : 0,
endingBirthRate : 5,
endingScale : 0.5,
stepsPerFrame : 1,
initialCellLifetime: 0.3,
fuseBurningCellLifetime: 0.3,
endingCellLifetime: 0.3)
}
if countOfTouches == 7
{
litFuse.hideAllEmitters()

readMeTextView.alpha = 0
}
if countOfTouches == 8
{
readMeTextView.alpha = 1

readMeTextView.frame = CGRect(x: 100, y:  50, width: 845, height: 363)
readMeTextView.text = "You can specify any desired pattern of colorful emoji to be used as the sparks for the lit fuse.  Using many colored emojis results in fuses that burn with any desired color scheme as long as those colors can be found in any of Apples emoji.\n\nPlease note that there are ways to tint the cells as desired."

kidsImageView.alpha = 0
//kidsImageView.frame = CGRect(x: 270, y:  520, width: 520, height: 390)

arrayOfEmoji.removeAll()

for _ in 1...50
{
arrayOfEmoji.append("🔴")
}
for _ in 1...50
{
arrayOfEmoji.append("🟡")
}
for _ in 1...50
{
arrayOfEmoji.append("💥")
}
for _ in 1...50
{
arrayOfEmoji.append("🔕")
}
for _ in 1...50
{
arrayOfEmoji.append("🍀")
}
for _ in 1...50
{
arrayOfEmoji.append("🟣")
}
for _ in 1...1
{
for _ in 1...20
{
arrayOfEmoji.append("👀")
}
for _ in 1...20
{
arrayOfEmoji.append("🥶")
}

for _ in 1...20
{
arrayOfEmoji.append("🍇")
}
for _ in 1...20
{
arrayOfEmoji.append("🥎")
}
for _ in 1...20
{
arrayOfEmoji.append("🎁")
}
}

litFuse.alternateImageContentsWithGivenArrayOfEmojiOrTextForDesiredRangeOfEmitters(desiredArrayAsText: arrayOfEmoji, startIndex: 1, endIndex: 400)

litFuse.placeEmittersOnSpecifiedCircleOrArc(thisCircleCenter: CGPoint(x: 500, y: 900), thisCircleRadius: 300, thisCircleArcFactor: 1, startIndex : 1, endIndex: 400, offsetAngleInDegrees: 90, scaleFactor: 1.0)

litFuse.createLitFuseEffectForDesiredRangeOfEmitters(
startIndex : 1,
endIndex : 400,
initialVelocity : 0,
initialBirthRate : 5,
initialScale : 0.0,
fuseBurningVelocity : 1000,
fuseBurningBirthRate : 2800,
fuseBurningScale : 1.5,
endingVelocity : 0,
endingBirthRate : 10,
endingScale : 1.5,
stepsPerFrame : 1,
initialCellLifetime: 0.2,
fuseBurningCellLifetime: 0.2,
endingCellLifetime: 0.2)
}

if countOfTouches == 9
{
litFuse.hideAllEmitters()

readMeTextView.alpha = 0
}
if countOfTouches == 10
{
readMeTextView.alpha = 1

readMeTextView.frame = CGRect(x: 100, y:  50, width: 845, height: 122)
readMeTextView.text = "You can command a lit fuse to burn continuously at any rate."

kidsImageView.alpha = 0

arrayOfEmoji.removeAll()

for _ in 1...10
{
arrayOfEmoji.append("🔴")
}
for _ in 1...10
{
arrayOfEmoji.append("🟡")
}
for _ in 1...10
{
arrayOfEmoji.append("🔵")
}
for _ in 1...10
{
arrayOfEmoji.append("🟠")
}
for _ in 1...10
{
arrayOfEmoji.append("🟢")
}
for _ in 1...10
{
arrayOfEmoji.append("🟣")
}

litFuse.alternateImageContentsWithGivenArrayOfEmojiOrTextForDesiredRangeOfEmitters(desiredArrayAsText: arrayOfEmoji, startIndex: 1, endIndex: 400)

litFuse.placeEmittersOnSpecifiedCircleOrArc(thisCircleCenter: CGPoint(x: 550, y: 700), thisCircleRadius: 600, thisCircleArcFactor: 1, startIndex : 1, endIndex: 400, offsetAngleInDegrees: 90, scaleFactor: 0.5)

litFuse.createLitFuseEffectForDesiredRangeOfEmitters(
startIndex : 1,
endIndex : 400,
initialVelocity : 0,
initialBirthRate : 50,
initialScale : 0.4,
fuseBurningVelocity : 100,
fuseBurningBirthRate : 2800,
fuseBurningScale : 0.4,
endingVelocity : 0,
endingBirthRate : 5,
endingScale : 0.4,
stepsPerFrame : 1,
initialCellLifetime: 1.0,
fuseBurningCellLifetime: 1.0,
endingCellLifetime: 1.0,
continuousFuseDesired: true)
}

if countOfTouches == 11
{
litFuse.hideAllEmitters()
}
if countOfTouches == 12
{
//litFuse.hideAllEmitters()

litFuse.createLitFuseEffectForDesiredRangeOfEmitters(
startIndex : 1,
endIndex : 400,
initialVelocity : 0,
initialBirthRate : 15,
initialScale : 0.1,
fuseBurningVelocity : 1000,
fuseBurningBirthRate : 2800,
fuseBurningScale : 0.25,
endingVelocity : 0,
endingBirthRate : 5,
endingScale : 0.4,
stepsPerFrame : 5,
initialCellLifetime: 1.0,
fuseBurningCellLifetime: 1.0,
endingCellLifetime: 1.0,
continuousFuseDesired: true)
}
if countOfTouches == 13
{
litFuse.hideAllEmitters()
}
if countOfTouches == 14
{
litFuse.placeEmittersOnSpecifiedCircleOrArc(thisCircleCenter: CGPoint(x: 550, y: 700), thisCircleRadius: 600, thisCircleArcFactor: -1, startIndex : 1, endIndex: 400, offsetAngleInDegrees: 90, scaleFactor: 0.5)

litFuse.createLitFuseEffectForDesiredRangeOfEmitters(
startIndex : 1,
endIndex : 400,
initialVelocity : 0,
initialBirthRate : 15,
initialScale : 0.1,
fuseBurningVelocity : 70,
fuseBurningBirthRate : 2800,
fuseBurningScale : 0.25,
endingVelocity : 0,
endingBirthRate : 5,
endingScale : 0.4,
stepsPerFrame : 1,
initialCellLifetime: 1.0,
fuseBurningCellLifetime: 1.0,
endingCellLifetime: 1.0,
continuousFuseDesired: true)
}
if countOfTouches == 15
{
litFuse.hideAllEmitters()
}
if countOfTouches == 16
{
readMeTextView.text = "You can choose an arc factor that can draw sub-arcs, or even wrap around the circle by any percent factor"

litFuse.placeEmittersOnSpecifiedCircleOrArc(thisCircleCenter: CGPoint(x: 550, y: 700), thisCircleRadius: 600, thisCircleArcFactor: -0.5, startIndex : 1, endIndex: 400, offsetAngleInDegrees: 90, scaleFactor: 0.5)

litFuse.createLitFuseEffectForDesiredRangeOfEmitters(
startIndex : 1,
endIndex : 400,
initialVelocity : 0,
initialBirthRate : 15,
initialScale : 0.4,
fuseBurningVelocity : 70,
fuseBurningBirthRate : 2800,
fuseBurningScale : 0.4,
endingVelocity : 0,
endingBirthRate : 5,
endingScale : 0.4,
stepsPerFrame : 1,
initialCellLifetime: 1.0,
fuseBurningCellLifetime: 1.0,
endingCellLifetime: 1.0,
continuousFuseDesired: true)
}
if countOfTouches == 17
{
litFuse.hideAllEmitters()
readMeTextView.alpha = 1
}
if countOfTouches == 18
{
readMeTextView.text = "You can tint the emitted cells with differrent colors at initial placement, during fuse burning, and at ending state."

let pointOne = CGPoint(x: 200, y: 800)
let pointTwo = CGPoint(x: 900, y: 1300)

litFuse.placeEmittersOnSpecifiedLine(startingPoint: pointOne, endingPoint: pointTwo, startIndex: 1, endIndex: 400)

arrayOfEmoji.removeAll()

for _ in 1...4 { arrayOfEmoji.append("🦄") }
for _ in 1...3 { arrayOfEmoji.append("🐝") }
for _ in 1...2 { arrayOfEmoji.append("🐞") }
for _ in 1...1 { arrayOfEmoji.append("👀") }

litFuse.alternateImageContentsWithGivenArrayOfEmojiOrTextForDesiredRangeOfEmitters(
desiredArrayAsText: arrayOfEmoji,
startIndex: 1,
endIndex: 400)

litFuse.syncScaleSpeedToShrinkOverLifetimeDesired(syncDesired: true)

litFuse.createLitFuseEffectForDesiredRangeOfEmitters(
startIndex : 1,
endIndex : 400,
initialVelocity : 50,
initialBirthRate : 55,
initialScale : 0.2,
initialSpin: -1,
initialTint: .orange,
fuseBurningVelocity : 100,
fuseBurningBirthRate : 200,
fuseBurningScale : 1.5,
fuseBurningSpin: 1,
fuseBurningTint: .white,
endingVelocity : 80,
endingBirthRate : 5,
endingScale : 0.5,
endingSpin: -1,
endingTint: .cyan,
stepsPerFrame : 1,
initialCellLifetime: 0.5,
fuseBurningCellLifetime: 4.5,
endingCellLifetime: 8.2)
}
if countOfTouches == 19
{
litFuse.hideAllEmitters()
readMeTextView.alpha = 0
litFuse.syncScaleSpeedToShrinkOverLifetimeDesired(syncDesired: false)

}
if countOfTouches == 20
{
readMeTextView.frame = CGRect(x: 100, y:  50, width: 845, height: 222)
readMeTextView.text = "You can command a lit fuse to burn periodically with a specified gap between.\n\nNote this fuse burns and leaves a trail behind as it burns."
readMeTextView.alpha = 1

//litFuse.desiredRangeOfVisibleEmitters(startIndex: 1, endIndex: 400)

litFuse.setCellImageFromTextStringForDesiredRangeOfEmitters(desiredImageAsText: "🟡", startIndex: 1, endIndex: 200)
litFuse.setCellImageFromTextStringForDesiredRangeOfEmitters(desiredImageAsText: "🔵", startIndex: 201, endIndex: 400)

let pointOne = CGPoint(x: 100, y: 400)
let pointTwo = CGPoint(x: 800, y: 1200)

litFuse.placeEmittersOnSpecifiedLine(startingPoint: pointOne, endingPoint: pointTwo, startIndex: 1, endIndex: 400)

litFuse.createLitFuseEffectForDesiredRangeOfEmitters(
startIndex : 1,
endIndex : 400,
initialVelocity : 0,
initialBirthRate : 1.5,
initialScale : 0,
fuseBurningVelocity : 500,
fuseBurningBirthRate : 1111,
fuseBurningScale : 0.25,
endingVelocity : 0,
endingBirthRate : 5,
endingScale : 0.2,
stepsPerFrame : 1,
initialCellLifetime: 0.2,
fuseBurningCellLifetime: 0.2,
endingCellLifetime: 0.2,
repeatingFuseDesired: true,
timeBetweenRepeatsInSeconds: 1)
}

if countOfTouches == 21
{
litFuse.hideAllEmitters()
}
if countOfTouches == 22
{
readMeTextView.frame = CGRect(x: 100, y:  50, width: 845, height: 122)
readMeTextView.text = "Note that this fuse burns the trail and leaves nothing behind."
readMeTextView.alpha = 1

let pointOne = CGPoint(x: 500, y: 400)
let pointTwo = CGPoint(x: 500, y: 1200)

arrayOfEmoji.removeAll()

arrayOfEmoji.append("💙")
arrayOfEmoji.append("💙")
arrayOfEmoji.append("💙")
arrayOfEmoji.append("💙")
arrayOfEmoji.append("💙")
arrayOfEmoji.append("💙")
arrayOfEmoji.append("💙")
arrayOfEmoji.append("💙")
arrayOfEmoji.append("💙")
arrayOfEmoji.append("💙")
arrayOfEmoji.append("💙")
arrayOfEmoji.append("💙")
arrayOfEmoji.append("💙")
arrayOfEmoji.append("💙")
arrayOfEmoji.append("💙")
arrayOfEmoji.append("💝")
arrayOfEmoji.append("💝")
arrayOfEmoji.append("💝")
arrayOfEmoji.append("💝")
arrayOfEmoji.append("💝")
arrayOfEmoji.append("💝")
arrayOfEmoji.append("💝")
arrayOfEmoji.append("💝")
arrayOfEmoji.append("💝")
arrayOfEmoji.append("💝")
arrayOfEmoji.append("💝")
arrayOfEmoji.append("💝")
arrayOfEmoji.append("💝")
arrayOfEmoji.append("💝")
arrayOfEmoji.append("💝")
arrayOfEmoji.append("💝")
arrayOfEmoji.append("💝")
arrayOfEmoji.append("💟")
arrayOfEmoji.append("💟")
arrayOfEmoji.append("💟")
arrayOfEmoji.append("💟")
arrayOfEmoji.append("💟")
arrayOfEmoji.append("💟")
arrayOfEmoji.append("💟")
arrayOfEmoji.append("💟")
arrayOfEmoji.append("💟")
arrayOfEmoji.append("💟")
arrayOfEmoji.append("💟")
arrayOfEmoji.append("💟")
arrayOfEmoji.append("💟")
arrayOfEmoji.append("💟")
arrayOfEmoji.append("💘")
arrayOfEmoji.append("💘")
arrayOfEmoji.append("💘")
arrayOfEmoji.append("💘")
arrayOfEmoji.append("💘")
arrayOfEmoji.append("💘")
arrayOfEmoji.append("💘")
arrayOfEmoji.append("💘")
arrayOfEmoji.append("💘")
arrayOfEmoji.append("💘")
arrayOfEmoji.append("💘")
arrayOfEmoji.append("💘")
arrayOfEmoji.append("💘")
arrayOfEmoji.append("💘")
arrayOfEmoji.append("💘")
arrayOfEmoji.append("❤️")
arrayOfEmoji.append("❤️")
arrayOfEmoji.append("❤️")
arrayOfEmoji.append("❤️")
arrayOfEmoji.append("❤️")
arrayOfEmoji.append("❤️")
arrayOfEmoji.append("❤️")
arrayOfEmoji.append("❤️")
arrayOfEmoji.append("❤️")
arrayOfEmoji.append("❤️")
arrayOfEmoji.append("❤️")
arrayOfEmoji.append("❤️")
arrayOfEmoji.append("❤️")
arrayOfEmoji.append("❤️")
arrayOfEmoji.append("❤️")
arrayOfEmoji.append("❤️")
arrayOfEmoji.append("❤️")
arrayOfEmoji.append("💛")
arrayOfEmoji.append("💛")
arrayOfEmoji.append("💛")
arrayOfEmoji.append("💛")
arrayOfEmoji.append("💛")
arrayOfEmoji.append("💛")
arrayOfEmoji.append("💛")
arrayOfEmoji.append("💛")
arrayOfEmoji.append("💛")
arrayOfEmoji.append("💛")
arrayOfEmoji.append("💛")
arrayOfEmoji.append("💛")
arrayOfEmoji.append("💛")
arrayOfEmoji.append("💛")
arrayOfEmoji.append("💛")
arrayOfEmoji.append("💛")
arrayOfEmoji.append("💛")
arrayOfEmoji.append("💜")
arrayOfEmoji.append("💜")
arrayOfEmoji.append("💜")
arrayOfEmoji.append("💜")
arrayOfEmoji.append("💜")
arrayOfEmoji.append("💜")
arrayOfEmoji.append("💜")
arrayOfEmoji.append("💜")
arrayOfEmoji.append("💜")
arrayOfEmoji.append("💜")
arrayOfEmoji.append("💜")
arrayOfEmoji.append("💜")
arrayOfEmoji.append("💜")
arrayOfEmoji.append("💜")
arrayOfEmoji.append("💜")
arrayOfEmoji.append("💜")
arrayOfEmoji.append("💜")
arrayOfEmoji.append("💜")
arrayOfEmoji.append("💜")
arrayOfEmoji.append("💜")
arrayOfEmoji.append("💜")
arrayOfEmoji.append("🧡")
arrayOfEmoji.append("🧡")
arrayOfEmoji.append("🧡")
arrayOfEmoji.append("🧡")
arrayOfEmoji.append("🧡")
arrayOfEmoji.append("🧡")
arrayOfEmoji.append("🧡")
arrayOfEmoji.append("🧡")
arrayOfEmoji.append("🧡")
arrayOfEmoji.append("🧡")
arrayOfEmoji.append("🧡")
arrayOfEmoji.append("🧡")
arrayOfEmoji.append("🧡")
arrayOfEmoji.append("🧡")
arrayOfEmoji.append("🧡")
arrayOfEmoji.append("🧡")
arrayOfEmoji.append("🧡")
arrayOfEmoji.append("🧡")
arrayOfEmoji.append("🧡")
arrayOfEmoji.append("🧡")
arrayOfEmoji.append("🧡")
arrayOfEmoji.append("🤑 🥶") // multiple emoji works fine
arrayOfEmoji.append("🤑 🥶")
arrayOfEmoji.append("🤑 🥶")
arrayOfEmoji.append("🤑 🥶")
arrayOfEmoji.append("🤑 🥶")
arrayOfEmoji.append("🤑 🥶")
arrayOfEmoji.append("🤑 🥶")
arrayOfEmoji.append("🤑 🥶")
arrayOfEmoji.append("🤑 🥶")
arrayOfEmoji.append("🤑 🥶")
arrayOfEmoji.append("🤑 🥶")
arrayOfEmoji.append("🤑 🥶")
arrayOfEmoji.append("🤑 🥶")
arrayOfEmoji.append("🤑 🥶")
arrayOfEmoji.append("🐝 🦋 🍇 🎁")
arrayOfEmoji.append("🐝 🦋 🍇 🎁")
arrayOfEmoji.append("🐝 🦋 🍇 🎁")
arrayOfEmoji.append("🐝 🦋 🍇 🎁")
arrayOfEmoji.append("🐝 🦋 🍇 🎁")
arrayOfEmoji.append("🐝 🦋 🍇 🎁")
arrayOfEmoji.append("🐝 🦋 🍇 🎁")
arrayOfEmoji.append("🐝 🦋 🍇 🎁")
arrayOfEmoji.append("🐝 🦋 🍇 🎁")
arrayOfEmoji.append("🐝 🦋 🍇 🎁")
arrayOfEmoji.append("🐝 🦋 🍇 🎁")
arrayOfEmoji.append("🐝 🦋 🍇 🎁")
arrayOfEmoji.append("🐝 🦋 🍇 🎁")
arrayOfEmoji.append("🐝 🦋 🍇 🎁")
arrayOfEmoji.append("🐝 🦋 🍇 🎁")
arrayOfEmoji.append("🐝 🦋 🍇 🎁")
arrayOfEmoji.append("🐝 🦋 🍇 🎁")
arrayOfEmoji.append("😎 🦜 🦄 🤯 🧛🏻‍♂️ 💁🏼‍♀️ 🧚🏽‍♂️ 🦉")
arrayOfEmoji.append("😎 🦜 🦄 🤯 🧛🏻‍♂️ 💁🏼‍♀️ 🧚🏽‍♂️ 🦉")
arrayOfEmoji.append("😎 🦜 🦄 🤯 🧛🏻‍♂️ 💁🏼‍♀️ 🧚🏽‍♂️ 🦉")
arrayOfEmoji.append("😎 🦜 🦄 🤯 🧛🏻‍♂️ 💁🏼‍♀️ 🧚🏽‍♂️ 🦉")
arrayOfEmoji.append("😎 🦜 🦄 🤯 🧛🏻‍♂️ 💁🏼‍♀️ 🧚🏽‍♂️ 🦉")
arrayOfEmoji.append("😎 🦜 🦄 🤯 🧛🏻‍♂️ 💁🏼‍♀️ 🧚🏽‍♂️ 🦉")
arrayOfEmoji.append("😎 🦜 🦄 🤯 🧛🏻‍♂️ 💁🏼‍♀️ 🧚🏽‍♂️ 🦉")
arrayOfEmoji.append("😎 🦜 🦄 🤯 🧛🏻‍♂️ 💁🏼‍♀️ 🧚🏽‍♂️ 🦉")
arrayOfEmoji.append("😎 🦜 🦄 🤯 🧛🏻‍♂️ 💁🏼‍♀️ 🧚🏽‍♂️ 🦉")
arrayOfEmoji.append("😎 🦜 🦄 🤯 🧛🏻‍♂️ 💁🏼‍♀️ 🧚🏽‍♂️ 🦉")
arrayOfEmoji.append("😎 🦜 🦄 🤯 🧛🏻‍♂️ 💁🏼‍♀️ 🧚🏽‍♂️ 🦉")
arrayOfEmoji.append("😎 🦜 🦄 🤯 🧛🏻‍♂️ 💁🏼‍♀️ 🧚🏽‍♂️ 🦉")
arrayOfEmoji.append("😎 🦜 🦄 🤯 🧛🏻‍♂️ 💁🏼‍♀️ 🧚🏽‍♂️ 🦉")
arrayOfEmoji.append("😎 🦜 🦄 🤯 🧛🏻‍♂️ 💁🏼‍♀️ 🧚🏽‍♂️ 🦉")
arrayOfEmoji.append("😎 🦜 🦄 🤯 🧛🏻‍♂️ 💁🏼‍♀️ 🧚🏽‍♂️ 🦉")
arrayOfEmoji.append("😎 🦜 🦄 🤯 🧛🏻‍♂️ 💁🏼‍♀️ 🧚🏽‍♂️ 🦉")
arrayOfEmoji.append("😎 🦜 🦄 🤯 🧛🏻‍♂️ 💁🏼‍♀️ 🧚🏽‍♂️ 🦉")
arrayOfEmoji.append("😎 🦜 🦄 🤯 🧛🏻‍♂️ 💁🏼‍♀️ 🧚🏽‍♂️ 🦉")
arrayOfEmoji.append("😎 🦜 🦄 🤯 🧛🏻‍♂️ 💁🏼‍♀️ 🧚🏽‍♂️ 🦉")
arrayOfEmoji.append("😎 🦜 🦄 🤯 🧛🏻‍♂️ 💁🏼‍♀️ 🧚🏽‍♂️ 🦉")

litFuse.alternateImageContentsWithGivenArrayOfEmojiOrTextForDesiredRangeOfEmitters(desiredArrayAsText: arrayOfEmoji, startIndex: 1, endIndex: 400)

litFuse.placeEmittersOnSpecifiedLine(startingPoint: pointOne, endingPoint: pointTwo, startIndex: 1, endIndex: 400)

litFuse.createLitFuseEffectForDesiredRangeOfEmitters(
startIndex : 1,
endIndex : 400,
initialVelocity : 0,
initialBirthRate : 6,
initialScale : 0.1,
fuseBurningVelocity : 500,
fuseBurningBirthRate : 1800,
fuseBurningScale : 1.1,
endingVelocity : 0,
endingBirthRate : 1,
endingScale : 0,
stepsPerFrame : 1,
initialCellLifetime: 0.3,
fuseBurningCellLifetime: 0.3,
endingCellLifetime: 0.3,
repeatingFuseDesired: true,
timeBetweenRepeatsInSeconds: 2)
}
if countOfTouches == 23
{
litFuse.hideAllEmitters()
}
if countOfTouches == 24
{
readMeTextView.frame = CGRect(x: 125, y:  805, width: 845, height: 350)
readMeTextView.text = "\nBesides the continuous and repeating lit fuses, you can also specify a one shot burn of a fuse.\n\nNote that a fuse can have as many parts as desired.\n\nFuses can combine many shapes together."

var pointOne = CGPoint(x: 250, y: 300)
var pointTwo = CGPoint(x: 250, y: 800)

litFuse.placeEmittersOnSpecifiedLine(startingPoint: pointOne, endingPoint: pointTwo, startIndex: 1, endIndex: 50)

pointOne = CGPoint(x: 450, y: 300)
pointTwo = CGPoint(x: 450, y: 800)

litFuse.placeEmittersOnSpecifiedLine(startingPoint: pointOne, endingPoint: pointTwo, startIndex: 51, endIndex: 100)

pointOne = CGPoint(x: 650, y: 300)
pointTwo = CGPoint(x: 650, y: 800)

litFuse.placeEmittersOnSpecifiedLine(startingPoint: pointOne, endingPoint: pointTwo, startIndex: 101, endIndex: 150)

pointOne = CGPoint(x: 850, y: 300)
pointTwo = CGPoint(x: 850, y: 800)

litFuse.placeEmittersOnSpecifiedLine(startingPoint: pointOne, endingPoint: pointTwo, startIndex: 151, endIndex: 200)

litFuse.placeEmittersOnSpecifiedRectangle(thisRectangle: readMeTextView.frame, startIndex: 201, endIndex: 400)

litFuse.setCellImageFromTextStringForDesiredRangeOfEmitters(desiredImageAsText: "🟥", startIndex: 1, endIndex: 25)
litFuse.setCellImageFromTextStringForDesiredRangeOfEmitters(desiredImageAsText: "🟩", startIndex: 26, endIndex: 50)
litFuse.setCellImageFromTextStringForDesiredRangeOfEmitters(desiredImageAsText: "🟨", startIndex: 51, endIndex: 75)
litFuse.setCellImageFromTextStringForDesiredRangeOfEmitters(desiredImageAsText: "🟦", startIndex: 76, endIndex: 100)
litFuse.setCellImageFromTextStringForDesiredRangeOfEmitters(desiredImageAsText: "🟧", startIndex: 101, endIndex: 125)
litFuse.setCellImageFromTextStringForDesiredRangeOfEmitters(desiredImageAsText: "🟪", startIndex: 126, endIndex: 150)
litFuse.setCellImageFromTextStringForDesiredRangeOfEmitters(desiredImageAsText: "🟥", startIndex: 151, endIndex: 175)
litFuse.setCellImageFromTextStringForDesiredRangeOfEmitters(desiredImageAsText: "🟩", startIndex: 176, endIndex: 200)
litFuse.setCellImageFromTextStringForDesiredRangeOfEmitters(desiredImageAsText: "🥎", startIndex: 201, endIndex: 400)

litFuse.createLitFuseEffectForDesiredRangeOfEmitters(
startIndex : 1,
endIndex : 400,
initialVelocity : 0,
initialBirthRate : 5,
initialScale : 0,
fuseBurningVelocity : 777,
fuseBurningBirthRate : 5800,
fuseBurningScale : 0.3,
endingVelocity : 0,
endingBirthRate : 5,
endingScale : 0.5,
stepsPerFrame : 1,
initialCellLifetime: 0.2,
fuseBurningCellLifetime: 0.2,
endingCellLifetime: 0.2)
}

if countOfTouches == 25
{
litFuse.hideAllEmitters()
}
if countOfTouches == 26
{
readMeTextView.frame = CGRect(x: 45, y:  250, width: 830, height: 950)
readMeTextView.text = "You can specify any repeating pattern of emoji to be used to populate the fuse.  Just place the emoji into an array and call and API designed for that.  For instance, this code was used to produce the emoji pattern used in the fuse shown here :\n\nfor _ in 1...4 { arrayOfEmoji.append(\"🦄\") }\narrayOfEmoji.append(\" \")\nfor _ in 1...3 { arrayOfEmoji.append(\"🐝\") }\narrayOfEmoji.append(\" \")\nfor _ in 1...2 { arrayOfEmoji.append(\"🐞\") }\narrayOfEmoji.append(\" \")\nfor _ in 1...1 { arrayOfEmoji.append(\"🦋\") }\narrayOfEmoji.append(\" \")\n\nlitFuse.\nalternateCellImagesWithGivenArrayOfEmojiOrText\nForDesiredRangeOfEmitters\n(\ndesiredArrayAsText: arrayOfEmoji,\nstartIndex: 1,\nendIndex: 400\n)"

var pointOne = CGPoint(x: 50, y: 50)
var pointTwo = CGPoint(x: 850, y: 50)

litFuse.placeEmittersOnSpecifiedLine(startingPoint: pointOne, endingPoint: pointTwo, startIndex: 1, endIndex: 57)

pointOne = CGPoint(x: 50, y: 100)
pointTwo = CGPoint(x: 850, y: 100)

litFuse.placeEmittersOnSpecifiedLine(startingPoint: pointOne, endingPoint: pointTwo, startIndex: 58, endIndex: 114)

pointOne = CGPoint(x: 50, y: 150)
pointTwo = CGPoint(x: 850, y: 150)

litFuse.placeEmittersOnSpecifiedLine(startingPoint: pointOne, endingPoint: pointTwo, startIndex: 115, endIndex: 171)

pointOne = CGPoint(x: 50, y: 200)
pointTwo = CGPoint(x: 850, y: 200)

litFuse.placeEmittersOnSpecifiedLine(startingPoint: pointOne, endingPoint: pointTwo, startIndex: 172, endIndex: 228)

pointOne = CGPoint(x: 900, y: 50)
pointTwo = CGPoint(x: 900, y: 1300)

litFuse.placeEmittersOnSpecifiedLine(startingPoint: pointOne, endingPoint: pointTwo, startIndex: 229, endIndex: 314)

pointOne = CGPoint(x: 950, y: 50)
pointTwo = CGPoint(x: 950, y: 1300)

litFuse.placeEmittersOnSpecifiedLine(startingPoint: pointOne, endingPoint: pointTwo, startIndex: 315, endIndex: 400)

arrayOfEmoji.removeAll()

for _ in 1...4 { arrayOfEmoji.append("🦄") }
arrayOfEmoji.append(" ")
for _ in 1...3 { arrayOfEmoji.append("🐝") }
arrayOfEmoji.append(" ")
for _ in 1...2 { arrayOfEmoji.append("🐞") }
arrayOfEmoji.append(" ")
for _ in 1...1 { arrayOfEmoji.append("🦋") }
arrayOfEmoji.append(" ")

litFuse.alternateImageContentsWithGivenArrayOfEmojiOrTextForDesiredRangeOfEmitters(desiredArrayAsText: arrayOfEmoji, startIndex: 1, endIndex: 400)

litFuse.createLitFuseEffectForDesiredRangeOfEmitters(
startIndex : 1,
endIndex : 400,
initialVelocity : 0,
initialBirthRate : 5,
initialScale : 0,
fuseBurningVelocity : 1000,
fuseBurningBirthRate : 2200,
fuseBurningScale : 0.1,
endingVelocity : 0,
endingBirthRate : 5,
endingScale : 0.9,
stepsPerFrame : 2,
initialCellLifetime: 0.2,
fuseBurningCellLifetime: 0.2,
endingCellLifetime: 0.2,
repeatingFuseDesired: true,
timeBetweenRepeatsInSeconds: 1.7)
}
if countOfTouches == 27
{
litFuse.hideAllEmitters()
readMeTextView.alpha = 0
}

if countOfTouches == 28
{
var pointOne = CGPoint(x: 100, y: 300)
var pointTwo = CGPoint(x: 100, y: 700)

litFuse.placeEmittersOnSpecifiedLine(startingPoint: pointOne, endingPoint: pointTwo, startIndex: 1, endIndex: 50)

pointOne = CGPoint(x: 200, y: 300)
pointTwo = CGPoint(x: 200, y: 700)

litFuse.placeEmittersOnSpecifiedLine(startingPoint: pointOne, endingPoint: pointTwo, startIndex: 51, endIndex: 100)

pointOne = CGPoint(x: 300, y: 300)
pointTwo = CGPoint(x: 300, y: 700)

litFuse.placeEmittersOnSpecifiedLine(startingPoint: pointOne, endingPoint: pointTwo, startIndex: 101, endIndex: 150)

pointOne = CGPoint(x: 400, y: 300)
pointTwo = CGPoint(x: 400, y: 700)

litFuse.placeEmittersOnSpecifiedLine(startingPoint: pointOne, endingPoint: pointTwo, startIndex: 151, endIndex: 200)

pointOne = CGPoint(x: 500, y: 300)
pointTwo = CGPoint(x: 500, y: 700)

litFuse.placeEmittersOnSpecifiedLine(startingPoint: pointOne, endingPoint: pointTwo, startIndex: 201, endIndex: 250)

pointOne = CGPoint(x: 600, y: 300)
pointTwo = CGPoint(x: 600, y: 700)

litFuse.placeEmittersOnSpecifiedLine(startingPoint: pointOne, endingPoint: pointTwo, startIndex: 251, endIndex: 300)

pointOne = CGPoint(x: 700, y: 300)
pointTwo = CGPoint(x: 700, y: 700)

litFuse.placeEmittersOnSpecifiedLine(startingPoint: pointOne, endingPoint: pointTwo, startIndex: 301, endIndex: 350)

pointOne = CGPoint(x: 800, y: 300)
pointTwo = CGPoint(x: 800, y: 700)

litFuse.placeEmittersOnSpecifiedLine(startingPoint: pointOne, endingPoint: pointTwo, startIndex: 351, endIndex: 400)

litFuse.setCellImageFromTextStringForDesiredRangeOfEmitters(desiredImageAsText: "🟥", startIndex: 1, endIndex: 50)
litFuse.setCellImageFromTextStringForDesiredRangeOfEmitters(desiredImageAsText: "🟩", startIndex: 51, endIndex: 100)
litFuse.setCellImageFromTextStringForDesiredRangeOfEmitters(desiredImageAsText: "🟨", startIndex: 101, endIndex: 150)
litFuse.setCellImageFromTextStringForDesiredRangeOfEmitters(desiredImageAsText: "🟦", startIndex: 151, endIndex: 200)
litFuse.setCellImageFromTextStringForDesiredRangeOfEmitters(desiredImageAsText: "🟧", startIndex: 201, endIndex: 250)
litFuse.setCellImageFromTextStringForDesiredRangeOfEmitters(desiredImageAsText: "🟪", startIndex: 251, endIndex: 300)
litFuse.setCellImageFromTextStringForDesiredRangeOfEmitters(desiredImageAsText: "🟥", startIndex: 301, endIndex: 350)
litFuse.setCellImageFromTextStringForDesiredRangeOfEmitters(desiredImageAsText: "🟩", startIndex: 351, endIndex: 400)

litFuse.createLitFuseEffectForDesiredRangeOfEmitters(
startIndex : 1,
endIndex : 400,
initialVelocity : 0,
initialBirthRate : 5,
initialScale : 0,
fuseBurningVelocity : 250,
fuseBurningBirthRate : 1000,
fuseBurningScale : 0.2,
endingVelocity : 0,
endingBirthRate : 5,
endingScale : 0,
stepsPerFrame : 3,
initialCellLifetime: 0.01,
fuseBurningCellLifetime: 0.4,
endingCellLifetime: 0.2,
continuousFuseDesired: true)
}

if countOfTouches == 29
{
litFuse.hideAllEmitters()
readMeTextView.alpha = 0
}

if countOfTouches == 30
{
readMeTextView.alpha = 1

readMeTextView.frame = CGRect(x: 100, y:  50, width: 845, height: 322)
readMeTextView.text = "You can comb the emission angle!\n\nThe combing is based on circular arcs and the idea is to get emitters that line up radially, but variations are possible.  In order to see the effect you need to specify an initialVelocityRange that is non zero.  And there is no fuse burning, besides the whole circle burning like a sun."

kidsImageView.alpha = 0

arrayOfEmoji.removeAll()

for _ in 1...10
{
arrayOfEmoji.append("🔴")
}
for _ in 1...10
{
arrayOfEmoji.append("🟡")
}
for _ in 1...10
{
arrayOfEmoji.append("🔵")
}
for _ in 1...10
{
arrayOfEmoji.append("🟠")
}
for _ in 1...10
{
arrayOfEmoji.append("🟢")
}
for _ in 1...10
{
arrayOfEmoji.append("🟣")
}

litFuse.alternateImageContentsWithGivenArrayOfEmojiOrTextForDesiredRangeOfEmitters(desiredArrayAsText: arrayOfEmoji, startIndex: 1, endIndex: 400)

litFuse.placeEmittersOnSpecifiedCircleOrArc(thisCircleCenter: CGPoint(x: 512, y: 800), thisCircleRadius: 300, thisCircleArcFactor: 1, startIndex : 1, endIndex: 400, offsetAngleInDegrees: 0, scaleFactor: 0.5)

litFuse.setFuseEmitterPhases(onlyUseInitialPlacementLogic: true)

litFuse.combCircularEmittersToPointInDesiredDirections(desiredOffsetAngleForCellFlow: 0, coneWideningFactorNormallyZero: 0, combArcFactor: 1, startIndex: 1, endIndex: 400)

litFuse.createLitFuseEffectForDesiredRangeOfEmitters(
startIndex : 1,
endIndex : 400,
initialVelocity : 100,
initialVelocityRange : 100,
initialBirthRate : 50,
initialScale : 0.1,
fuseBurningVelocity : 100,
fuseBurningVelocityRange: 100,
fuseBurningBirthRate : 2800,
fuseBurningScale : 0.1,
endingVelocity : 100,
endingVelocityRange : 100,
endingBirthRate : 5,
endingScale : 0.1,
stepsPerFrame : 1,
initialCellLifetime: 1.0,
fuseBurningCellLifetime: 1.0,
endingCellLifetime: 1.0,
continuousFuseDesired: true)
}

if countOfTouches == 31
{
litFuse.hideAllEmitters()
readMeTextView.alpha = 0

// Stop this since it was started in last stage
litFuse.setFuseEmitterPhases(onlyUseInitialPlacementLogic: false)

// And stop the actual combing.
litFuse.stopCombingTheEmitters(startIndex : 1, endIndex: 400)
}

if countOfTouches == 32
{
readMeTextView.alpha = 1

readMeTextView.frame = CGRect(x: 100, y:  50, width: 845, height: 322)
readMeTextView.text = "You can offset the angle.  Choosing a 180 degree offset flows the emitters inwards.\n\nOther offset values can make the flows less perpendicular to the circle."

kidsImageView.alpha = 0

arrayOfEmoji.removeAll()

for _ in 1...10
{
arrayOfEmoji.append("🔴")
}
for _ in 1...10
{
arrayOfEmoji.append("🟡")
}
for _ in 1...10
{
arrayOfEmoji.append("🔵")
}
for _ in 1...10
{
arrayOfEmoji.append("🟠")
}
for _ in 1...10
{
arrayOfEmoji.append("🟢")
}
for _ in 1...10
{
arrayOfEmoji.append("🟣")
}

litFuse.alternateImageContentsWithGivenArrayOfEmojiOrTextForDesiredRangeOfEmitters(desiredArrayAsText: arrayOfEmoji, startIndex: 1, endIndex: 400)

litFuse.placeEmittersOnSpecifiedCircleOrArc(thisCircleCenter: CGPoint(x: 512, y: 800), thisCircleRadius: 600, thisCircleArcFactor: 1, startIndex : 1, endIndex: 400, offsetAngleInDegrees: 123, scaleFactor: 0.5)

litFuse.setFuseEmitterPhases(onlyUseInitialPlacementLogic: true)

litFuse.combCircularEmittersToPointInDesiredDirections(desiredOffsetAngleForCellFlow : 180,
desiredOffsetAngleForShape : 123,
coneWideningFactorNormallyZero: 0,
combArcFactor: 1,
startIndex: 1,
endIndex: 400)

litFuse.createLitFuseEffectForDesiredRangeOfEmitters(
startIndex : 1,
endIndex : 400,
initialVelocity : 100,
initialVelocityRange : 100,
initialBirthRate : 50,
initialScale : 0.1,
fuseBurningVelocity : 100,
fuseBurningVelocityRange: 100,
fuseBurningBirthRate : 2800,
fuseBurningScale : 0.1,
endingVelocity : 100,
endingVelocityRange : 100,
endingBirthRate : 5,
endingScale : 0.1,
stepsPerFrame : 1,
initialCellLifetime: 1.0,
fuseBurningCellLifetime: 1.0,
endingCellLifetime: 1.0,
continuousFuseDesired: true)
}

if countOfTouches == 33
{
litFuse.hideAllEmitters()
readMeTextView.alpha = 0

// Stop this since it was started in last stage
litFuse.setFuseEmitterPhases(onlyUseInitialPlacementLogic: false)

// And stop the actual combing.
litFuse.stopCombingTheEmitters(startIndex : 1, endIndex: 400)
}

if countOfTouches == 34
{
readMeTextView.alpha = 1

readMeTextView.frame = CGRect(x: 100, y:  50, width: 845, height: 322)
readMeTextView.text = "You can have some of the cells flow inwards and some flow outwards at the same time.\n\nBy controlling the the circle radius, the initial cell lifetime, and the initial cell velocities you can get a thin ring with a hole, or a thicker ring with no hole."

kidsImageView.alpha = 0

arrayOfEmoji.removeAll()

for _ in 1...200
{
arrayOfEmoji.append("🤯")
}

litFuse.alternateImageContentsWithGivenArrayOfEmojiOrTextForDesiredRangeOfEmitters(desiredArrayAsText: arrayOfEmoji, startIndex: 1, endIndex: 400)

litFuse.placeEmittersOnSpecifiedCircleOrArc(thisCircleCenter: CGPoint(x: 512, y: 800), thisCircleRadius: 250, thisCircleArcFactor: 1, startIndex : 1, endIndex: 400, offsetAngleInDegrees: 90, scaleFactor: 0.5)

litFuse.setFuseEmitterPhases(onlyUseInitialPlacementLogic: true)

litFuse.combCircularEmittersToPointInDesiredDirections(desiredOffsetAngleForCellFlow : 0,
desiredOffsetAngleForShape : 90,
coneWideningFactorNormallyZero: 0,
combArcFactor: 1,
startIndex: 1,
endIndex: 400)

litFuse.syncScaleSpeedToShrinkOverLifetimeDesired(syncDesired: true)

litFuse.createLitFuseEffectForDesiredRangeOfEmitters(
startIndex : 1,
endIndex : 400,
initialVelocity : 25,
initialVelocityRange : 200,
initialBirthRate : 30,
initialScale : 1.5,
fuseBurningVelocity : 100,
fuseBurningVelocityRange: 100,
fuseBurningBirthRate : 2800,
fuseBurningScale : 0.1,
endingVelocity : 100,
endingVelocityRange : 100,
endingBirthRate : 5,
endingScale : 0.1,
stepsPerFrame : 1,
initialCellLifetime: 2.0,
fuseBurningCellLifetime: 1.0,
endingCellLifetime: 1.0,
continuousFuseDesired: true)
}

if countOfTouches == 35
{
litFuse.hideAllEmitters()
readMeTextView.alpha = 0

// Stop this since it was started in last stage
litFuse.setFuseEmitterPhases(onlyUseInitialPlacementLogic: false)

// And stop the actual combing.
litFuse.stopCombingTheEmitters(startIndex : 1, endIndex: 400)

litFuse.syncScaleSpeedToShrinkOverLifetimeDesired(syncDesired: false)

}

if countOfTouches == 36
{
readMeTextView.alpha = 1

readMeTextView.frame = CGRect(x: 100, y:  50, width: 845, height: 122)
readMeTextView.text = "You get an amazing amount of animation and flexibility for about 10 lines of code 🧐"

kidsImageView.alpha = 0

arrayOfEmoji.removeAll()

for _ in 1...200
{
arrayOfEmoji.append("🦄")
}

litFuse.alternateImageContentsWithGivenArrayOfEmojiOrTextForDesiredRangeOfEmitters(desiredArrayAsText: arrayOfEmoji, startIndex: 1, endIndex: 400)

litFuse.placeEmittersOnSpecifiedCircleOrArc(thisCircleCenter: CGPoint(x: 512, y: 800), thisCircleRadius: 500, thisCircleArcFactor: 1, startIndex : 1, endIndex: 400, offsetAngleInDegrees: 90, scaleFactor: 0.5)

litFuse.setFuseEmitterPhases(onlyUseInitialPlacementLogic: true)

litFuse.combCircularEmittersToPointInDesiredDirections(desiredOffsetAngleForCellFlow : 0,
desiredOffsetAngleForShape : 90,
coneWideningFactorNormallyZero: 0,
combArcFactor: 1,
startIndex: 1,
endIndex: 400)

litFuse.syncScaleSpeedToShrinkOverLifetimeDesired(syncDesired: true)

litFuse.createLitFuseEffectForDesiredRangeOfEmitters(
startIndex : 1,
endIndex : 400,
initialVelocity : 12,
initialVelocityRange : 80,
initialBirthRate : 30,
initialScale : 1.5,
fuseBurningVelocity : 100,
fuseBurningVelocityRange: 100,
fuseBurningBirthRate : 2800,
fuseBurningScale : 0.1,
endingVelocity : 100,
endingVelocityRange : 100,
endingBirthRate : 5,
endingScale : 0.1,
stepsPerFrame : 1,
initialCellLifetime: 2.0,
fuseBurningCellLifetime: 1.0,
endingCellLifetime: 1.0,
continuousFuseDesired: true)
}

if countOfTouches == 37
{
litFuse.hideAllEmitters()
readMeTextView.alpha = 0

// Stop this since it was started in last stage
litFuse.setFuseEmitterPhases(onlyUseInitialPlacementLogic: false)

// And stop the actual combing.
litFuse.stopCombingTheEmitters(startIndex : 1, endIndex: 400)

litFuse.syncScaleSpeedToShrinkOverLifetimeDesired(syncDesired: false)

}


countView.text = ("Counter : \(countOfTouches)")
countView.frame = CGRect(x: 5, y:  1300, width: 160, height: 50)

countOfTouches += 1
if countOfTouches == touchesEndValue
{
countOfTouches = -1
kidsCircleImageView.alpha = 0
}

} // ends touchesBegan

var touchesEndValue = 38
}