mirror of
https://github.com/rive-app/rive-react.git
synced 2026-03-13 08:22:30 +08:00
chore: update color setter methods to be more explicit
This commit is contained in:
@@ -20,10 +20,10 @@ export default function useViewModelInstanceColor(
|
||||
{
|
||||
value: number;
|
||||
setValue: (value: number) => void;
|
||||
rgb: (r: number, g: number, b: number) => void;
|
||||
rgba: (r: number, g: number, b: number, a: number) => void;
|
||||
alpha: (a: number) => void;
|
||||
opacity: (o: number) => void;
|
||||
setRgb: (r: number, g: number, b: number) => void;
|
||||
setRgba: (r: number, g: number, b: number, a: number) => void;
|
||||
setAlpha: (a: number) => void;
|
||||
setOpacity: (o: number) => void;
|
||||
}
|
||||
>(
|
||||
path,
|
||||
@@ -34,10 +34,10 @@ export default function useViewModelInstanceColor(
|
||||
(instance, value, setValue) => ({
|
||||
value,
|
||||
setValue,
|
||||
rgb: (r, g, b) => instance?.rgb(r, g, b),
|
||||
rgba: (r, g, b, a) => instance?.rgba(r, g, b, a),
|
||||
alpha: (a) => instance?.alpha(a),
|
||||
opacity: (o) => instance?.opacity(o),
|
||||
setRgb: (r, g, b) => instance?.rgb(r, g, b),
|
||||
setRgba: (r, g, b, a) => instance?.rgba(r, g, b, a),
|
||||
setAlpha: (a) => instance?.alpha(a),
|
||||
setOpacity: (o) => instance?.opacity(o),
|
||||
})
|
||||
);
|
||||
}
|
||||
@@ -178,7 +178,7 @@ export type UseViewModelInstanceColorResult = {
|
||||
* Set the red value of the color.
|
||||
* @param r - The red value to set the color to.
|
||||
*/
|
||||
rgb: (r: number, g: number, b: number) => void;
|
||||
setRgb: (r: number, g: number, b: number) => void;
|
||||
/**
|
||||
* Set the red, green, blue, and alpha values of the color.
|
||||
* @param r - The red value to set the color to.
|
||||
@@ -186,17 +186,17 @@ export type UseViewModelInstanceColorResult = {
|
||||
* @param b - The blue value to set the color to.
|
||||
* @param a - The alpha value to set the color to.
|
||||
*/
|
||||
rgba: (r: number, g: number, b: number, a: number) => void;
|
||||
setRgba: (r: number, g: number, b: number, a: number) => void;
|
||||
/**
|
||||
* Set the alpha value of the color.
|
||||
* @param a - The alpha value to set the color to.
|
||||
*/
|
||||
alpha: (a: number) => void;
|
||||
setAlpha: (a: number) => void;
|
||||
/**
|
||||
* Set the opacity value of the color.
|
||||
* @param o - The opacity value to set the color to.
|
||||
*/
|
||||
opacity: (o: number) => void;
|
||||
setOpacity: (o: number) => void;
|
||||
};
|
||||
|
||||
export type UseViewModelInstanceEnumResult = {
|
||||
|
||||
Reference in New Issue
Block a user