react-native-particles icon indicating copy to clipboard operation
react-native-particles copied to clipboard

Allow rotation and color cycling

Open objectiveSee opened this issue 4 years ago • 0 comments

Is there an ability to have the colors of the particles be randomly set? I am looking to recreate some Core Animation effects using your library. Core Animation allows a range of colors which I used to create a confetti effect where the pieces are all different. I'd also love the same options for emission angle and velocity "ranges".

Here's my Core Animation code. See the properties with range in their name

CAEmitterCell *cell = [CAEmitterCell emitterCell];
        cell.contents = (__bridge id)[[UIImage imageNamed:@"Confetti.png"] CGImage];
        cell.name = @"confetti";
        cell.birthRate = 150;
        cell.lifetime = 5.0;
        cell.color = [[UIColor colorWithRed:0.6 green:0.6 blue:0.6 alpha:1.0] CGColor];
        cell.redRange = 0.8;
        cell.blueRange = 0.8;
        cell.greenRange = 0.8;
        
        cell.velocity = 250;
        cell.velocityRange = 50;
        cell.emissionRange = (CGFloat) M_PI_2;
        cell.emissionLongitude = (CGFloat) M_PI;
        cell.yAcceleration = 150;
        cell.scale = 1.0;
        cell.scaleRange = 0.2;
        cell.spinRange = 10.0;
        self.emitter.emitterCells = [NSArray arrayWithObject:cell];

objectiveSee avatar Jun 11 '20 17:06 objectiveSee