Module vn.tween

tween.lua Provides the 'built-in' VN tween functions.

Functions

bgtween (tex, ...) Tweens background image to the texture specified by tex
bitmapTween (img, dstTex, fadeFilename, duration, range, interpolator) Tweens an image following the shape of the specified grayscale bitmap
bitmapTweenIn (img, fadeFilename, duration, range, interpolator) Tweens in an image following the shape of the specified grayscale bitmap
bitmapTweenOut (img, fadeFilename, duration, range, interpolator) Tweens out an image following the shape of the specified grayscale bitmap
crossFadeTween (img, dstTex, duration, interpolator) Tweens an image to a new texture using a cross fade transition
imgtween (i, t) Tweens i to the texture specified by t
shaderBounceTween (img, dstTex, duration, bounceTime, gs, ps) Temporarily changes the shaders of img to gs, ps, animates them to time=1.0, then changes the texture of img to dstTex.
shaderTween (img, duration, tex1, gs1, ps1, tex2, gs2, ps2) Fades an image using from tex1, gs1, ps1 to tex2, gs2, ps2.
shaderTweenIn (img, duration, gs, ps) Fades in an image using shaders.
shaderTweenOut (img, duration, gs, ps) Fades out an image using shaders.
shutterTween (img, tex, dir, steps, duration) Tweens an image to a new texture using a shutter transition
shutterTweenIn (img, dir, steps, duration) Tweens in an image using a shutter transition
shutterTweenOut (img, dir, steps, duration) Tweens out an image using a shutter transition
wipeTween (img, tex, dir, span, duration) Tweens an image to a new texture using a wipe transition
wipeTweenIn (img, dir, span, duration) Tweens in an image using a wipe transition
wipeTweenOut (img, dir, span, duration) Tweens out an image using a wipe transition


Functions

bgtween (tex, ...)
Tweens background image to the texture specified by tex

Parameters:

  • tex: A texture object or a path to a valid image file
  • ...:
bitmapTween (img, dstTex, fadeFilename, duration, range, interpolator)
Tweens an image following the shape of the specified grayscale bitmap

Parameters:

  • img: The image to bitmap-tween
  • dstTex: The new texture for the image
  • fadeFilename: The bitmap that determines the shape of the tween
  • duration: The duration of the tween in frames (will be multiplied by effectSpeed internally).
  • range: Determines the relative width of the fading region between 0.0 and 1.0
  • interpolator: A function or interpolator object mapping an input in the range (0, 1) to an output in the range (0, 1).

Return value:

    false if the bitmap tween isn't supported on the current hardware. Useful to provide a fallback tween in case the bitmap tween doesn't work.
bitmapTweenIn (img, fadeFilename, duration, range, interpolator)
Tweens in an image following the shape of the specified grayscale bitmap

Parameters:

  • img: The image to bitmap-tween
  • fadeFilename: The bitmap that determines the shape of the tween
  • duration: The duration of the tween in frames (will be multiplied by effectSpeed internally).
  • range: Determines the relative width of the fading region between 0.0 and 1.0
  • interpolator: A function or interpolator object mapping an input in the range (0, 1) to an output in the range (0, 1).

Return value:

    false if the bitmap tween isn't supported on the current hardware. Useful to provide a fallback tween in case the bitmap tween doesn't work.

See also:

bitmapTweenOut (img, fadeFilename, duration, range, interpolator)
Tweens out an image following the shape of the specified grayscale bitmap

Parameters:

  • img: The image to bitmap-tween
  • fadeFilename: The bitmap that determines the shape of the tween
  • duration: The duration of the tween in frames (will be multiplied by effectSpeed internally).
  • range: Determines the relative width of the fading region between 0.0 and 1.0
  • interpolator: A function or interpolator object mapping an input in the range (0, 1) to an output in the range (0, 1).

Return value:

    false if the bitmap tween isn't supported on the current hardware. Useful to provide a fallback tween in case the bitmap tween doesn't work.

See also:

crossFadeTween (img, dstTex, duration, interpolator)
Tweens an image to a new texture using a cross fade transition

Parameters:

  • img: The image to crossfade
  • dstTex: The new texture for the image
  • duration: The duration of the fade in frames (will be multiplied by effectSpeed internally).
  • interpolator: A function or interpolator object mapping an input in the range (0, 1) to an output in the range (0, 1).

Return value:

    false if the crossfade tween isn't supported on the current hardware.
