在HTML5中,我想制作一个fillRect()(带有白色填充色)和一个border(黑色).strokeRect()除非我以后可以填写,否则我不想使用.我正在制作一个游戏,你点击正方形并改变颜色(它比那更复杂,但这就是它所关注的).
<canvas id="canvas1" width="400" height="300" style="border:1px solid #000000;"></canvas>
<script>
var c=document.getElementById("canvas1");
var ctx=c.getContext("2d");
ctx.strokeStyle="rgba(0,0,0,1)";
ctx.strokeRect(0,0,100,100);
</script>
Run Code Online (Sandbox Code Playgroud)
画布周围的边框仅供参考.我也可以使用CSS,但目前一切都是HTML格式.
我正在尝试用Python创建一个程序,它接受重复Fibonacci序列多少次的输入.
...
i=1
timeNum= input("How many times do you want to repeat the sequence?")
while i <= timeNum:
...
i += 1
Run Code Online (Sandbox Code Playgroud)
如何强制输入为整数?我不能让人们重复"苹果"时代的序列吗?我知道它涉及int()但我不知道如何使用它.任何和所有的帮助表示赞赏.
canvas ×1
css ×1
fibonacci ×1
html ×1
html5 ×1
input ×1
int ×1
javascript ×1
python ×1
python-3.x ×1