Skip to content

Instantly share code, notes, and snippets.

@Xion
Created February 27, 2023 22:35
Show Gist options
  • Save Xion/5ee232d1dde0f66ca8d968db098dba9d to your computer and use it in GitHub Desktop.
Save Xion/5ee232d1dde0f66ca8d968db098dba9d to your computer and use it in GitHub Desktop.
EffectAsset {
name: "particle_swirl",
capacity: 8192,
spawner: Spawner {
num_particles: Single(
64.0,
),
spawn_time: Single(
1.0,
),
period: Single(
1.0,
),
time: 0.0,
curr_spawn_time: 0.0,
limit: 0.0,
spawn: 0.0,
active: true,
},
init_layout: InitLayout {
position_code: "\n // >>> [PositionCircleModifier]\n // Circle center\n let c = vec3<f32>(0., 0., 0.);\n // Circle basis\n let tangent = vec3<f32>(1., -0., -0.);\n let bitangent = vec3<f32>(-0., 1., -0.);\n // Circle radius\n let r = 12.;\n // Radial speed\n let speed = rand() * (16. - 8.) + 8.;\n // Spawn random point on/in circle\n let theta = rand() * tau;\n let dir = tangent * cos(theta) + bitangent * sin(theta);\n ret.pos = c + r * dir + transform[3].xyz;\n // Velocity away from center\n ret.vel = dir * speed;\n // <<< [PositionCircleModifier]\n ",
lifetime_code: "\n // >>> [ParticleLifetimeModifier]\n ret = 1.5;\n // <<< [ParticleLifetimeModifier]\n",
},
update_layout: UpdateLayout {
accel: Vec3(
0.0,
0.0,
0.0,
),
drag_coefficient: 0.0,
force_field: [
ForceFieldSource {
position: Vec3(
0.0,
72.0,
0.0,
),
max_radius: 48.0,
min_radius: 1.0,
mass: 2.0,
force_exponent: 1.0,
conform_to_sphere: true,
},
ForceFieldSource {
position: Vec3(
0.0,
-72.0,
0.0,
),
max_radius: 48.0,
min_radius: 1.0,
mass: 2.0,
force_exponent: 1.0,
conform_to_sphere: true,
},
ForceFieldSource {
position: Vec3(
-72.0,
0.0,
0.0,
),
max_radius: 48.0,
min_radius: 1.0,
mass: -2.0,
force_exponent: 1.0,
conform_to_sphere: true,
},
ForceFieldSource {
position: Vec3(
72.0,
0.0,
0.0,
),
max_radius: 48.0,
min_radius: 1.0,
mass: -2.0,
force_exponent: 1.0,
conform_to_sphere: true,
},
ForceFieldSource {
position: Vec3(
0.0,
0.0,
0.0,
),
max_radius: 0.0,
min_radius: 0.1,
mass: 0.0,
force_exponent: 0.0,
conform_to_sphere: false,
},
ForceFieldSource {
position: Vec3(
0.0,
0.0,
0.0,
),
max_radius: 0.0,
min_radius: 0.1,
mass: 0.0,
force_exponent: 0.0,
conform_to_sphere: false,
},
ForceFieldSource {
position: Vec3(
0.0,
0.0,
0.0,
),
max_radius: 0.0,
min_radius: 0.1,
mass: 0.0,
force_exponent: 0.0,
conform_to_sphere: false,
},
ForceFieldSource {
position: Vec3(
0.0,
0.0,
0.0,
),
max_radius: 0.0,
min_radius: 0.1,
mass: 0.0,
force_exponent: 0.0,
conform_to_sphere: false,
},
ForceFieldSource {
position: Vec3(
0.0,
0.0,
0.0,
),
max_radius: 0.0,
min_radius: 0.1,
mass: 0.0,
force_exponent: 0.0,
conform_to_sphere: false,
},
ForceFieldSource {
position: Vec3(
0.0,
0.0,
0.0,
),
max_radius: 0.0,
min_radius: 0.1,
mass: 0.0,
force_exponent: 0.0,
conform_to_sphere: false,
},
ForceFieldSource {
position: Vec3(
0.0,
0.0,
0.0,
),
max_radius: 0.0,
min_radius: 0.1,
mass: 0.0,
force_exponent: 0.0,
conform_to_sphere: false,
},
ForceFieldSource {
position: Vec3(
0.0,
0.0,
0.0,
),
max_radius: 0.0,
min_radius: 0.1,
mass: 0.0,
force_exponent: 0.0,
conform_to_sphere: false,
},
ForceFieldSource {
position: Vec3(
0.0,
0.0,
0.0,
),
max_radius: 0.0,
min_radius: 0.1,
mass: 0.0,
force_exponent: 0.0,
conform_to_sphere: false,
},
ForceFieldSource {
position: Vec3(
0.0,
0.0,
0.0,
),
max_radius: 0.0,
min_radius: 0.1,
mass: 0.0,
force_exponent: 0.0,
conform_to_sphere: false,
},
ForceFieldSource {
position: Vec3(
0.0,
0.0,
0.0,
),
max_radius: 0.0,
min_radius: 0.1,
mass: 0.0,
force_exponent: 0.0,
conform_to_sphere: false,
},
ForceFieldSource {
position: Vec3(
0.0,
0.0,
0.0,
),
max_radius: 0.0,
min_radius: 0.1,
mass: 0.0,
force_exponent: 0.0,
conform_to_sphere: false,
},
],
},
render_layout: RenderLayout {
particle_texture: None,
lifetime_color_gradient: Some(
Gradient {
keys: [
GradientKey {
ratio: 0.0,
value: Vec4(
1.0,
1.0,
0.0,
0.75,
),
},
GradientKey {
ratio: 0.5,
value: Vec4(
1.0,
1.0,
0.0,
1.0,
),
},
GradientKey {
ratio: 1.0,
value: Vec4(
1.0,
1.0,
0.0,
0.01,
),
},
],
},
),
lifetime_size_gradient: Some(
Gradient {
keys: [
GradientKey {
ratio: 0.0,
value: Vec2(
1.0,
1.0,
),
},
],
},
),
billboard: false,
},
z_layer_2d: 0.0,
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment