I'm trying to use this amazing library to make themes with different images (such as a chinese new years theme where I need lanterns to flow from the bottom up).
For this, I need the images to not be spawned with a default rotation position.
I think an easy way to implement this is to update the Snowflake.ts file and add an option to the SnowflakeProps interface to allow starting and ending radiuses for the rotation attribute.
Something like this for the SnowflakeProps:
export interface SnowflakeProps {
/** The color of the snowflake, can be any valid CSS color. */
color: string
/**
* The minimum and maximum radius of the snowflake, will be
* randomly selected within this range.
*
* The default value is `[0.5, 3.0]`.
*/
radius: [number, number]
/**
* The minimum and maximum speed of the snowflake.
*
* The speed determines how quickly the snowflake moves
* along the y axis (vertical speed).
*
* The values will be randomly selected within this range.
*
* The default value is `[1.0, 3.0]`.
*/
speed: [number, number]
/**
* The minimum and maximum wind of the snowflake.
*
* The wind determines how quickly the snowflake moves
* along the x axis (horizontal speed).
*
* The values will be randomly selected within this range.
*
* The default value is `[-0.5, 2.0]`.
*/
wind: [number, number]
/**
* The frequency in frames that the wind and speed values
* will update.
*
* The default value is 200.
*/
changeFrequency: number
/**
* An array of images that will be rendered as the snowflakes instead
* of the default circle shapes.
*/
images?: CanvasImageSource[]
/**
* The minimum and maximum initial rotation of the snowflake.
*
* The rotation determines the initial rotation of the snowflake.
*
* The values will be randomly selected within this range.
*
* The default value is `[0, 360]`.
*/
rotation: [number, number]
/**
* The minimum and maximum rotation speed of the snowflake (in degrees of
* rotation per frame).
*
* The rotation speed determines how quickly the snowflake rotates when
* an image is being rendered.
*
* The values will be randomly selected within this range.
*
* The default value is `[-1.0, 1.0]`.
*/
rotationSpeed: [number, number]
/**
* The minimum and maximum opacity of the snowflake image.
*
* This value only applies to snowflakes that are using images.
*
* The values will be randomly selected within this range.
*
* The default value is `[1, 1]`.
*/
opacity: [number, number]
}
And the same for all the affected lines using the rotation attribute.
I can implement this myself if contributions are welcome.
I'm trying to use this amazing library to make themes with different images (such as a chinese new years theme where I need lanterns to flow from the bottom up).
For this, I need the images to not be spawned with a default rotation position.
I think an easy way to implement this is to update the Snowflake.ts file and add an option to the
SnowflakePropsinterface to allow starting and ending radiuses for the rotation attribute.Something like this for the
SnowflakeProps:And the same for all the affected lines using the rotation attribute.
I can implement this myself if contributions are welcome.