Release Kaleido 0.6.2 with a kaleidoscope startup animation
All checks were successful
Validate and publish Kaleido / android (push) Successful in 2m26s

The cold-start iris is replaced with Kaleido Desktop's kaleidoscope: a
mirrored field of shards gathers into the mark, then the camera flies
through its centre as before. A still, faint field holds until startup is
ready, keeping cold-start hitches out of the motion.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Elijah 2026-10-31 19:47:07 -07:00
parent 30e0f30bca
commit 0ee43ffa76
8 changed files with 134 additions and 147 deletions

View file

@ -16,30 +16,24 @@ import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.Path
import androidx.compose.ui.graphics.PathFillType
import androidx.compose.ui.graphics.drawscope.Stroke
import androidx.compose.ui.graphics.drawscope.clipPath
import androidx.compose.ui.graphics.drawscope.clipRect
import androidx.compose.ui.graphics.drawscope.withTransform
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.semantics.clearAndSetSemantics
import androidx.compose.ui.semantics.contentDescription
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.drawText
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.rememberTextMeasurer
import androidx.compose.ui.unit.sp
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.withTimeoutOrNull
import kotlin.math.PI
import kotlin.math.cos
import kotlin.math.exp
import kotlin.math.ln
import kotlin.math.max
import kotlin.math.sin
private class ApertureFacet(val points:List<Offset>,val color:Color,val normal:Offset)
private class KaleidoFacet(val points:List<Offset>,val centroid:Offset,val color:Color,val angle:Float)
// Exact geometry and colors from brand_mark.xml, centered on its 64-unit viewport.
// Each facet carries the outward normal of its hexagon edge for the iris motion.
private val apertureFacets=listOf(
// Each facet carries its centroid and the angle of its hexagon edge's outward normal.
private val kaleidoFacets=listOf(
floatArrayOf(33f,4f,55.5f,17f,42.5f,24.5f,33f,19f) to 0xFFC3E8D3,
floatArrayOf(56.5f,19f,56.5f,45f,43.5f,37.5f,43.5f,26.5f) to 0xFF71B9B0,
floatArrayOf(55.5f,47f,33f,60f,33f,45f,42.5f,39.5f) to 0xFF3D7C7B,
@ -47,52 +41,65 @@ private val apertureFacets=listOf(
floatArrayOf(7.5f,45f,7.5f,19f,20.5f,26.5f,20.5f,37.5f) to 0xFFE9D8AE,
floatArrayOf(8.5f,17f,31f,4f,31f,19f,21.5f,24.5f) to 0xFFEEF2DD
).mapIndexed { index,(points,color) ->
val angle=(-60.0+60*index)*PI/180
ApertureFacet(points.toList().chunked(2){Offset(it[0]-32f,it[1]-32f)},Color(color),Offset(cos(angle).toFloat(),sin(angle).toFloat()))
val corners=points.toList().chunked(2){Offset(it[0]-32f,it[1]-32f)}
val centroid=Offset(corners.sumOf{it.x.toDouble()}.toFloat()/4,corners.sumOf{it.y.toDouble()}.toFloat()/4)
KaleidoFacet(corners,centroid,Color(color),rad(-60f+60*index))
}
// Loose shards around each facet: angle from the facet's normal (degrees), starting radius (dp),
// size, palette offset and how far they tumble on the way in.
private class Shard(val angle:Float,val radius:Float,val scale:Float,val color:Int,val spin:Float)
private val shards=listOf(
Shard(20f,170f,.42f,2,1.2f),Shard(-20f,170f,.42f,4,-1.2f),
Shard(36f,320f,.3f,3,2.1f),Shard(-36f,320f,.3f,1,-2.1f),
Shard(8f,420f,.2f,5,3f),Shard(-8f,420f,.2f,5,-3f)
)
// Inner hexagon traced by the facets' inner edges: the aperture the exit flies through.
private const val InnerRadius=13.6f
private const val InnerApothem=11.8f
private const val IntroBox=132f
// The settled lockup is the header Brand() scaled up, so it reads as the same mark.
private const val LockScale=2.75f
private const val LockBox=29f*LockScale
private const val LockGap=7f*LockScale
// Opening timeline in ms, paused at GatherEnd until startup is ready. Completion is reported at IntroEnd; the timeline keeps
// running to TimelineEnd only for the slow settle while the exit plays or startup loads.
private const val MarkBox=140f
// Timeline in ms. The shard field fades in, still, until GatherEnd and holds there until startup is ready; the
// gather then plays in motion time (timeline minus GatherEnd). Completion is reported at IntroEnd; the timeline
// keeps running to TimelineEnd only so the mark stays alive while the exit plays or startup loads.
private const val GatherEnd=260f
private const val IntroEnd=2260f
private const val TimelineEnd=2900f
private const val IntroEnd=GatherEnd+1700f
private const val TimelineEnd=GatherEnd+8000f
const val StartupExitMillis=640
// The mark is larger than the old lockup, so it zooms less to end the flight at the same size.
private const val FlightZoom=30f
private val Emphasized=CubicBezierEasing(.2f,0f,0f,1f)
private val EmphasizedDecelerate=CubicBezierEasing(.05f,.7f,.1f,1f)
private val Standard=CubicBezierEasing(.4f,0f,.2f,1f)
private val InOut=CubicBezierEasing(.45f,0f,.55f,1f)
// A mechanical iris: the blades gather, snap open, and overshoot slightly as they lock.
private val IrisOpen=CubicBezierEasing(.55f,0f,.15f,1f)
private val IrisTwist=CubicBezierEasing(.5f,0f,.18f,1.1f)
// Applied in log space: a brief pull back, then an accelerating flight.
private val Flight=CubicBezierEasing(.55f,-.06f,.8f,.36f)
private val SeaGlass=Color(0xFF71B9B0)
private val Light=Color(0xFFEEF2DD)
private fun rad(degrees:Float)=degrees*PI.toFloat()/180
private fun phase(time:Float,start:Float,end:Float)=((time-start)/(end-start)).coerceIn(0f,1f)
private fun mix(from:Float,to:Float,amount:Float)=from+(to-from)*amount
private class Iris(val inward:Float,val theta:Float,val grow:Float)
private fun irisAt(time:Float):Iris {
val progress=phase(time,140f,1180f)
return Iris(InnerApothem*(1f-IrisOpen.transform(progress)),(-44f*(1f-IrisTwist.transform(progress))*PI/180).toFloat(),
mix(.64f,1f,Emphasized.transform(progress)))
/** A facet turned [rotation] about the mark center, shrunk and spun about its own centroid, then offset. */
private fun Path.facet(facet:KaleidoFacet,center:Offset,unit:Float,rotation:Float=0f,scale:Float=1f,spin:Float=0f,offset:Offset=Offset.Zero) {
val cr=cos(rotation);val sr=sin(rotation);val cs=cos(spin);val ss=sin(spin)
facet.points.forEachIndexed { index,point ->
val rx=point.x-facet.centroid.x;val ry=point.y-facet.centroid.y
val x=facet.centroid.x+(rx*cs-ry*ss)*scale;val y=facet.centroid.y+(rx*ss+ry*cs)*scale
val px=center.x+(x*cr-y*sr)*unit+offset.x;val py=center.y+(x*sr+y*cr)*unit+offset.y
if(index==0)moveTo(px,py)else lineTo(px,py)
}
close()
}
private fun Path.facet(facet:ApertureFacet,iris:Iris,unit:Float,center:Offset) {
val c=cos(iris.theta);val s=sin(iris.theta);val k=unit*iris.grow
/** A loose facet shape with its centroid at [position]. */
private fun Path.shard(facet:KaleidoFacet,position:Offset,size:Float,angle:Float) {
val c=cos(angle);val s=sin(angle)
facet.points.forEachIndexed { index,point ->
val x=point.x-facet.normal.x*iris.inward;val y=point.y-facet.normal.y*iris.inward
val px=center.x+(x*c-y*s)*k;val py=center.y+(x*s+y*c)*k
val x=point.x-facet.centroid.x;val y=point.y-facet.centroid.y
val px=position.x+(x*c-y*s)*size;val py=position.y+(x*s+y*c)*size
if(index==0)moveTo(px,py)else lineTo(px,py)
}
close()
@ -111,21 +118,21 @@ private fun Path.hexagon(center:Offset,radius:Float) {
fun startupArrivalScale(exit:Float)=mix(1.14f,1f,EmphasizedDecelerate.transform(phase(exit,.25f,1f)))
/**
* The cold-start brand sequence: a closed iris lit from behind twists open once [ready], light catches
* the facets, and the wordmark slides out of the mark. [exit] (0–1, linear) then flies
* the camera through the aperture's dark center, revealing the app drawn beneath.
* The cold-start brand sequence, the same as Kaleido Desktop: a kaleidoscope. A mirrored field of shards turns
* and gathers into the mark's six facets once [ready]; small shards circle the mark if startup runs on. [exit]
* (0–1, linear) then flies the camera through the mark's open center, revealing the app drawn beneath.
*/
@Composable fun StartupSplash(exit:()->Float,ready:()->Boolean,onComplete:()->Unit) {
val timeline=remember{Animatable(0f)}
val complete by rememberUpdatedState(onComplete)
LaunchedEffect(Unit){
// Animatable honors Android's animation duration scale, including animations off.
// Light gathers on the closed iris straight away. It is nearly still, so the first
// cold-start frames can hitch there without being noticed.
// The field fades in faint and still straight away, so the first cold-start frames
// can hitch there without being noticed.
timeline.animateTo(GatherEnd,tween(GatherEnd.toInt(),easing=LinearEasing))
// Startup data arriving composes the app beneath the splash in one long frame. Hold
// until that has happened and frames arrive steadily again (at most 700 ms), so
// the iris never opens through it.
// the gather, fastest at its start, never runs through it.
withTimeoutOrNull(700){
snapshotFlow{ready()}.first{it}
awaitSteadyFrames(4)
@ -136,42 +143,23 @@ fun startupArrivalScale(exit:Float)=mix(1.14f,1f,EmphasizedDecelerate.transform(
snapshotFlow{timeline.value>=IntroEnd}.first{it}
complete()
}
val measurer=rememberTextMeasurer()
val density=LocalDensity.current
val style=TextStyle(color=Accent,fontSize=(19f*LockScale).sp,fontWeight=FontWeight.Bold)
val letters=remember(measurer,density){"KALEIDO".map{measurer.measure(it.toString(),style)}}
val letterX=remember(letters,density){
val tracking=with(density){(1.4f*LockScale).sp.toPx()}
letters.runningFold(0f){x,letter->x+letter.size.width+tracking}
}
val textWidth=letterX.last()-with(density){(1.4f*LockScale).sp.toPx()}
val capHeight=with(density){style.fontSize.toPx()}*.711f
val paths=remember{List(4){Path()}}
Canvas(Modifier.fillMaxSize().clearAndSetSemantics{contentDescription="Kaleido starting"}) {
val time=timeline.value
val motion=time-GatherEnd
val prelude=EmphasizedDecelerate.transform(phase(time,0f,GatherEnd))
val q=exit()
val dp=density.density
val lockup=Emphasized.transform(phase(time,1250f,2000f))
val lockWidth=(LockBox+LockGap)*dp+textWidth
var box=mix(IntroBox,LockBox,lockup)*dp
// A slow push-in keeps the settled frame alive.
val drift=1f+.025f*InOut.transform(phase(time,1900f,2900f))
var cx=mix(center.x,center.x-lockWidth/2+LockBox*dp/2,lockup)
var cy=center.y
var zoom=1f;var textAlpha=1f;var textShift=0f;var hole=0f
if(q>0f) {
zoom=exp(ln(52f)*Flight.transform(q))
val recenter=Standard.transform((q/.75f).coerceAtMost(1f))
cx=mix(cx,center.x,recenter);cy=mix(cy,center.y,recenter)
textAlpha=1f-Standard.transform(phase(q,0f,.4f))
textShift=-14f*dp*Standard.transform(phase(q,0f,.4f))
hole=InOut.transform(phase(q,.12f,.5f))
}
val unit=box/64f*drift*zoom
val origin=Offset(cx,cy)
val (surface,aperture,facets,ray)=paths
val dp=density
val zoom=if(q>0f)exp(ln(FlightZoom)*Flight.transform(q))else 1f
val unit=MarkBox*dp/64f*zoom
val origin=center
val gather=Emphasized.transform(phase(motion,0f,1450f))
// The whole field turns a little less than half a revolution as it gathers.
val field=rad(-150f)*(1f-Emphasized.transform(phase(motion,0f,1550f)))
val (surface,aperture,shape,ring)=paths
// Splash surface: Ink everywhere, with the aperture's center cut away on exit.
val hole=InOut.transform(phase(q,.12f,.5f))
if(hole<=0f)drawRect(Ink)
else {
surface.rewind();surface.fillType=PathFillType.EvenOdd
@ -180,81 +168,70 @@ fun startupArrivalScale(exit:Float)=mix(1.14f,1f,EmphasizedDecelerate.transform(
if(hole<1f){aperture.rewind();aperture.hexagon(origin,InnerRadius*unit);drawPath(aperture,Ink,alpha=1f-hole)}
}
val iris=irisAt(time)
val lightUp=EmphasizedDecelerate.transform(phase(time,0f,620f))
val light=lightUp*(1f-Standard.transform(phase(time,620f,1250f)))
val ambient=.03f*InOut.transform(phase(time,300f,900f))*(1f-Standard.transform(phase(time,1500f,2300f)))
// Light behind the blades: a soft bloom, a hot core, and rays leaking through
// the six gaps while the iris turns.
if(light>.001f||ambient>.001f) {
val bloom=250f*dp
drawCircle(Brush.radialGradient(0f to SeaGlass.copy(alpha=.16f*light+ambient),.45f to SeaGlass.copy(alpha=.04f*light+ambient*.3f),
1f to Color.Transparent,center=origin,radius=bloom),bloom,origin,blendMode=BlendMode.Plus)
val core=26f*unit/2.0625f*mix(.6f,1f,light)
if(light>.001f) {
drawCircle(Brush.radialGradient(0f to Color(1f,.98f,.925f,.95f*light),.35f to Color(0xFFEEF2DD).copy(alpha=.55f*light),
1f to Color.Transparent,center=origin,radius=core),core,origin,blendMode=BlendMode.Plus)
val rays=light*(IrisOpen.transform(phase(time,140f,1180f))*2.5f).coerceAtMost(1f)
for(index in 0 until 6) {
val angle=((-90.0+60*index)*PI/180).toFloat()+iris.theta
val length=mix(40f,250f,lightUp)*(.75f+.25f*sin(index*2.1f+1f))*dp
ray.rewind();ray.moveTo(origin.x,origin.y)
ray.lineTo(origin.x+cos(angle-.014f)*length,origin.y+sin(angle-.014f)*length)
ray.lineTo(origin.x+cos(angle+.014f)*length,origin.y+sin(angle+.014f)*length);ray.close()
drawPath(ray,Brush.linearGradient(0f to Color(1f,.973f,.902f,.42f*rays),.25f to Color(0xFFD6ECE2).copy(alpha=.12f*rays),
1f to Color.Transparent,start=origin,end=Offset(origin.x+cos(angle)*length,origin.y+sin(angle)*length)),blendMode=BlendMode.Plus)
// The kaleidoscope's mirror lines, turning with the field.
val lines=max(.5f*prelude,InOut.transform(phase(motion,0f,450f)))*(1f-Standard.transform(phase(motion,1100f,1700f)))
if(lines>0f) for(index in 0 until 6) {
val angle=field+rad(-90f+60*index)
val end=origin+Offset(cos(angle),sin(angle))*(640f*dp)
drawLine(Brush.linearGradient(0f to Light.copy(alpha=.2f*lines),1f to Color.Transparent,start=origin,end=end),origin,end,dp)
}
val bloom=.09f*InOut.transform(phase(motion,200f,1000f))*(1f-Standard.transform(phase(motion,1500f,2600f)))
if(bloom>.001f) {
val radius=300f*dp
drawCircle(Brush.radialGradient(0f to SeaGlass.copy(alpha=bloom),.45f to SeaGlass.copy(alpha=bloom*.3f),1f to Color.Transparent,
center=origin,radius=radius),radius,origin,blendMode=BlendMode.Plus)
}
// Shards spiral inward, faster than the field turns, and vanish into the center.
val inward=Emphasized.transform(phase(motion,0f,1350f))
kaleidoFacets.forEachIndexed { s,facet ->
shards.forEachIndexed { j,shard ->
val appear=max(.3f*prelude,Standard.transform(phase(motion,j*50f+s*25,j*50f+s*25+420)))
val vanish=Standard.transform(phase(motion,750f+j*45,1350f+j*45))
if(appear>0f&&vanish<1f) {
val angle=facet.angle+rad(shard.angle)+field*1.5f
val radius=shard.radius*dp*(1f-.88f*inward)
shape.rewind()
shape.shard(facet,origin+Offset(cos(angle),sin(angle))*radius,unit*shard.scale*(1f-.6f*vanish),field*2+shard.spin*(1f-gather))
drawPath(shape,kaleidoFacets[(s+shard.color)%6].color,alpha=appear*(1f-vanish)*.9f,blendMode=BlendMode.Screen)
}
}
}
// Facets. Short echoes of earlier frames act as motion blur while the blades
// turn; they disappear beneath the facets once the iris is still.
fun facetAlpha(index:Int)=EmphasizedDecelerate.transform(phase(time,40f+index*34,380f+index*34))
if(time<1400f) for((delay,alpha) in listOf(84f to .07f,56f to .12f,28f to .2f)) {
val echo=irisAt(time-delay)
apertureFacets.forEachIndexed { index,facet ->
facets.rewind();facets.facet(facet,echo,unit,origin);drawPath(facets,facet.color,alpha=alpha*facetAlpha(index))
}
}
apertureFacets.forEachIndexed { index,facet ->
facets.rewind();facets.facet(facet,iris,unit,origin);drawPath(facets,facet.color,alpha=facetAlpha(index))
// The six facets ride in from the field and lock into the mark.
kaleidoFacets.forEachIndexed { s,facet ->
val radius=240f*dp*(1f-gather);val angle=facet.angle+field
shape.rewind()
shape.facet(facet,origin,unit,field,mix(.55f,1f,gather),rad(-60f)*(1f-gather),Offset(cos(angle),sin(angle))*radius)
drawPath(shape,facet.color,alpha=max(.3f*prelude,Standard.transform(phase(motion,s*25f,s*25f+420))))
}
val sheen=phase(time,980f,1560f)
if(light>.01f||(sheen>0f&&sheen<1f)) {
facets.rewind();apertureFacets.forEach{facets.facet(it,iris,unit,origin)}
clipPath(facets) {
// Backlight tints the blades while the core is hot, so they read as glass.
if(light>.01f) {
val radius=36f*unit/2.0625f
drawCircle(Brush.radialGradient(0f to Color(1f,.988f,.94f,.26f*light),1f to Color.Transparent,center=origin,radius=radius),radius,origin)
}
// One diagonal band of light crosses the settled mark.
if(sheen>0f&&sheen<1f) {
val reach=34f*unit;val angle=36f*PI.toFloat()/180;val direction=Offset(cos(angle),sin(angle))
val position=mix(-1.25f,1.25f,InOut.transform(sheen))*reach;val width=10f*unit
val peak=.42f*sin((sheen*1.1f).coerceAtMost(1f)*PI.toFloat())
drawRect(Brush.linearGradient(0f to Color.Transparent,.5f to Color.White.copy(alpha=peak),1f to Color.Transparent,
start=origin+direction*(position-width),end=origin+direction*(position+width)),origin-Offset(reach,reach),Size(reach*2,reach*2))
}
}
// A ring pulses out as the facets lock.
val pulse=phase(motion,1380f,2050f)
if(pulse>0f&&pulse<1f) {
ring.rewind();ring.hexagon(origin,(30f+24f*EmphasizedDecelerate.transform(pulse))*unit)
drawPath(ring,SeaGlass,alpha=.45f*(1f-pulse),style=Stroke(1.5f*dp))
}
// The wordmark slides out from behind the mark as it moves into the lockup.
if(time>=1400f&&textAlpha>0f) {
val scale=box/(LockBox*dp)*drift
val textLeft=cx-box*drift/2+(LockBox+LockGap)*dp*scale
val slide=EmphasizedDecelerate.transform(phase(time,1400f,2050f))
val baseline=cy+capHeight/2*scale
clipRect(left=cx+24.5f*unit+2f*dp*scale) {
letters.forEachIndexed { index,letter ->
val start=1460f+index*45
val reveal=Standard.transform(phase(time,start,start+320f))
if(reveal>0f) withTransform({
translate(textLeft+(letterX[index]-(1f-slide)*textWidth*.42f)*scale+textShift,baseline-letter.firstBaseline*scale)
scale(scale,scale,pivot=Offset.Zero)
}) {drawText(letter,alpha=reveal*textAlpha)}
}
// Still starting: small shards keep circling the mark.
val idle=Standard.transform(phase(motion,2300f,2900f))*(1f-phase(q,0f,.25f))
if(idle>0f) for(s in 0 until 6) for(side in intArrayOf(-1,1)) {
val angle=rad(-60f+60*s)+side*rad(11f)+(motion-2300f)*.00032f
shape.rewind();shape.shard(kaleidoFacets[s],origin+Offset(cos(angle),sin(angle))*(50f*unit),unit*.16f,angle*2)
drawPath(shape,kaleidoFacets[(s+if(side>0)2 else 4)%6].color,alpha=.4f*idle,blendMode=BlendMode.Screen)
}
// A band of light crosses the settled mark, then again every few seconds while it waits.
val sheen=if(motion<1500f)0f else ((motion-1500f)%3600f)/900f
if(q==0f&&sheen>0f&&sheen<1f) {
shape.rewind();kaleidoFacets.forEach{shape.facet(it,origin,unit)}
clipPath(shape) {
val reach=40f*unit;val angle=rad(36f);val direction=Offset(cos(angle),sin(angle))
val position=mix(-1.25f,1.25f,InOut.transform(sheen))*reach;val width=10f*unit
val peak=.42f*sin((sheen*1.1f).coerceAtMost(1f)*PI.toFloat())
drawRect(Brush.linearGradient(0f to Color.Transparent,.5f to Color.White.copy(alpha=peak),1f to Color.Transparent,
start=origin+direction*(position-width),end=origin+direction*(position+width)),origin-Offset(reach,reach),Size(reach*2,reach*2))
}
}
}