⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 canvas.pl

📁 perl learn perl by examples
💻 PL
字号:
use Tk;
$top = MainWindow->new();
$canvas = $top->Canvas('-width' => 300, -height => 245)->pack();
# Draw a set of circles along an archimedean spiral
# The centers of these circles move along the spiral 
# (radius of spiral = constant * theta)

$origin_x = 110; $origin_y = 70; 
$PI = 3.1415926535;
$circle_radius = 5; $path_radius = 0;
for ($angle = 0; $angle <= 180; 
     $path_radius += 7, $circle_radius += 3, $angle += 10) 
{
    $path_x = $path_radius * cos ($angle * $PI / 90) + $origin_x;
    $path_y = $origin_y - $path_radius * sin($angle * $PI/90) ;
    # Calculate Topleft corner of circle
    $canvas->create ('oval', 
             $path_x - $circle_radius,
             $path_y - $circle_radius,
             $path_x + $circle_radius,
             $path_y + $circle_radius,
             -fill => 'white');
    $canvas->create ('line', 
             $origin_x, $origin_y,
             $path_x, $path_y,
             -fill => 'slategray');

}

MainLoop;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -