Motion/Moving effect with animation on still image
Asked Answered
C

1

18

I am trying to implement animation in a still image in a user-guided direction, something like this:

Original image

original image

Expected result

expected result

For this, I have tried the CIBumpDistortionLinear CIFilter. It is animating, but the animation is not exactly like that.

let bumpDistortionLinearParams: [String: AnyObject] = [
    kCIInputImageKey: coreImage!,
    "inputCenter" : CIVector(string: coordStr),
    "inputRadius": 300.0 as AnyObject,
    "inputAngle" : 90.0 as AnyObject,
    "inputScale" : 0.1 as AnyObject
]

let bumpDistortionLinear = CIFilter(name: "CIBumpDistortionLinear", parameters: bumpDistortionLinearParams)
Calcaneus answered 14/6, 2019 at 10:23 Comment(2)
Is this possible with MetalKit via creating shader on image? Is this resolved for you?Columbium
It is possible with Metal Kit. I am looking for similar effect with shader for which selected draw area will not animate (similar to masking in plotaverse). Any Idea?Columbium
H
1

You can use SpriteKit with SKTexture / SKTextureAtlas.
Small example:
https://www.raywenderlich.com/144-spritekit-animations-and-texture-atlases-in-swift

Update:
If you need dynamic animation, you can make solution base on Metal
Example:
https://github.com/KrisYu/Water
Metal tutorial:
http://metalkit.org/

Hadrian answered 20/6, 2019 at 4:57 Comment(3)
I'll need to implement that dynamically on any user captured photo. Does SKTexture will help on it. if you think so, can you provide any example or code ref.Calcaneus
@Arvind If you need dynamic animation, you can use Metal. It maybe help: github.com/KrisYu/Water SKTexture can’t do this (or I don’t known how)Hadrian
@Eysner: I am looking for similar animation on different images. That is not exactly the water effect. The animation will be in user guided direction. You can try on plotaverse.com for better understanding.Columbium

© 2022 - 2024 — McMap. All rights reserved.