Script v1.7.1.0
- AI
- Animals
- Contracts
- Debug
- Economy
- Effects
- Events
- Farms
- GUI
- AnimalScreen
- AnimationElement
- BitmapElement
- BoxLayoutElement
- BreadcrumbsElement
- ButtonElement
- ButtonOverlay
- ChatWindow
- CheckedOptionElement
- ClearElement
- ContextActionDisplay
- DialogElement
- FieldInfoDisplay
- FillLevelsDisplay
- FlowLayoutElement
- FocusManager
- FrameElement
- FrameReferenceElement
- GameInfoDisplay
- GamePausedDisplay
- Gui
- GuiDataSource
- GuiElement
- GuiMixin
- GuiOverlay
- GuiProfile
- GuiSoundPlayer
- GuiTopDownCamera
- GuiUtils
- HUDDisplayElement
- HUDElement
- HUDFrameElement
- HUDPopupMessage
- HUDTextDisplay
- IndexChangeSubjectMixin
- IndexStateElement
- InGameIcon
- IngameMap
- IngameMapElement
- InputGlyphElement
- InputHelpDisplay
- ListElement
- ListItemElement
- MapHotspot
- MapOverlayGenerator
- MixerWagonHUDExtension
- MultiTextOptionElement
- MultiValueTween
- Overlay
- PagingElement
- PlaySampleMixin
- RenderElement
- RoundStatusBar
- ScreenElement
- SettingsModel
- SideNotification
- SliderElement
- SpeakerDisplay
- SpeedMeterDisplay
- StableListElement
- StatusBar
- TabbedMenu
- TabbedMenuFrameElement
- TabbedMenuWithDetails
- TableElement
- TableHeaderElement
- TextElement
- TextInputElement
- TimerElement
- ToggleButtonElement
- TopNotification
- Tween
- TweenSequence
- VehicleHUDExtension
- VehicleSchemaDisplay
- VideoElement
- Handtools
- I3d
- Materials
- Misc
- Objects
- Placeables
- Player
- Shop
- Sounds
- Specializations
- Triggers
- Utils
- Vehicles
- Weather
Engine v1.7.1.0
- AI
- Animation
- Camera
- Entity
- Fillplanes
- General
- I3D
- Input
- Lighting
- Math
- Network
- Node
- Overlays
- Particle System
- Physics
- Rendering
- Scenegraph
- Shape
- Sound
- Spline
- String
- Terrain Detail
- Text Rendering
- Tire Track
- XML
- general
Foundation Reference
MultiValueTween
DescriptionTween class which handles multiple values at the same time. Start and end values must be passed in as arrays. The setter function must be able to handle as many arguments as there were entries in the start and end values arrays: setter called as function(unpack(values)).Parent
TweenFunctions
applyValue
DescriptionApply a value via the setter function.Definition
applyValue()Code
67 | function MultiValueTween:applyValue() |
68 | self.setter(unpack(self.values)) -- includes target as first entry if it was set |
69 | end |
new
DescriptionCreate a new Tween.Definition
new(table subClass, function setterFunction, table startValues, table endValues, float duration)Arguments
table | subClass | Subclass metatable for inheritance |
function | setterFunction | Values setter function. Signature: callback(v1, ..., vn) or callback(target, v1, ..., vn). |
table | startValues | Original values |
table | endValues | Target values |
float | duration | Duration of tween in milliseconds |
23 | function MultiValueTween.new(subClass, setterFunction, startValues, endValues, duration) |
24 | if not subClass or subClass == MultiValueTween then |
25 | subClass = MultiValueTween_mt |
26 | end |
27 | |
28 | local self = MultiValueTween:superClass().new(subClass, setterFunction, startValues, endValues, duration) |
29 | |
30 | self.values = {unpack(startValues)} |
31 | |
32 | return self |
33 | end |
setTarget
DescriptionSet a callback target for this tween. If a target has been set, the setter function must support receiving the target as its first argument.Definition
setTarget()Code
38 | function MultiValueTween:setTarget(target) |
39 | local hadTarget = self.functionTarget ~= nil |
40 | MultiValueTween:superClass().setTarget(self, target) |
41 | |
42 | if target ~= nil and not hadTarget then |
43 | table.insert(self.values, 1, target) |
44 | elseif target == nil and hadTarget then |
45 | table.remove(self.values, 1) |
46 | else |
47 | self.values[1] = target |
48 | end |
49 | end |
tweenValue
DescriptionGet the current tween value.Definition
tweenValue()Code
53 | function MultiValueTween:tweenValue(t) |
54 | local targetOffset = self.functionTarget ~= nil and 1 or 0 |
55 | |
56 | for i = 1, #self.startValue do |
57 | local startValue = self.startValue[i] |
58 | local endValue = self.endValue[i] |
59 | self.values[i + targetOffset] = MathUtil.lerp(startValue, endValue, self.curveFunc(t)) |
60 | end |
61 | |
62 | return self.values |
63 | end |