Custom animations

Find tutorials, documentation, and resources for creating and using TheoTown plugins.
User avatar
TheFennekin
Inhabitant of a Galaxy Cluster
Reactions:
Posts: 2715
Joined: 24 Aug 2017, 09:17
Location: honsing around
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

Re: Custom animations

Post by TheFennekin »

How do you make your animation appear only in night? (Night animations)
Image
User avatar
CommanderABab
AB
Reactions:
Posts: 11269
Joined: 07 Jun 2016, 19:12
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

Re: Custom animations

Post by CommanderABab »

TheFennekin wrote: 28 Jun 2020, 07:57 How do you make your animation appear only in night? (Night animations)
Have these two lines in youe animation:

Code: Select all

      "light switching":true,
      "light":true,
my avatar:
User avatar
TheFennekin
Inhabitant of a Galaxy Cluster
Reactions:
Posts: 2715
Joined: 24 Aug 2017, 09:17
Location: honsing around
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

Re: Custom animations

Post by TheFennekin »

CommanderABab wrote: 28 Jun 2020, 08:04
TheFennekin wrote: 28 Jun 2020, 07:57 How do you make your animation appear only in night? (Night animations)
Have these two lines in youe animation:

Code: Select all

      "light switching":true,
      "light":true,
Can I have an example json of a custom animation that will only appear at night? I want something to base on :)
Image
User avatar
Marvel
Metropolitan
Reactions:
Posts: 111
Joined: 29 Nov 2020, 06:47
Location: Indonesia
Plugins: Showcase Store
Version: Beta

Re: Custom animations

Post by Marvel »

Where to save the animation file
:space I LOVE THEOTOWN :space
User avatar
CommanderABab
AB
Reactions:
Posts: 11269
Joined: 07 Jun 2016, 19:12
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

Re: Custom animations

Post by CommanderABab »

FranchuFranchu wrote: 17 Jun 2018, 20:22 Since KoalaGuy was deleted, all his posts are gone. One of those posts was about custom animations. So here I am remaking the tutorial

To define your animation:

Code: Select all

[
   {
       "id":"myanimation",
       "frames":[ {
              "bmp":"myanim.png"
              "move x":5 //In moment number 1, 
             //our animation will be in x 5
             "move y":16 //and in y 16
           },{
              "bmp":"myanim.png"
              "move x":10 //In moment number 2, 
             //our animation will be in x 10
             "move y":16 //and in y 16
           }
           
         ]
         "handle interpolation":5 //5 ticks between
         //moment 1 and moment 2
     }
]
To use it:

Code: Select all

[ 
  {
    "id":"buildingwithanimation",
    "type":"decoration",
    "width":1,
    "height":1,
    "frames":[{"bmp":"basepart.png"}],
    "animation":[
      {"id":"myanimation"}
    ]
  }
 ]
I hope I didn't mess up with anything
You would normally put the animation in the same json file as the plugin. Like so:

Code: Select all

[
{Example 1 in quote
},
{Example 2 in quote
}
]
my avatar:
P
Pulga Wazaa
Settler
Reactions:
Posts: 1
Joined: 10 Oct 2023, 06:00

Re: Custom animations

Post by Pulga Wazaa »

I have a question
I can create an animation that looks like the animation of the energy supply buildings?
M
MeUsic
Villager
Reactions:
Posts: 8
Joined: 12 Mar 2022, 05:25

Re: Custom animations

Post by MeUsic »

Can someone explain to me how to make an animation array? I have the model and night lights model ready, but I can't make them appear in game.
User avatar
burgernamn
Inhabitant of a Megacity
Reactions:
Posts: 173
Joined: 15 Apr 2022, 08:32
Plugins: Showcase Store

Plugin Creator

Platform

Re: Custom animations

Post by burgernamn »

is ticks = speed of the animation?
D
Dzhiya
Settler
Reactions:
Posts: 3
Joined: 15 Apr 2024, 03:13

Plugin Creator

Platform

Re: Custom animations

Post by Dzhiya »

Does this animation reverse and repeatedly automatically? Or is there value?
User avatar
Khajnagari KH 09
Inhabitant of a Galaxy Cluster
Reactions:
Posts: 2680
Joined: 07 Apr 2024, 03:18
Location: ||||||
Plugins: Showcase Store

Plugin Creator

Platform

Re: Custom animations

Post by Khajnagari KH 09 »

How do we make night transition animation?
User avatar
Kulche
Inhabitant of a Continent
Reactions:
Posts: 1194
Joined: 07 Jun 2017, 18:28
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

Re: Custom animations

Post by Kulche »

a what now?
User avatar
Khajnagari KH 09
Inhabitant of a Galaxy Cluster
Reactions:
Posts: 2680
Joined: 07 Apr 2024, 03:18
Location: ||||||
Plugins: Showcase Store

Plugin Creator

Platform

Re: Custom animations

Post by Khajnagari KH 09 »

The transition from day to night makes different hues, how do we do that?
T
Theotown player69420
Settler
Reactions:
Posts: 1
Joined: 17 Apr 2024, 10:58

Re: Custom animations

Post by Theotown player69420 »

How do you finder the X and Y in a picture?
User avatar
ArthurJ22
Townsman
Reactions:
Posts: 82
Joined: 26 Oct 2020, 04:43

Plugin Creator

Platform

Re: Custom animations

Post by ArthurJ22 »

Theotown player69420 wrote: 24 May 2024, 07:29 How do you finder the X and Y in a picture?
Image

Example here I was measuring where the light would be, remember that if it is to up a frame it must be negative so it would be "y": -80

Image

As you can see, it's exactly as the guideline says. It's all about marking the spots and remembering where they go.

Keep in mind that ideally, you should use individual light frames if they are windows and the vast majority have the same shape, primarily to optimize plugin space.

Besides, it might be a bit trickier, but the same principle applies. As long as you know where the zero point is, you can position the frame correctly in X too.

Another option would be to use the Animation Dev Tool by ian, which is more visually intuitive and allows you to position the frames more easily.
User avatar
stepa12345
Villager
Reactions:
Posts: 19
Joined: 01 Jul 2021, 11:19

Re: Custom animations

Post by stepa12345 »

What is after the "//" explanation?
User avatar
CommanderABab
AB
Reactions:
Posts: 11269
Joined: 07 Jun 2016, 19:12
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

Re: Custom animations

Post by CommanderABab »

stepa12345 wrote: 22 Aug 2024, 19:41 What is after the "//" explanation?
A comment.
User avatar
stepa12345
Villager
Reactions:
Posts: 19
Joined: 01 Jul 2021, 11:19

Re: Custom animations

Post by stepa12345 »

Thanks
3
383828228
Small-town resident
Reactions:
Posts: 36
Joined: 20 Aug 2025, 10:50

Platform

Re: Custom animations

Post by 383828228 »

[
{
"id":"myanimation",
"frames":[ {
"bmp":"myanim.png"
"move x":5 //In moment number 1,
//our animation will be in x 5
"move y":16 //and in y 16
},{
"bmp":"myanim.png"
"move x":10 //In moment number 2,
//our animation will be in x 10
"move y":16 //and in y 16
}

]
"handle interpolation":5 //5 ticks between
//moment 1 and moment 2
}
]

You forgot the "type": "animation".
R
Redaba
Settler
Reactions:
Posts: 1
Joined: 24 Jan 2026, 13:43

Re: Custom animations

Post by Redaba »

How can I insert a cute moving animation, which can move when the screen is turned to the right, left, front, back and when it is night it still lights up? Is it still possible or possible to include it in the game?