在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):rxi/flux开源软件地址(OpenSource Url):https://github.com/rxi/flux开源编程语言(OpenSource Language):Lua 100.0%开源软件介绍(OpenSource Introduction):fluxA fast, lightweight tweening library for Lua. InstallationThe flux.lua file should be dropped into an existing project and required by it. flux = require "flux" The flux.update(deltatime) UsageAny number of numerical values in a table can be tweened simultaneously. Tweens
are started by using the
-- Moves the ball object to the position 200, 300 over 4 seconds
flux.to(ball, 4, { x = 200, y = 300 }) If you try to tween a variable which is already being tweened, the original tween stops tweening the variable and the new tween begins from the current value. Additional optionsAdditional options when creating a tween can be set through the use of chained
functions provided by the tween object which flux.to(t, 4, { x = 10 }):ease("linear"):delay(1) :ease(type)The easing type which should be used by the tween;
The default easing type is :delay(time)The amount of time flux should wait before starting the tween; :onstart(fn)Sets the function :onupdate(fn)Sets the function :oncomplete(fn)Sets the function :after([obj,] time, vars)Creates a new tween and chains it to the end of the existing tween; the chained
tween will be called after the original one has finished. Any additional
chained function used after -- Tweens t.x to 10 over 2 seconds, then to 20 over 1 second
flux.to(t, 2, { x = 10 }):after(t, 1, { x = 20 }) Stopping a tweenIf you want the ability to stop a tween before it has finished, the tween should be assigned to a variable when it is created. local tween = flux.to(x, 2, { y = 20 }):delay(1) The tween can then be stopped at any point by calling its tween:stop() This will cause the tween to immediatly be removed from its parent group and
will leave its tweened variables at their current values. The tween's
Groupsflux provides the ability to create tween groups; these are objects
which can have tweens added to them, and who are in charge of updating and
handling their contained tweens. A group is created by calling the
group = flux.group() Once a group is created it acts independently of the group:update(deltatime) To add a tween to a group, the group's group:to(t, 3, { x = 10, y = 20 }) A good example of where groups are useful is for games where you may have a set
of tweens which effect objects in the game world and which you want to pause
when the game is paused. A group's tweens can be paused by simply neglecting
to call its LicenseThis library is free software; you can redistribute it and/or modify it under the terms of the MIT license. See LICENSE for details. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论