Skip to content
This repository has been archived by the owner on Feb 7, 2024. It is now read-only.

Ability to modify Sprite ticks per frame on runtime #26

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

nachein
Copy link

@nachein nachein commented Mar 24, 2017

Update the animation speed by changing ticks per second props.

This allows a parent component to alter the animation speed without changing current sprite state. For instance, through its state:

<Sprite repeat={this.state.repeat} src={require('../assets/sprites/my_spritesheet.png')} tileWidth={48} tileHeight={48} ticksPerFrame={this.state.ticksPerFrame} scale={this.context.scale} state={0} steps={[5]} style={{ transform: [ {translateX: this.state.position.x}, {translateY: this.state.position.y} ] }} />

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant