小编I'm*_*fun的帖子

Javascript 动画画布(图形运动)

我是 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)

javascript animation canvas

1
推荐指数
1
解决办法
957
查看次数

将两个目录与​​文件进行比较,然后在另一个文件中给出结果差异.C#

我将两个目录与​​其中的文件进行比较.一个是旧目录(旧),另一个是新目录(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)

c# compare visual-studio

0
推荐指数
1
解决办法
672
查看次数

标签 统计

animation ×1

c# ×1

canvas ×1

compare ×1

javascript ×1

visual-studio ×1