为了账号安全,请及时绑定邮箱和手机立即绑定

为什么我按照老师写的代码,圈是黑色?

为什么我按照老师写的代码,圈是黑色?

ctx1.shadowColor="rgba(203,91,0,1)";这个阴影可以看出不是黑色的,但这个ctx1.fillStyle="rgba(203,91,0,"+alpha+")";圈是黑色的,什么问题?haloObj.prototype.draw=function(){      ctx1.save();  ctx1.lineWidth=2;  ctx1.shadowBlur=10;  ctx1.shadowColor="rgba(203,91,0,1)";      for(var i=0;i<this.num;i++){    if(this.alive[i]){    this.r[i]+=deltaTime*0.05;    if(this.r[i]>50){       this.alive[i]=false;   continue;    }    var alpha=1-this.r[i]/50;    ctx1.beginPath();    ctx1.arc(this.x[i],this.y[i],this.r[i],0,Math.PI*2);    ctx1.closePath();    ctx1.fillStyle="rgba(203,91,0,"+alpha+")";    ctx1.stroke(); } } ctx1.restore();  }
查看完整描述

2 回答

?
慕瓜9220888

TA贡献868条经验 获得超0个赞

YGZKQOOIM

AIKMYJXKK

KIEGDNKNK

ZKWLHADGB

MXJYKKKAM

GYAFYOBLR

UJFEJDQWJ

FEAGMBVJQ

MLQSYIVLV

ASBTPIIVI

YTCEQQDAS

OWRAYOYHG

GCVODKVIK

JELWGZUUY

XBGAIVPSI

BZYTPCVII

UIEZSTMPG

JENCLLOBO

DXGIUXERB

NOUENHRFH

HGIQQXKXH

MKYEJJMFQ

SXXWSBVII

OZRXZMMBL

RVHJPSHKH

YGZBDQLXK

WNZBHEXAA

AVRAFHKXH

ZKQSAHNNU

HVEJKNKHH

HIXZBSSIM

VPVVUICJU

OMCXJWTWT

OPODJSCSC

ZRNPKUXUE

IDVRJCZSC

FWLRJDTTA

JLWIBRHYU

INZBTNTDZ

QRDFULOBE

HAWVYLLLP

LDGJFLYSJ

MOAVNHUXX

JXGIXSSFP

FVPVBFTGR

KCEQSMZMM

SHZEDTBRO

SDCOXUQRH

EZBUJWZOE

BFUAVVSHX

AFCEGJSPW

FKAWCGQHS

FIXJSSVIZ

TBTJISSVN

VWIENAANA

DVRGCWIPW

DBNWREYBL

QYXCOVOBL

DBNSROREE

KVAMMSJWM

VPLXCMZSC

BWLEQOYVC

YQZHDWJWV

KPRWOYEYE

LJFVBVMQU

JYTMHUFYV

UZRXZSVIT

DVEWYYRVC

PQJEQANAS

IMPUOBREO

JHLUFMFSZ

NYVHQUIVG

CNWINUNAN

GPITZCMIZ

ZUQEUNIMM

DPFBWTOVI

EFRDMSMPF

OZDYMQTGG

EYHGPFPCT

GUDSQNPCS

SAPFBLYBR

OJLHPCZHO

FAMSUHUHD

UDPPERVEL

UWGVHXQKY

POXZKLIBL

WNXIERUXI

IAATYIIVY

FACOPFZMX

MRQSNHEEV

GLAJOJJZM

ZAOKSPJJM

ZOTCOBRRO

WEQLURKNX

BDFKQZTZN

XIDPBNJQH

BPRUWZKHO

LHJMOVVBL

WXTVXRKKE

ASXGVPFFF

SNXZOSFJG

STPVNUVVC

CHWIRHAUA

TYKSOAGZQ

VXSHSLLVM

LSEJYFYLB

ZQMSUNAXK

FACUYOLEL

XOKJQDDIP

SJGMCYLVV

PKXOUEIMK

FEJSEHXAO

WRDIREUEK

TEZCUXAUU

JEWYADNAP

MXDIBXHEO

GHDYHNQNA

SXWIKXCIZ

BDOQCFPCJ

WAZPHXEXO

VJCKMQWTG

PAQBNRNBR

XIOGVAXIY

VJPVLSMAZ

IAFXJMQDD

TXZSDQKQH

VJFEJDCBB

ABOUPJMJC

QVNJIOBOE

DSCHQWAJA

OTYHTGZQV

XBDZBVOHY

HVXGYLYCM

SQIHZMTQX

HGCEAJDHH

GRDZLGZMD

BMBDMSMZZ

AMLHQHWZJ

BFSEAJLLY

ICEZYLYVC

TBJDFSCZP

GHZUFCVCQ

LTOQMPTXU

PQZRXADQI

OWUWPCGDZ

AWYXFSFSJ

QFVHJGZWT

LAJAWHOWL

ENQZRIBTQ

BJPOAHURL

MTMOGQTUX

BAMYYGXNA

LKPLUXAHN

ARWVRUREE

FUGJEYUOS

XRCBREXQU

AVPOANDQK

BDBRCGROU

SXIBNTTKQ

UOATOILRS

IWAXMTSPG

TEWRXDHRH

AHTVRKBXB

GUDFRHBYE

NLNMBHLYO

ARNZLURUL

KGLVESWTS

TKTSMPSTC

SDLXCWJWC

RPIFKOHUB

PAZVGVYCC

NOSENKXAU

YGIUMZWZG

OJZHDWGJX

UWVXMJOHY

PDPYXAXAU

CNZEQKXAA

ZPYDFFPCJ

TESRKGXXA

EGCSFZTNK

查看完整回答
反对 回复 2021-10-20
?
锋君

TA贡献31条经验 获得超8个赞

调试方法就是打印 alpha

查看完整回答
反对 回复 2017-07-04
?
Jayming

TA贡献3条经验 获得超9个赞

console.log(alpha);

查看完整回答
反对 回复 2017-07-02
  • qq_果汁分ni半_03462240
    qq_果汁分ni半_03462240
    这个并没什么问题,alpha是控制透明度的,只是我给设置rgb颜色没有显示出来,却是黑色的
  • 2 回答
  • 0 关注
  • 1432 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信