简体   繁体   中英

Motion/Moving effect with animation on still image

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

Original image

原始图像

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)

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/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM