java.lang.Object
org.praxislive.code.userapi.Property
- Direct Known Subclasses:
PropertyControl
A field type for properties (see
to access the backing Property.
@P). The Property type also backs
other none-resource-loading properties - use
invalid reference
p(String id)
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classProvides keyframe animation support for Property. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionanimator()Return the Animator for the Property, creating it if necessary.protected voidattach(CodeContext<?> context, Property previous) Clear all Linkables from the Property.doubles()Return a newLinkable.Doublefor observing changing values.protected voidget()Return the current value.booleanReturn the current value as a boolean, or false if the value isn't a valid boolean.booleangetBoolean(boolean def) Return the current value as a boolean, or the provided default if the value isn't a valid boolean.doubleReturn the current value as a double, or zero if the value isn't numeric.doublegetDouble(double def) Return the current value as a double, or the provided default if the value isn't numeric.protected abstract ValuegetImpl()protected abstract doublegetImpl(double def) intgetInt()Return the current value as an int, or zero if the value isn't numeric.intgetInt(int def) Return the current value as an int, or the provided default if the value isn't numeric.protected booleanhasLinks()booleanReturn whether the property is currently animating.link(DoubleConsumer consumer) Call the provided consumer with the double value whenever the value changes.<T> PropertyCall the provided consumer when the value changes, transformed using the converter into the required type T.<T> Propertyprotected voidreset()set(double value) Set the current value.Set the current value.protected abstract voidsetImpl(long time, double value) protected abstract voidto(double... to) Animate the property value to the provided values.protected voidupdateLinks(double value) protected voidupdateLinks(Value value) Return a newLinkablefor observing changing values.<T> Linkable<T> Return a newLinkablefor observing changing values.
-
Constructor Details
-
Property
protected Property()
-
-
Method Details
-
attach
-
setImpl
- Throws:
Exception
-
setImpl
- Throws:
Exception
-
getImpl
-
getImpl
protected abstract double getImpl(double def) -
get
Return the current value.- Returns:
- value
-
getDouble
public double getDouble()Return the current value as a double, or zero if the value isn't numeric.- Returns:
- current value as double
- See Also:
-
getDouble
public double getDouble(double def) Return the current value as a double, or the provided default if the value isn't numeric.- Returns:
- current value as double
-
getInt
public int getInt()Return the current value as an int, or zero if the value isn't numeric. Floating point values are rounded to the nearest int.- Returns:
- current value as int
- See Also:
-
getInt
public int getInt(int def) Return the current value as an int, or the provided default if the value isn't numeric. Floating point values are rounded to the nearest int.- Returns:
- current value as int
-
getBoolean
public boolean getBoolean()Return the current value as a boolean, or false if the value isn't a valid boolean.- Returns:
- current value as boolean
-
getBoolean
public boolean getBoolean(boolean def) Return the current value as a boolean, or the provided default if the value isn't a valid boolean.- Returns:
- current value as boolean
-
set
Set the current value. Also stops any active animation.- Parameters:
value- Value subclass to set- Returns:
- this
-
set
Set the current value. Also stops any active animation.- Parameters:
value- double value to set- Returns:
- this
-
link
Call the provided consumer with the double value whenever the value changes. This is a shorthand fordoubles().link(consumer);. The double value will be as if callinggetDouble().- Parameters:
consumer- double consumer- Returns:
- this
-
doubles
Return a newLinkable.Doublefor observing changing values. The double value will be as if callinggetDouble().- Returns:
- Linkable.Double of values.
-
linkAs
Call the provided consumer when the value changes, transformed using the converter into the required type T. This is shorthand forvaluesAs(converter).link(consumer);.- Type Parameters:
T- type- Parameters:
converter- convert Value into required typeconsumer-- Returns:
- this
-
linkAs
-
valuesAs
Return a newLinkablefor observing changing values. The value will be mapped to the required type using the passed in converter.- Type Parameters:
T- required type- Parameters:
converter- convert Value into required type- Returns:
- Linkable of values
-
valuesAs
Return a newLinkablefor observing changing values. The value will be mapped to the provided Value sub-type. If the value cannot be coerced into the required type no value will be received by the created Linkable.- Type Parameters:
T- required type- Parameters:
type- Sub-type of Value- Returns:
- Linkable of values
-
clearLinks
Clear all Linkables from the Property.- Returns:
- this
-
animator
Return the Animator for the Property, creating it if necessary.- Returns:
- property animator
-
to
Animate the property value to the provided values. This is a shorthand for callinganimator().to(...).This method returns the animator so that you can chain calls, eg.
prop.to(1, 0).in(1, 0.25).easeInOut();- Returns:
- property animator
-
isAnimating
public boolean isAnimating()Return whether the property is currently animating.- Returns:
- property animator active
-
finishAnimating
protected void finishAnimating() -
updateLinks
protected void updateLinks(double value) -
updateLinks
-
hasLinks
protected boolean hasLinks() -
reset
protected void reset()
-