Script v1_7_1_0
- AI
- Animals
- Collections
- Contracts
- Debug
- Economy
- Elements
- EnvironmentalScore
- Errors
- Events
- GUI
- AnimalScreen
- AnimationElement
- BitmapElement
- BoxLayoutElement
- BreadcrumbsElement
- ButtonElement
- ButtonOverlay
- ChatWindow
- CheckedOptionElement
- ClearElement
- ColorPickButtonElement
- ConstructionScreen
- ContextActionDisplay
- ControlBarDisplay
- DialogElement
- DynamicFadedBitmapElement
- FillLevelsDisplay
- FlowLayoutElement
- FocusManager
- FrameElement
- FrameReferenceElement
- GameInfoDisplay
- GameInfoDisplayMobile
- GamePausedDisplay
- Gui
- GuiDataSource
- GuiElement
- GuiMixin
- GuiOverlay
- GuiProfile
- GuiSoundPlayer
- GuiTopDownCamera
- GuiTopDownCursor
- GuiUtils
- HUDDisplayElement
- HUDElement
- HUDFrameElement
- HUDPopupMessage
- HUDSliderElement
- HUDTextDisplay
- IndexChangeSubjectMixin
- IndexStateElement
- InfoDisplay
- InfoHUDBox
- InGameIcon
- IngameMap
- IngameMapElement
- InputGlyphElement
- InputGlyphElementUI
- InputHelpDisplay
- KeyValueInfoHUDBox
- ListElement
- ListItemElement
- MapOverlayGenerator
- MixerWagonHUDExtension
- MultiTextOptionElement
- MultiValueTween
- Overlay
- PagingElement
- PictureElement
- PlatformIconElement
- PlayerControlPadDisplay
- PlaySampleMixin
- RenderElement
- RoundStatusBar
- ScreenElement
- ScrollingLayoutElement
- SettingsModel
- SideNotification
- SideNotificationMobile
- SliderElement
- SpeakerDisplay
- SpeedMeterDisplay
- SpeedSliderDisplay
- StatusBar
- SteeringSliderDisplay
- TabbedMenu
- TabbedMenuFrameElement
- TabbedMenuWithDetails
- TableElement
- TableHeaderElement
- TerrainLayerElement
- TextBackdropElement
- TextElement
- TextInputElement
- ThreePartBitmapElement
- TimerElement
- ToggleButtonElement
- TopNotification
- Tween
- TweenSequence
- VariableWorkWidthHUDExten...
- VehicleHUDExtension
- VehicleSchemaDisplay
- VideoElement
- WardrobeScreen
- Handtools
- Hud
- I3d
- Input
- Jobs
- Maps
- Materials
- Misc
- Objects
- Parameters
- Placeables
- Placement
- Player
- Shop
- Sounds
- Specialization
- Specializations
- StateMachine
- Statistics
- Tasks
- Triggers
- Utils
- Vehicles
Engine v1_7_1_0
- AI
- Animation
- Camera
- Entity
- Fillplanes
- general
- General
- I3D
- Input
- Lighting
- Math
- Network
- Node
- NoteNode
- Overlays
- Particle System
- Physics
- Rendering
- Scenegraph
- Shape
- Sound
- Spline
- String
- Terrain Detail
- Text Rendering
- Tire Track
- VoiceChat
- XML
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
63 | function MultiValueTween:applyValue() |
64 | self.setter(unpack(self.values)) -- includes target as first entry if it was set |
65 | 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(setterFunction, startValues, endValues, duration, customMt) |
24 | local self = Tween.new(setterFunction, startValues, endValues, duration, customMt or MultiValueTween_mt) |
25 | |
26 | self.values = {unpack(startValues)} |
27 | |
28 | return self |
29 | 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
34 | function MultiValueTween:setTarget(target) |
35 | local hadTarget = self.functionTarget ~= nil |
36 | MultiValueTween:superClass().setTarget(self, target) |
37 | |
38 | if target ~= nil and not hadTarget then |
39 | table.insert(self.values, 1, target) |
40 | elseif target == nil and hadTarget then |
41 | table.remove(self.values, 1) |
42 | else |
43 | self.values[1] = target |
44 | end |
45 | end |
tweenValue
DescriptionGet the current tween value.Definition
tweenValue()Code
49 | function MultiValueTween:tweenValue(t) |
50 | local targetOffset = self.functionTarget ~= nil and 1 or 0 |
51 | |
52 | for i = 1, #self.startValue do |
53 | local startValue = self.startValue[i] |
54 | local endValue = self.endValue[i] |
55 | self.values[i + targetOffset] = MathUtil.lerp(startValue, endValue, self.curveFunc(t)) |
56 | end |
57 | |
58 | return self.values |
59 | end |