我是 javascript canvas 的新手,正在尝试解决一些问题。我能够很好地创建图形,但它的实际运动对我来说很棘手。我可以在这里寻求有关如何挥手的帮助,但现在我想知道如何做更多。例如,是否可以让人物挥手,向右走,然后上下跳跃?
var canvas = document.getElementById("canvas");
context = canvas.getContext("2d"); // get Canvas Context object
let timestamp = Date.now();
let wave = false;
draw();
function draw() {
if(Date.now() < (timestamp+500)) return requestAnimationFrame(draw);
context.clearRect(0, 0, window.innerWidth, window.innerHeight);
context.beginPath();
context.fillStyle = "black"; // #000000
context.arc(200, 50, 30, 0, Math.PI * 2, true);
context.fill(); //fill the circle
context.beginPath();
context.lineWidth = 6;
context.stroke();
//body
context.beginPath();
context.moveTo(200, 80);
context.lineTo(200, 180);
context.strokeStyle = "black";
context.stroke();
//arms
context.beginPath();
context.strokeStyle = "black";
context.moveTo(200, 100);
context.lineTo(150, 130);
if(wave) …Run Code Online (Sandbox Code Playgroud)我将两个目录与其中的文件进行比较.一个是旧目录(旧),另一个是新目录(New),其中包含更多文件.我能够打印输出显示所有添加的文件,但它只显示结果文件中我真正希望它去的一个文件.如何让它显示结果文件中添加的所有文件?
Visual Studio上的输出
结果文件中的输出
这是我的代码:
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
String New = @"C:\Compare\New";
String Old = @"C:\Compare\Old";
String Result = @"C:\Compare\Result";
DirectoryInfo dir1 = new DirectoryInfo(New);
DirectoryInfo dir2 = new DirectoryInfo(Old);
// Take a look of the file system.
IEnumerable<FileInfo> list1 = dir1.GetFiles("*.*", SearchOption.AllDirectories);
IEnumerable<FileInfo> list2 = dir2.GetFiles("*.*", SearchOption.AllDirectories);
//A custom file comparer defined below
FileCompare compare = new FileCompare();
// Check if same or not.
// bool because of FileCompare
bool …Run Code Online (Sandbox Code Playgroud)