skia2/experimental/skottie_ios/SkottieMtkView.h
Hal Canary 988b1e4653 experimental/skottie_ios: Add methods to SkottieMtkView
- (void)seek:(float)seconds;
    - (float)animationDurationSeconds;
    - (float)currentTime;

Also: fix issue with finding json resources.

CQ_INCLUDE_TRYBOTS=skia.primary:Build-Mac-Clang-arm64-Debug-iOS_Metal,Build-Mac-Clang-arm64-Release-iOS_Metal

Change-Id: I19b45dd902b6119216f8c58ad8e13b9036a6b9c3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/244513
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Hal Canary <halcanary@google.com>
2019-09-26 21:13:11 +00:00

41 lines
1.1 KiB
Objective-C

// Copyright 2019 Google LLC.
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
#ifndef SkottieMtkView_DEFINED
#define SkottieMtkView_DEFINED
#import <MetalKit/MetalKit.h>
#import <UIKit/UIKit.h>
class GrContext;
@interface SkottieMtkView : MTKView
// Must be set to a Metal-backed GrContext in order to draw.
// e.g.: use SkMetalDeviceToGrContext().
@property (assign) GrContext* grContext; // non-owning pointer.
// Override of the MTKView interface. Uses Skia+Skottie+Metal to draw.
- (void)drawRect:(CGRect)rect;
// Load an animation from a Lottie JSON file. Returns Yes on success.
- (BOOL)loadAnimation:(NSData*)d;
// Jump to the specified location in the animation.
- (void)seek:(float)seconds;
// Toggle paused mode. Return paused state.
- (BOOL)togglePaused;
// Return the default size of the Lottie animation.
- (CGSize)size;
// Return the length of the animation loop.
- (float)animationDurationSeconds;
// Return the current position in the animation in seconds (between zero and
// animationDurationSeconds).
- (float)currentTime;
@end
#endif // SkottieMtkView_DEFINED