Handwriter API Reference

Version 1.1.0

Overview

This document describes about APIs in Handwriter components.

TextHandwriter component

Properties

Property Type Default Desciption
speed float 1 Writing speed in runtime (multiplies each stroke speed)
bleeding int 10 Ink bleeding
autoStart bool false Start writing automatically at Start() callback in MonoBehaviour lifecycle
autoStartDelay float 0.0f Delay seconds before auto start
autoFadeOut bool false Fade out automatically after finish writing
autoFadeOutTime float 1.0f Fade out time
destroyAfterFadeOut bool false Destroy the GameObject after auto fadeout
positionFeedback bool false Enable position feedback event
currentWritingPositionTransform Transform null Transform at writing position on current frame
nextWritingPositionTransform Transform null Transform at writing position on next frame
_OnStartWriting Unity Event null Invoke when start writing (refer detail of Event Listener section)
_OnWritingProgress Unity Event null Notify progress of writing (refer detail of Event Listener section)
_OnStrokePosition Unity Event null Invoke every position while writing if the position feedback option is enabled (refer detail of Event Listener section)
_OnFinishWriting Unity Event null Invoke when finish writing (refer detail of Event Listener section)
Text Text component not null Text Component on the same GameObject (Read only)
Color Color Color.White Base Color
MinimumAlpha float 0 Alpha Transparency value before written

Public Functions

void Write()

Start writing with parameters already specified in Editor mode.


void Write(string text, float speed = 1.0f, float delay = 0.0f)

Start writing with specified function parameters.

Parameter Type Default Desciption
text string Text to write on Text component
speed float 1 Writing speed on runtime (multiplies each stroke speed)
delay float 0 Delay seconds before start writing

void SetWritingProgress(float totalProgress)

Manually sets writing progress on TextHandwriter with text on Text Component.

Parameter Type Default Desciption
totalProgress float progress of writing text

void SetWritingProgress(int characterIndex, float progress)

Manually sets writing progress on TextHandwriter with specified character index of text on Text Component.

Parameter Type Default Desciption
characterIndex int Character index of writing position
progress float progress of writing character. (not whole text)

void FadeOut(float seconds)

Fadeout text.

Parameter Type Default Desciption
seconds seconds fadeout seconds

void HideWritingCanvas()

Immediatelly hide text.

void Pause()

Pause writing.

void Resume()

Resume writing if already paused.

Event Listener (TextHandwriter)

void OnStartWriting(TextHandwriter textHandwriter)

Parameter Type Default Desciption
textHandwriter TextHandwriter the component writing started

void OnWritingProgress(TextHandwriter textHandwriter, int characterIndex, float progress, float totalProgress)

Parameter Type Default Desciption
textHandwriter TextHandwriter the component writing started
characterIndex int current writing character index of whole string
progress float wrirting progress of the character (not total progress of whole text)
totalProgress float wrirting progress of the writing text

void OnStrokePosition(TextHandwriter textHandwriter, RectTransform currentPositionTransform, RectTransform nextPositionTransformo, float interval)

Parameter Type Default Desciption
textHandwriter TextHandwriter the component writing started
currentPositionTransform RectTransform Transform Component that indicate writing position of current frame. The object is automatically created on Awake lifecycle callback if the position feedback option is enabled.
nextPositionTransform RectTransform Transform Component that indicate writing position of current frame. The object is automatically created on Awake lifecycle callback if the position feedback option is enabled.
interval float Interval seconds from current position to next position. Basically that is equal to the deltaTime of Unity. If current position is the end of stroke, it includes before
MyParticleSystem.transform.position = currentPositionTransform.position

void OnFinishWriting(TextHandwriter textHandwriter, bool autoFadeout)

Parameter Type Default Desciption
textHandwriter TextHandwriter the component
autoFadeout bool true if autoFadeout option is enabled

SpriteHandwriter

Properties

Property Type Default Desciption
speed float 1 Writing speed on runtime (multiplies each stroke speed). If speed is 1, Handwriter process 60 writing steps per a second.
bleeding int 10 Ink bleeding
autoStart bool false Start writing automatically at Start() callback in MonoBehaviour lifecycle
autoStartDelay float 0.0f Delay seconds before auto start
autoFadeOut bool false Fade out automatically after finish writing
autoFadeOutTime float 1.0f Fade out time
destroyAfterFadeOut bool false Destroy the GameObject after auto fadeout
positionFeedback bool false Enable position feedback event
currentWritingPositionTransform Transform null Transform at writing position on current frame
nextWritingPositionTransform Transform null Transform at writing position on next frame
_OnStartWriting Unity Event null Invoke when start writing (refer detail of Event Listener section)
_OnWritingProgress Unity Event null Notify progress of writing (refer detail of Event Listener section)
_OnStrokePosition Unity Event null Invoke every position while writing if the position feedback option is enabled (refer detail of Event Listener section)
_OnFinishWriting Unity Event null Invoke when finish writing (refer detail of Event Listener section)
Image Image component not null Image Component on the same GameObject (Read only)
Color Color Color.White Base Color
MinimumAlpha float 0 Alpha Transparency value before written
SelectableSpriteList Sprite[] null Sprites in the Book (Read Only)

API

void Write()

Start writing with parameters already specified in Editor mode.

void Write(float speed = 1.0f, float delay = 0.0f)

Start writing with specified function parameters.

Parameter Type Default Desciption
speed float 1 Writing speed on runtime (multiplies each stroke speed)
delay float 0 Delay seconds before start writing

void SetWritingProgress(float progress)

Manually sets writing progress on SpriteHandwriter with selected sprite.

Parameter Type Default Desciption
progress float progress of writing sprite

void FadeOut(float seconds)

Fadeout image.

Parameter Type Default Desciption
seconds seconds fadeout seconds

void HideWritingCanvas()

Immediatelly hide image.

void Pause()

Pause writing.

void Resume()

Resume writing if already paused.

Event Listener (SpriteHandwriter)

void OnStartWriting(SpriteHandwriter spriteHandwriter)

Parameter Type Default Desciption
spriteHandwriter SpriteHandwriter the component writing started

void OnWritingProgress(SpriteHandwriter spriteHandwriter, Sprite sprite, float progress)

Parameter Type Default Desciption
spriteHandwriter SpriteHandwriter the component writing started
sprite Sprite sprite
progress float wrirting progress of the sprite

void OnStrokePosition(SpriteHandwriter spriteHandwriter, RectTransform currentPositionTransform, RectTransform nextPositionTransformo, float interval)

Parameter Type Default Desciption
spriteHandwriter SpriteHandwriter the component
currentPositionTransform RectTransform Transform Component that indicate writing position of current frame. The object is automatically created on Awake lifecycle callback if the position feedback option is enabled.
nextPositionTransform RectTransform Transform Component that indicate writing position of current frame. The object is automatically created on Awake lifecycle callback if the position feedback option is enabled.
interval float Interval seconds from current position to next position. Basically that is equal to the deltaTime of Unity. If current position is the end of stroke, it includes before

void OnFinishWriting(SpriteHandwriter spriteHandwriter, bool autoFadeout)

Parameter Type Default Desciption
spriteHandwriter SpriteHandwriter the component
autoFadeout bool true if autoFadeout option is enabled