Project: Paper2D

RE: Time in UE4. Currently flipbook components handle time accumulation internally, using delta time, etc… in same way other engine components do, so they should be framerate independent, as are timers, timelines, delays, etc…

In 4.3, your best bet is to indeed use timers or delays, although you can set timer based on length of animation at least (GetTotalDuration() on flipbook asset). You could also get away with polling every frame for IsPlaying() for non-looping animations.

RE: goto frame X, etc… you can do all of that now, although everything is structured in terms of time ATM. You can do something like:


SetNewTime(FrameNumber / GetFlipbookFramerate())

I’ll add a frame-centric API to list of things to consider (in addition to existing time-centric one). For reference, here are things you can do with a flipbook component ATM (looks like there is no online API reference for classes in a , which I’ve raised with doc team).


	/** Change flipbook used by  instance (will reset play time to 0 if it is a new flipbook). */
	UFUNCTION(BlueprintCallable, Category="Sprite")
	virtual bool SetFlipbook(class UPaperFlipbook* NewFlipbook);

	/** Gets flipbook used by  instance. */
	UFUNCTION(BlueprintPure, Category="Sprite")
	virtual UPaperFlipbook* GetFlipbook();

	/** Gets material used by  instance */
	UFUNCTION(BlueprintCallable, Category="Sprite")
	UMaterialInterface* GetSpriteMaterial() const;

	/** Set color of sprite */
	UFUNCTION(BlueprintCallable, Category="Sprite")
	void SetSpriteColor(FLinearColor NewColor);

	/** Start playback of flipbook */
	UFUNCTION(BlueprintCallable, Category="Components|Flipbook")
	void Play();

	/** Start playback of flipbook from start */
	UFUNCTION(BlueprintCallable, Category="Components|Flipbook")
	void PlayFromStart();

	/** Start playback of flipbook in reverse */
	UFUNCTION(BlueprintCallable, Category="Components|Flipbook")
	void Reverse();

	/** Start playback of flipbook in reverse from end */
	UFUNCTION(BlueprintCallable, Category="Components|Flipbook")
	void ReverseFromEnd();

	/** Stop playback of flipbook */
	UFUNCTION(BlueprintCallable, Category="Components|Flipbook")
	void Stop();

	/** Get whether  flipbook is playing or not. */
	UFUNCTION(BlueprintCallable, Category="Components|Flipbook")
	bool IsPlaying() const;

	/** Get whether we are reversing or not */
	UFUNCTION(BlueprintCallable, Category="Components|Flipbook")
	bool IsReversing() const;

	/** Jump to a position in flipbook. If bFireEvents is true, event functions will fire, otherwise will not. */
	UFUNCTION(BlueprintCallable, Category="Components|Flipbook")
	void SetPlaybackPosition(float NewPosition, bool bFireEvents);

	/** Get current playback position of flipbook */
	UFUNCTION(BlueprintCallable, Category="Components|Flipbook")
	float GetPlaybackPosition() const;

	/** true means we should loop, false means we should not. */
	UFUNCTION(BlueprintCallable, Category="Components|Flipbook")
	void SetLooping(bool bNewLooping);

	/** Get whether we are looping or not */
	UFUNCTION(BlueprintCallable, Category="Components|Flipbook")
	bool IsLooping() const;

	/** Sets new play rate for  flipbook */
	UFUNCTION(BlueprintCallable, Category="Components|Flipbook")
	void SetPlayRate(float NewRate);

	/** Get current play rate for  flipbook */
	UFUNCTION(BlueprintCallable, Category="Components|Flipbook")
	float GetPlayRate() const;

	/** Set new playback position time to use */
	UFUNCTION(BlueprintCallable, Category="Components|Flipbook")
	void SetNewTime(float NewTime);

	/** Get length of flipbook (in seconds) */
	UFUNCTION(BlueprintCallable, Category="Components|Flipbook")
	float GetFlipbookLength() const;

	/** Get length of flipbook (in frames) */
	UFUNCTION(BlueprintCallable, Category = "Components|Flipbook")
	int32 GetFlipbookLengthInFrames() const;

	/** Get nominal framerate that flipbook will be played back at (ignoring PlayRate), in frames per second */
	UFUNCTION(BlueprintCallable, Category = "Components|Flipbook")
	float GetFlipbookFramerate() const;

Cheers,