0
0
Fork 0
mirror of https://gitlab.com/Oreolek/salet-module.git synced 2024-05-24 11:58:21 +03:00

Now you can use animateBlock on its own

This commit is contained in:
Alexander Yakovlev 2016-11-04 20:31:23 +07:00
parent 01ad80aae0
commit 8488ed83c8
2 changed files with 7 additions and 3 deletions

View file

@ -1,6 +1,6 @@
{
"name": "salet",
"version": "1.5.1",
"version": "1.5.2",
"description": "A general client-side framework for cybertext interactive fiction games.",
"keywords": ["ifiction", "interactive fiction", "games", "coffee-script", "text", "menu"],
"homepage": "http://salet.oreolek.ru",

View file

@ -244,13 +244,17 @@ class SaletView
# A function to play CSS animation on a block.
# Implies the effect is one-time, not infinite.
# @param block - jQuery object
# @param effect - animate.css effect to call
# @param block - jQuery object or selector
# @param effect - css effect to call
# @param after - a callback function to execute after the animation is done
@animateBlock = (block, effect, after = undefined) ->
block = jQuery(block)
animation = block.css("animation-name") or block.css("-moz-animation-name") or block.css("-webkit-animation-name")
if animation
@clearAnimation(block)
if not after?
after = (event) ->
salet.view.clearAnimation(event.target)
block.addClass("animated")
block.addClass(effect)