Animation control

Any information about the fun attribute is given here.

Moderator: Plugin Moderators

User avatar
Lobby
Developer
Reactions:
Posts: 3225
Joined: Sun Oct 26, 2008 12:34
Plugins: Show
Version: Beta
Phone model: S7 edge

Animation control

Post by Lobby » Sun Sep 02, 2018 19:37

An often requested feature is animation control using fun. It's possible in recent versions and looks like that :json

Code: Select all

[
  {
    "id": "$anim_test_control00",
    "type": "terrain",
    "width":1,
    "height":1,
    "template":"$template_ground",
    "frames":[{"x":416,"y":96,"w":32,"h":16}],
    "animation":[
      {"id":"$animationfan00","x":-16,"y":-48}  // Animation slot 0
    ],
    "on click fun":{
      "condition":{"type":"animation running"},   // Is animation in slot 0 running?
      "action":{"type":"animation pause"},        // Pause it
      "else action":{"type":"animation resume"}   // Resume it
    }
  }
]
(this plugin doesn't need external graphics, you might just put it in a json file in your plugins folder)
Show
animation running
This condition is true if the animation slot specified by "level" (0 by default) is running right now. If "frame" is provided it will also check for the current visible frame to be the same as "frame".
Show
animation pause
This action pauses the animation slot "level" (0 by default). Additionally sets the frame to "frame" if specified.
Show
animation resume
This action resumes the animation slot "level" (0 by default). Additionally sets the frame to "frame" if specified.
:mine
...Have a nice stay

User avatar
Bearbear65
Inhabitant of a Universe
Reactions:
Posts: 4567
Joined: Fri Feb 10, 2017 14:53
Plugins: Show
Version: Beta
Phone model: Xperia™ XZ1 SO-01K

Re: Animation control

Post by Bearbear65 » Mon Sep 03, 2018 0:04

Is it possible to dictate other animations?
For example

Code: Select all

"condition":{"type":"animation running", "id":"animation ID"},
ImageJust my opinion
Theotown forum authoritarian

User avatar
JustAnyone
Junior Developer
Reactions:
Posts: 2481
Joined: Sun Jul 23, 2017 12:45
Location: Pickle command administration
Plugins: Show
Version: Beta
Phone model: Picklephone S5

Re: Animation control

Post by JustAnyone » Mon Sep 03, 2018 6:45

Yes, using sloths slots.
"level":1 will use 2nd animation which is defined in building "animation".

User avatar
Imran M
Inhabitant of a Megacity
Reactions:
Posts: 289
Joined: Wed Oct 24, 2018 13:41
Plugins: Show
Phone model: Huawei p8 lite

Re: Animation control

Post by Imran M » Sat Feb 09, 2019 15:15

So, you can make this stop and start an animation with this type of fun?
I HATE doing roofs, and I can't find any good window colours. :bb
I can also help, most of the time. As long as it's fun, or something easy, like making Json files.

My avatar is very original.

User avatar
Lobby
Developer
Reactions:
Posts: 3225
Joined: Sun Oct 26, 2008 12:34
Plugins: Show
Version: Beta
Phone model: S7 edge

Re: Animation control

Post by Lobby » Sat Feb 09, 2019 20:11

Yes, that's what it's for.
...Have a nice stay

Post Reply Previous topicNext topic

Return to “Fun attribute”

Who is online

Users browsing this forum: No registered users and 1 guest