Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Making 1 frame/single image count as animation
Started by dan.miller Mar 27 2019 12:46 PM

5 replies to this topic
graphics spritesheets

Best Answer thomas6 , 28 March 2019 - 06:25 AM

The way I do it is using TexturePacker.

 

If I want to use an animation sequence, I need to define these myself using a code editor. Still images / single image are just set using the "setFrame" command.

[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

dan.miller

[GLOBAL: userInfoPane.html]
dan.miller
  • Observer

  • 3 posts
  • Corona SDK

I have a spritesheet in which some cases, mostly "Standing" are only single images.  However I want to uniformly treat these "singlets" the same way that I treat any animations -

    new PIXI.AnimatedSprite( sheet.animations[ poseName ] );

 

But it looks like TexturePacker doesn't automatically turn singlets into animations at the bottom of the JSON file.  Can this be added in the future?   I think this would be handy so you dont get stuck with some sort of edge case code breaking bug.  Or is the problem that renderering engines don't play well with single frame animations?

 

Thanks!



[TOPIC: post.html]
#2

XeduR @Spyric

[GLOBAL: userInfoPane.html]
XeduR @Spyric
  • Contributor

  • 878 posts
  • Corona SDK

Sounds to me like you are working with PixiJS and not Corona. Also, Corona is not affiliated with TexturePacker. You should probably head to https://www.codeandweb.com/texturepacker with your suggestions and questions.



[TOPIC: post.html]
#3

thomas6

[GLOBAL: userInfoPane.html]
thomas6
  • Contributor

  • 976 posts
  • Corona SDK

  Best Answer

The way I do it is using TexturePacker.

 

If I want to use an animation sequence, I need to define these myself using a code editor. Still images / single image are just set using the "setFrame" command.



[TOPIC: post.html]
#4

dan.miller

[GLOBAL: userInfoPane.html]
dan.miller
  • Observer

  • 3 posts
  • Corona SDK

Thanks for the reply thomas - what I did was I just made a copy of the single image, so now with 2 subquentially numbered stills, it can count as an animation! 

 

Thanks Mod, I dont know why my searches landed me here. Weird.



[TOPIC: post.html]
#5

thomas6

[GLOBAL: userInfoPane.html]
thomas6
  • Contributor

  • 976 posts
  • Corona SDK

Hi Dan,

 

If that works for you, perfect! I think you can do it without duplicating images as well by creating an animation using explicitly specified frames and just specifying the same image twice in the animation frames table. That would make it an animation as well, but using the same single image twice, instead of two copies of that single image. Am I making sense? :-)



[TOPIC: post.html]
#6

dan.miller

[GLOBAL: userInfoPane.html]
dan.miller
  • Observer

  • 3 posts
  • Corona SDK

It does for sure, I'm just trying to automate as much as possible, and it's easier in python I think to dupe a file than to go an mess with the post texture-packed JSON




[topic_controls]
[/topic_controls]

Also tagged with one or more of these keywords: graphics, spritesheets