← 수업 제작 도구
홈 › Components › Sketch (그림판) › 화면 22

화면 22. Sketch.number [sink]

원본: Computation Layer 문서(Sketch (그림판)) · Try It (원본 화면)

화면 번호22 / 34
문서 항목 설명 (원문)numberidentifier: latex If the sketch has a graph background, sets the value of a variable in the calculator. This will override any existing definitions of that variable.

1. 화면 캡처 (빨간 번호 = 아래 표의 번호)

화면 22 캡처

2. CL이 입력된 곳

코드 안의 회색 줄은 원문 영어 주석이고, 파란 줄은 그 영어 주석의 번역이며, 연분홍 줄은 코드가 하는 일의 설명이다.

번호이름종류CL 코드 원문, 번역, 설명
1master CL
(화면 전체)
SCREEN
# Uses a subtitle sink to add some instruction for students below the title.
▷ 부제목 sink로 제목 아래에 학생에게 줄 안내를 더한다.
subtitle: "Use the sketch tool to complete the drawing of this cat.\nThe grid and window adjustment are there to help you add detail."
▶ 화면 제목 아래에 표시할 부제목(subtitle)은 "Use the sketch tool to complete the drawing of this cat.\nThe grid and window adjustment are there to help you add detail."(스케치 도구로 이 고양이 그림을 완성하시오. 격자와 창 조절은 세부를 그리는 데 도움을 준다.)로 한다.
글자 안의 \n은 줄을 한 번 바꾸는 표기이다. subtitle은 화면 제목 아래 가운데에 부제목을 붙인다.
2graph1그래프
# This uses a background sink to bring the sketch into the graph.
▷ 배경(background) sink로 그림판을 그래프에 가져온다.

background: layerStack(sketchLayer(sketch1.sketch),sketchLayer(sketch1.currentStroke))
▶ 그래프의 배경(background)은 layerStack(sketchLayer(sketch1.sketch),sketchLayer(sketch1.currentStroke)), 즉 sketch1에 그린 스케치와 그리는 중인 획을 쌓은 레이어로 한다.
background는 그래프의 배경 레이어를 정한다. sketchLayer(…)는 스케치를 레이어로 바꾸고 layerStack(…)은 레이어 여러 개를 쌓아 하나로 만든다. sketch는 그림판에 그려진 모든 것을 나타내는 스케치를 가져오고, currentStroke는 지금 그리는 중인 획을 나타내는 스케치를 가져온다. 이 그래프 위에 sketch1에 그린 획과 그리는 중인 획이 겹쳐 보인다.
3sketch1그림판
# This code uses the number source from graph1
# to create a matching value in this sketch component.
# The variable is used to control the spacing between gridlines.
▷ 이 코드는 graph1의 number source로 이 그림판 구성요소에 같은 값을 만든다. 이 변수는 격자선 간격을 조절하는 데 쓰인다.

number("a"): graph1.number("a")
▶ 그래프 배경의 변수 a는 그래프 graph1의 변수 a의 숫자 값(graph1.number("a"))으로 한다.
number("이름")은 그래프 배경이 있는 그림판에서 그래핑 계산기 안의 변수 값을 정하고, graph1.number("a")는 그래프 graph1의 변수 a의 숫자 값을 가져온다.
# Set the bounds of this sketch component using the variables # x_m, x_M, y_m, y_M in graph1. ▷ graph1의 변수 x_m, x_M, y_m, y_M으로 이 그림판 구성요소의 경계를 정한다. bounds: makeBounds(graph1.number("x_m"), graph1.number("x_M"), graph1.number("y_m"), graph1.number("y_M")) ▶ 그림판의 경계(bounds)는 makeBounds(graph1.number("x_m"), graph1.number("x_M"), graph1.number("y_m"), graph1.number("y_M")), 즉 왼쪽 graph1.number("x_m"), 오른쪽 graph1.number("x_M"), 아래 graph1.number("y_m"), 위 graph1.number("y_M")으로 한다.
bounds는 이 그림판의 경계를 정한다. makeBounds(left, right, bottom, top)은 왼쪽, 오른쪽, 아래, 위 값으로 경계 객체를 만든다.