1

I am having trouble finding documentation/examples in creating custom sktransitions between two skscenes. I can use the built in transitions fine and plan to use some of those.

Can somebody explain the process in creating a transition, possibly with an example?

I am getting a bit confused as I see examples with CIFilters and alike. I understand these are from the CoreImage framework, so am wondering how these are involved.

Many thanks.

Leon

Edit 1:

I have tried a Swift 3 version such as:

let customFilter = CIFilter(name: "CIDotScreen")
let transition = SKTransition(ciFilter: customFilter!, duration: 0.5)
let newScene = GameOverScene(size: self.size, won: false)
transition.pausesOutgoingScene = true
self.view?.presentScene(newScene, transition: transition)

from Custom SKTransitions

and using SKTransition.init(ciFilter:, duration:) - the same initialiser as above, but the transition doesn't animate. Interestingly, the transition back to the main game screen, a built in flip animation, doesn't start until after the duration specified above has expired.

Itergator
  • 299
  • 3
  • 16
  • I might be wrong about this, but what I've found, so far, is that you can't have two SKScenes in memory, and active at the same time (as a user, the SK framework and iOS seems able to do it for their transitions) so you can't make custom transitions. However, you can make a "fake" second "scene" and transition to that anyway you want. But that's not an answer. Here's hoping someone knows much more than me. – Confused Feb 05 '17 at 14:17
  • Please show some code. Also @Confused you can make custom transitions – Knight0fDragon Feb 05 '17 at 15:05
  • @Knight0fDragon can you link me to anything about custom transitions in SpriteKit without pre-loading "fake" scenes? I've not found anything. My google-fu is up there with my conversation skills. – Confused Feb 05 '17 at 15:14
  • @Confused Look right at the documents – Knight0fDragon Feb 05 '17 at 15:15
  • 1
    Given the size of the documents, @Knight0fDragon, and that I've looked at them several times and not found anything, do you think you could be a little more exact/specific? A link, perhaps? – Confused Feb 05 '17 at 16:05
  • @Knight0fDragon could you provide a link or code for a custom transition? I cannot find an example in the iOS documentation or Google etc. so would be very grateful. – Itergator Feb 05 '17 at 16:11
  • Perhaps @Knight0fDragon is a savant, and can determine how to do all that's required to make custom transitions with this: https://developer.apple.com/reference/spritekit/sktransition/1395895-init – Confused Feb 05 '17 at 16:26
  • @Confused I have seen this initialiser method for a custom SKTransition class but I don't understand CIFilter or how these are part of the transition so as explained in the original question a short description of this would be handy – Itergator Feb 05 '17 at 17:02
  • . If @Knight0fDragon could provide a link/documentation/example that would be fantastic – Itergator Feb 05 '17 at 17:02
  • Provide the code you attempted and we can walk through it – Knight0fDragon Feb 05 '17 at 18:38
  • @Knight0fDragon unfortunately I have no code as it is an example I am looking for to understand the approach of creating a custom sktransition... – Itergator Feb 05 '17 at 21:35
  • Ok well when you put some effort into writing something based on the documents I will be more than happen to put some effort into writing an answer – Knight0fDragon Feb 06 '17 at 01:01
  • @Knight0fDragon I have added some code above to look at, and I don't really know what I am doing wrong, have tried with other filters such as blurs and others from https://developer.apple.com/library/content/documentation/GraphicsImaging/Reference/CoreImageFilterReference/ – Itergator Feb 10 '17 at 17:29
  • @Itergator, Maybe it will help you: https://krakendev.io/blog/be-cool-with-cifilter-animations – OhadM Mar 08 '17 at 15:21
  • Thanks @OhadM will have a look tonight – Itergator Mar 08 '17 at 15:25
  • @Itergator let me know if it worked – OhadM Mar 09 '17 at 08:45

0 Answers0