imgtween (i, t)
Tweens i to the texture specified by t

Parameters:

  • i: The image to change the texture of.
  • t: A texture object or a path to a valid image file
shaderBounceTween (img, dstTex, duration, bounceTime, gs, ps)
Temporarily changes the shaders of img to gs, ps, animates them to time=1.0, then changes the texture of img to dstTex. After the texture has been changed, the shaders are animated back to time=0.0, and then replaced by the original shaders of img.

Parameters:

  • img: The image to tween
  • dstTex: The new texture for img
  • duration: The duration of the tween in frames
  • bounceTime: The shader time that should be reached halfway through the tween (at the bounce point). Defaults to 1.0
  • gs: The geometry shader to use during the tween (or nil to use the current geometry shader).
  • ps: The pixel shader to use during the tween (or nil to use the current pixel shader).
shaderTween (img, duration, tex1, gs1, ps1, tex2, gs2, ps2)
Fades an image using from tex1, gs1, ps1 to tex2, gs2, ps2.

Parameters:

  • img: The image to change the texture of.
  • duration: The duration of the tween in frames (will be multiplied by effectSpeed internally).
  • tex1: The start texture for the tween
  • gs1: The start geometry shader for the tween
  • ps1: The start pixel shader for the tween
  • tex2: The end texture for the tween
  • gs2: The end geometry shader for the tween
  • ps2: The end pixel shader for the tween
shaderTweenIn (img, duration, gs, ps)
Fades in an image using shaders.

Parameters:

  • img: The image to tween
  • duration: The duration of the tween in frames (will be multiplied by effectSpeed internally).
  • gs: The end geometry shader for the tween
  • ps: The end pixel shader for the tween

See also:

shaderTweenOut (img, duration, gs, ps)
Fades out an image using shaders.

Parameters:

  • img: The image to tween
  • duration: The duration of the tween in frames (will be multiplied by effectSpeed internally).
  • gs: The start geometry shader for the tween
  • ps: The start pixel shader for the tween

See also:

shutterTween (img, tex, dir, steps, duration)
Tweens an image to a new texture using a shutter transition

Parameters:

  • img: The image to shutter-tween
  • tex: The new texture for the image
  • dir: The direction of the shutter, 4=left, 8=up, 6=right, 2=down
  • steps: The number of bars for the shutter tween
  • duration: The duration of the tween in frames (will be multiplied by effectSpeed internally).
shutterTweenIn (img, dir, steps, duration)
Tweens in an image using a shutter transition

Parameters:

  • img: The image to shutter-tween
  • dir: The direction of the shutter, 4=left, 8=up, 6=right, 2=down
  • steps: The number of bars for the shutter tween
  • duration: The duration of the tween in frames (will be multiplied by effectSpeed internally).

See also:

shutterTweenOut (img, dir, steps, duration)
Tweens out an image using a shutter transition

Parameters:

  • img: The image to shutter-tween
  • dir: The direction of the shutter, 4=left, 8=up, 6=right, 2=down
  • steps: The number of bars for the shutter tween
  • duration: The duration of the tween in frames (will be multiplied by effectSpeed internally).

See also:

wipeTween (img, tex, dir, span, duration)
Tweens an image to a new texture using a wipe transition

Parameters:

  • img: The image to wipe-tween
  • tex: The new texture for the image
  • dir: The direction of the wipe, 4=left, 8=up, 6=right, 2=down
  • span: The range (between 0.0 and 1.0) of the partially transparent area of the wipe tween.
  • duration: The duration of the tween in frames (will be multiplied by effectSpeed internally).
wipeTweenIn (img, dir, span, duration)
Tweens in an image using a wipe transition

Parameters:

  • img: The image to wipe-tween
  • dir: The direction of the wipe, 4=left, 8=up, 6=right, 2=down
  • span: The range (between 0.0 and 1.0) of the partially transparent area of the wipe tween.
  • duration: The duration of the tween in frames (will be multiplied by effectSpeed internally).

See also:

wipeTweenOut (img, dir, span, duration)
Tweens out an image using a wipe transition

Parameters:

  • img: The image to wipe-tween
  • dir: The direction of the wipe, 4=left, 8=up, 6=right, 2=down
  • span: The range (between 0.0 and 1.0) of the partially transparent area of the wipe tween.
  • duration: The duration of the tween in frames (will be multiplied by effectSpeed internally).

See also:

Valid XHTML 1.0!