Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solution by Anosov Andrey #7

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

AnosovAndrey
Copy link

No description provided.

index.html Outdated
}
else {
context.scale(1 / 3, 1 / 3); // Уменьшаем масштаб в 3 раза
drawLine(count - 1, length); context.rotate(60 * deg);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

несколько инструкций в одной строке - плохой стиль

index.html Outdated
var fill = 'transparent';
var length = Math.sqrt(Math.pow((points[0].x - points[1].x), 2) + Math.pow((points[0].y - points[1].y), 2));
function drawLine(count, length) {
context.save(); // Сохраняем текущую трансформацию
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

код должен быть понятен без комментариев

index.html Outdated
var strokes = ["#6cf", "#9cf", "#99f", "#ccf", "#66f", "#3cf", "#ff33cc", "#ff3366", "#33ff66"];
var stroke = strokes[rand(strokes.length)];
var fill = 'transparent';
var length = Math.sqrt(Math.pow((points[0].x - points[1].x), 2) + Math.pow((points[0].y - points[1].y), 2));
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Math.pow(v, 2) - это медленный способ возведения в квадрат. Тут не критично, но уже пора запомнить и использовать умножение.

index.html Outdated


}
context.save(); context.strokeStyle = stroke;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Здесь и ниже тоже не используй несколько команд в одной строке.
Чтобы было видно, что несколько команд относятся к чему-то одному — оставь пустую строчки после предыдущих инструкций и до последующих

doSomething();

doAction1();
doAction2();
doAction3();

doSomething();

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

исправлено

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants