Skip to content

Commit 5da357f

Browse files
add default particle strategy
1 parent ebfada8 commit 5da357f

File tree

3 files changed

+305
-59
lines changed

3 files changed

+305
-59
lines changed

Tutorial1-1Basics/src/main/java/com/smarttoolfactory/tutorial1_1basics/chapter6_graphics/ParticlePhysics.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,7 @@ class ExplodingParticle(
226226
)
227227
}
228228

229-
currentTime = trajectoryProgress
230-
// .mapInRange(0f, 1f, 0f, 1.4f)
229+
currentTime = scale(0f, 1f, trajectoryProgress, 0f, 1.4f)
231230

232231
// While trajectory progress is less than 70% have full alpha then slowly cre
233232
alpha = if (trajectoryProgress < .7f) 1f else

Tutorial1-1Basics/src/main/java/com/smarttoolfactory/tutorial1_1basics/chapter6_graphics/Tutorial6_30LinearInterpolation.kt

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -461,14 +461,6 @@ fun SnackCard(
461461
}
462462
}
463463

464-
@Preview
465-
@Composable
466-
fun Test() {
467-
val scaledValue = scale(0f, 1f, 0.5f, 100f, 200f)
468-
469-
println("scaledValue: $scaledValue")
470-
}
471-
472464
// Scale x1 from a1..b1 range to a2..b2 range
473465
internal fun scale(a1: Float, b1: Float, x1: Float, a2: Float, b2: Float) =
474466
lerp(a2, b2, calcFraction(a1, b1, x1))

0 commit comments

Comments
 (0)