Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

chase with a tail in makecode question
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

chase with a tail in makecode question

by Hotshot7997 on Sun May 10, 2020 10:13 pm

Hi I am so confused at the moment. I am trying to figure out how to create a chase. As if someone fired a blaster and it comes out the muzzle leaving a trail behind it. I got the flash effect working but I would like to see it do a chase as it makes it feel more scifi.


The code below is the flash part and it works well for what I am doing but I would like the chase with the tail. The comet animation doesn't work for this application :-( If there are suggestions on how to clean up the code below that is also welcomed.

Code: Select all | TOGGLE FULL SIZE
 for (let index = 0; index < 1; index++) {
            strip.setBrightness(0)
            strip.setAll(0xff0000)
            strip.setBrightness(20)
            pause(fire)
            strip.setBrightness(40)
            pause(fire)
            strip.setBrightness(20)
            pause(fire)
            strip.setBrightness(60)
            pause(fire)
            strip.setBrightness(20)
            pause(fire)
            strip.setBrightness(80)
            pause(fire)
            strip.setBrightness(100)
            pause(fire)
            strip.setBrightness(120)
            pause(fire)
            strip.setBrightness(140)
            pause(fire)
            strip.setBrightness(160)
            pause(fire)
            strip.setBrightness(180)
            pause(fire)
            strip.setBrightness(200)
            pause(fire)
            strip.setBrightness(160)
            pause(fire)
            strip.setBrightness(200)
            pause(fire)
            strip.setBrightness(180)
            pause(fire)
            strip.setBrightness(160)
            pause(fire)
            strip.setBrightness(140)
            pause(fire)
            strip.setBrightness(120)
            pause(fire)
            strip.setBrightness(100)
            pause(fire)
            strip.setBrightness(80)
            pause(fire)
            strip.setBrightness(60)
            pause(fire)
            strip.setBrightness(40)
            pause(fire)
            strip.setBrightness(20)
            pause(fire)
            strip.setBrightness(0)
            pauseUntil(() => input.buttonD4.isPressed())

Hotshot7997
 
Posts: 207
Joined: Fri Jul 18, 2014 2:27 am

Re: chase with a tail in makecode question

by Hotshot7997 on Mon May 11, 2020 1:26 pm

im using a trinket Mo

Hotshot7997
 
Posts: 207
Joined: Fri Jul 18, 2014 2:27 am

Re: chase with a tail in makecode question

by nickine9 on Tue May 12, 2020 7:03 am

i seem t recall that set brightness does not work "on the fly" you could try playing with the rgb colour values (255,0,0) is a brighter red than (125,0,0)

nickine9
 
Posts: 142
Joined: Fri Jan 06, 2017 4:14 am

Re: chase with a tail in makecode question

by Hotshot7997 on Fri May 15, 2020 1:04 pm

Thank you I will try that.

Hotshot7997
 
Posts: 207
Joined: Fri Jul 18, 2014 2:27 am

Please be positive and constructive with your questions and comments.