package Ġru . app kode . cli pping demo . ui Ċ Ċ import Ġandroid . animation . Value Animator Ċ import Ġandroid . content . Context Ċ import Ġandroid . graphics . Canvas Ċ import Ġandroid . util . Attribute Set Ċ import Ġandroid . view . animation . Linear Interpolator Ċ import Ġandroid . widget . Frame Layout Ċ Ċ class ĠClip Path Star Demo Ġ@ Jvm Over loads Ġconstructor ( ĊĠ Ġcontext : ĠContext , ĊĠ Ġattrs : ĠAttributeSet ? Ġ= Ġnull , ĊĠ Ġdef Style Attr : ĠInt Ġ= Ġ 0 Ċ ): ĠFrame Layout ( context , Ġattrs , Ġdef Style Attr ) Ġ{ ĊĊĠ Ġprivate Ġval Ġmask Ġ= ĠMask Path Star ( 1 . 0 f ) ĊĊĠ Ġprivate Ġval Ġrotate Animator Ġ= ĠValue Animator . of Float ( ĊĠĠĠĠ 0 f , ĊĠĠĠĠ 6 . 2 8 3 f ĊĠ Ġ) ĊĊĠ Ġprivate Ġval Ġradius Animator Ġ= ĠValue Animator . of Float ( ĊĠĠĠĠ 0 . 4 5 f , ĊĠĠĠĠ 1 f ĊĠ Ġ) ĊĊĠ Ġinit Ġ{ ĊĠĠĠ Ġrotate Animator . repeat Count Ġ= ĠValue Animator . INF IN ITE ĊĠĠĠ Ġrotate Animator . repeat Mode Ġ= ĠValue Animator . RE START ĊĠĠĠ Ġrotate Animator . duration Ġ= Ġ 4 0 0 0 Ġ// Ġone Ġturn Ġin Ġ 4 Ġseconds ĊĠĠĠ Ġrotate Animator . interpol ator Ġ= ĠLinear Interpolator () ĊĠĠĠ Ġrotate Animator . add Update Listener Ġ{ Ġvalue Animator Ġ-> ĊĠĠĠĠĠ Ġmask . rotation Ġ= Ġvalue Animator . animated Value Ġas ĠFloat ĊĠĠĠĠĠ Ġmask . rebuild Path ( meas ured Width , Ġmeasured Height ) ĊĊĠĠĠĠĠ Ġinvalidate () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġradius Animator . repeat Count Ġ= ĠValue Animator . INF IN ITE ĊĠĠĠ Ġradius Animator . repeat Mode Ġ= ĠValue Animator . RE VERSE ĊĠĠĠ Ġradius Animator . duration Ġ= Ġ 8 0 0 ĊĠĠĠ Ġradius Animator . add Update Listener Ġ{ Ġvalue Animator Ġ-> ĊĠĠĠĠĠ Ġmask . inner Radius Factor Ġ= Ġvalue Animator . animated Value Ġas ĠFloat ĊĠĠĠĠĠ Ġmask . rebuild Path ( meas ured Width , Ġmeasured Height ) ĊĊĠĠĠĠĠ Ġinvalidate () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġradius Animator . start () ĊĠĠĠ Ġrotate Animator . start () ĊĠ Ġ} ĊĊĊĠ Ġoverride Ġfun Ġon Measure ( width Measure Spec : ĠInt , Ġheight Measure Spec : ĠInt ) Ġ{ ĊĠĠĠ Ġsuper . on Measure ( width Measure Spec , Ġheight Measure Spec ) ĊĠĠĠ Ġmask . rebuild Path ( meas ured Width , Ġmeasured Height ) ĊĠ Ġ} ĊĊĠ Ġoverride Ġfun Ġdispatch Draw ( canvas : ĠCanvas ) Ġ{ ĊĠĠĠ Ġcanvas . clip Path ( mask . getPath ()) ĊĠĠĠ Ġsuper . dispatch Draw ( canvas ) ĊĠ Ġ} ĊĊĠ Ġoverride Ġfun Ġon Attached To Window () Ġ{ ĊĠĠĠ Ġsuper . on Attached To Window () ĊĠĠĠ Ġradius Animator . start () ĊĠĠĠ Ġrotate Animator . start () ĊĠ Ġ} ĊĊĠ Ġoverride Ġfun Ġon Detached From Window () Ġ{ ĊĠĠĠ Ġradius Animator . end () ĊĠĠĠ Ġrotate Animator . end () ĊĠĠĠ Ġsuper . on Detached From Window () ĊĠ Ġ} Ċ } Ċ