ios - Rotate CAEmitterCell content based on Animation Direction -
using caemitterlayer , cell show particles have direction sensitive content image (an arrow).
want content (arrow image) point in direction cell moving.
here code having arrows move outside edge toward center. how rotate image image points in direction of movement:
emitterlayer = [caemitterlayer layer]; emitterlayer.emitterposition = self.view.center; emitterlayer.emittersize = self.view.bounds.size; emitterlayer.emittermode = kcaemitterlayeroutline; emitterlayer.emittershape = kcaemitterlayerrectangle; caemittercell* arrow = [caemittercell emittercell]; arrow.birthrate = 10; arrow.velocity = 100; arrow.emissionlatitude = m_pi; arrow.scale = 0.5; arrow.lifetime = 2; arrow.contents = (id) [[uiimage imagenamed:@"arrowoutline.png"] cgimage]; emitterlayer.emittercells = @[arrow]; [self.view.layer addsublayer:emitterlayer];
how content image adjust based on direction of cell movement?
ended using 4 different caemitterlayers 1 each direction emitterposition each edge of screen , emittersize length of given edge.
if there better solution please share.
Comments
Post a Comment